author | zecke <zecke> | 2004-11-15 15:25:22 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-11-15 15:25:22 (UTC) |
commit | ef26112d97cd5573642a0f00fd54347229857402 (patch) (unidiff) | |
tree | cb62b1e2a6a6a5ccd301fcbb0faac535ff865ee1 /noncore/settings | |
parent | 3b935c93d5576e6590ed89c75066983124e2c628 (diff) | |
download | opie-ef26112d97cd5573642a0f00fd54347229857402.zip opie-ef26112d97cd5573642a0f00fd54347229857402.tar.gz opie-ef26112d97cd5573642a0f00fd54347229857402.tar.bz2 |
-Remove char cast for homedir but use QFile::encodeName
-Make it quicklaunchable
-rw-r--r-- | noncore/settings/sshkeys/main.cpp | 26 | ||||
-rw-r--r-- | noncore/settings/sshkeys/opie-sshkeys.control | 2 | ||||
-rw-r--r-- | noncore/settings/sshkeys/sshkeys.cpp | 16 | ||||
-rw-r--r-- | noncore/settings/sshkeys/sshkeys.h | 1 | ||||
-rw-r--r-- | noncore/settings/sshkeys/sshkeys.pro | 4 |
5 files changed, 19 insertions, 30 deletions
diff --git a/noncore/settings/sshkeys/main.cpp b/noncore/settings/sshkeys/main.cpp index 9f19d0f..d0c0e2b 100644 --- a/noncore/settings/sshkeys/main.cpp +++ b/noncore/settings/sshkeys/main.cpp | |||
@@ -16,34 +16,12 @@ | |||
16 | * You should have received a copy of the GNU General Public License | 16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <qpe/qpeapplication.h> | 22 | #include <opie2/oapplicationfactory.h> |
23 | #include "sshkeys.h" | 23 | #include "sshkeys.h" |
24 | #include <stdio.h> | ||
25 | #include <sys/types.h> | ||
26 | #include <sys/stat.h> | ||
27 | #include <fcntl.h> | ||
28 | #include <sys/ioctl.h> | ||
29 | #include <unistd.h> | ||
30 | 24 | ||
31 | int main(int argc, char *argv[]) | 25 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<SSHKeysApp> ) |
32 | { | ||
33 | QPEApplication a(argc, argv); | ||
34 | SSHKeysApp app; | ||
35 | int fd; | ||
36 | 26 | ||
37 | /* If we had a controlling TTY, detach from it. | ||
38 | This is to ensure that SSH uses ssh-askpass */ | ||
39 | fd = open("/dev/tty", O_RDONLY); | ||
40 | if (fd != -1) { | ||
41 | ioctl(fd, TIOCNOTTY, NULL); | ||
42 | close(fd); | ||
43 | } | ||
44 | |||
45 | a.showMainWidget(&app); | ||
46 | |||
47 | return a.exec(); | ||
48 | } | ||
49 | 27 | ||
diff --git a/noncore/settings/sshkeys/opie-sshkeys.control b/noncore/settings/sshkeys/opie-sshkeys.control index 08e3508..1f2a1fc 100644 --- a/noncore/settings/sshkeys/opie-sshkeys.control +++ b/noncore/settings/sshkeys/opie-sshkeys.control | |||
@@ -1,8 +1,8 @@ | |||
1 | Package: opie-sshkeys | 1 | Package: opie-sshkeys |
2 | Files: bin/sshkeys apps/Settings/sshkeys.desktop pics/sshkeys/sshkeys.png | 2 | Files: plugins/applications/libsshkeys.so* bin/sshkeys apps/Settings/sshkeys.desktop pics/sshkeys/sshkeys.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/settings | 4 | Section: opie/settings |
5 | Maintainer: David Woodhouse <dwmw2@infradead.org> | 5 | Maintainer: David Woodhouse <dwmw2@infradead.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, ssh, opie-sh-ssh-askpass, libopiecore2 | 7 | Depends: task-opie-minimal, ssh, opie-sh-ssh-askpass, libopiecore2 |
8 | Description: Utility for managing ssh-agent keys. | 8 | Description: Utility for managing ssh-agent keys. |
diff --git a/noncore/settings/sshkeys/sshkeys.cpp b/noncore/settings/sshkeys/sshkeys.cpp index cebc845..d8b1014 100644 --- a/noncore/settings/sshkeys/sshkeys.cpp +++ b/noncore/settings/sshkeys/sshkeys.cpp | |||
@@ -18,31 +18,43 @@ | |||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | #include "sshkeys.h" | 21 | #include "sshkeys.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <qdir.h> | ||
25 | #include <qfile.h> | ||
24 | #include <qmultilineedit.h> | 26 | #include <qmultilineedit.h> |
25 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
26 | #include <qlistview.h> | 28 | #include <qlistview.h> |
27 | #include <qcombobox.h> | 29 | #include <qcombobox.h> |
28 | 30 | ||
29 | #include <sys/types.h> | 31 | #include <sys/types.h> |
30 | #include <sys/stat.h> | 32 | #include <sys/stat.h> |
33 | #include <fcntl.h> | ||
34 | #include <sys/ioctl.h> | ||
31 | #include <stdlib.h> | 35 | #include <stdlib.h> |
32 | #include <unistd.h> | 36 | #include <unistd.h> |
33 | #include <stdio.h> | 37 | #include <stdio.h> |
34 | #include <ctype.h> | 38 | #include <ctype.h> |
35 | 39 | ||
36 | using namespace Opie::Core; | 40 | using namespace Opie::Core; |
37 | static char *keynames[] = { "identity", "id_rsa", "id_dsa" }; | 41 | static char *keynames[] = { "identity", "id_rsa", "id_dsa" }; |
38 | 42 | ||
39 | SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) | 43 | SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) |
40 | : SSHKeysBase( parent, name, fl ) | 44 | : SSHKeysBase( parent, name, fl ) |
41 | { | 45 | { |
42 | char *home = getenv("HOME"); | 46 | /* If we had a controlling TTY, detach from it. |
47 | This is to ensure that SSH uses ssh-askpass */ | ||
48 | int fd = open("/dev/tty", O_RDONLY); | ||
49 | if (fd != -1) { | ||
50 | ioctl(fd, TIOCNOTTY, NULL); | ||
51 | close(fd); | ||
52 | } | ||
53 | |||
54 | QCString home = QFile::encodeName( QDir::homeDirPath() ); | ||
43 | unsigned i; | 55 | unsigned i; |
44 | 56 | ||
45 | connect(AddButton, SIGNAL(clicked()), this, SLOT(doAddButton())); | 57 | connect(AddButton, SIGNAL(clicked()), this, SLOT(doAddButton())); |
46 | connect(RefreshListButton, SIGNAL(clicked()), this, SLOT(doRefreshListButton())); | 58 | connect(RefreshListButton, SIGNAL(clicked()), this, SLOT(doRefreshListButton())); |
47 | connect(RemoveAllButton, SIGNAL(clicked()), this, SLOT(doRemoveAllButton())); | 59 | connect(RemoveAllButton, SIGNAL(clicked()), this, SLOT(doRemoveAllButton())); |
48 | 60 | ||
@@ -58,13 +70,13 @@ SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) | |||
58 | 70 | ||
59 | if (home) { | 71 | if (home) { |
60 | for (i = 0; i < sizeof(keynames)/sizeof(keynames[0]); i++) { | 72 | for (i = 0; i < sizeof(keynames)/sizeof(keynames[0]); i++) { |
61 | char thiskeyname[32]; | 73 | char thiskeyname[32]; |
62 | 74 | ||
63 | thiskeyname[31] = 0; | 75 | thiskeyname[31] = 0; |
64 | snprintf(thiskeyname, 31, "%s/.ssh/%s", home, keynames[i]); | 76 | snprintf(thiskeyname, 31, "%s/.ssh/%s", home.data(), keynames[i]); |
65 | if (!access(thiskeyname, R_OK)) { | 77 | if (!access(thiskeyname, R_OK)) { |
66 | KeyFileName->insertItem(thiskeyname); | 78 | KeyFileName->insertItem(thiskeyname); |
67 | } | 79 | } |
68 | } | 80 | } |
69 | } | 81 | } |
70 | 82 | ||
diff --git a/noncore/settings/sshkeys/sshkeys.h b/noncore/settings/sshkeys/sshkeys.h index 519f540..0807f74 100644 --- a/noncore/settings/sshkeys/sshkeys.h +++ b/noncore/settings/sshkeys/sshkeys.h | |||
@@ -30,12 +30,13 @@ class SSHKeysApp : public SSHKeysBase | |||
30 | { | 30 | { |
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | 32 | ||
33 | public: | 33 | public: |
34 | SSHKeysApp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 34 | SSHKeysApp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
35 | ~SSHKeysApp(); | 35 | ~SSHKeysApp(); |
36 | static QString appName() { return QString::fromLatin1( QUICKAPP_NAME); } | ||
36 | 37 | ||
37 | private: | 38 | private: |
38 | void log_text(const char *text); | 39 | void log_text(const char *text); |
39 | void flush_sshadd_output(void); | 40 | void flush_sshadd_output(void); |
40 | 41 | ||
41 | enum { Noise, KeyName, KeySize, KeyFingerprint } keystate; | 42 | enum { Noise, KeyName, KeySize, KeyFingerprint } keystate; |
diff --git a/noncore/settings/sshkeys/sshkeys.pro b/noncore/settings/sshkeys/sshkeys.pro index 87d5ce9..0910d29 100644 --- a/noncore/settings/sshkeys/sshkeys.pro +++ b/noncore/settings/sshkeys/sshkeys.pro | |||
@@ -1,12 +1,10 @@ | |||
1 | TEMPLATE = app | 1 | CONFIG += qt quick-app |
2 | CONFIG += qt warn_on | ||
3 | HEADERS = sshkeys.h | 2 | HEADERS = sshkeys.h |
4 | SOURCES = main.cpp sshkeys.cpp | 3 | SOURCES = main.cpp sshkeys.cpp |
5 | TARGET = sshkeys | 4 | TARGET = sshkeys |
6 | INTERFACES = sshkeysbase.ui | 5 | INTERFACES = sshkeysbase.ui |
7 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += $(OPIEDIR)/include | 7 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe -lopiecore2 | 8 | LIBS += -lqpe -lopiecore2 |
10 | DESTDIR = $(OPIEDIR)/bin | ||
11 | 9 | ||
12 | include ( $(OPIEDIR)/include.pro ) | 10 | include ( $(OPIEDIR)/include.pro ) |