summaryrefslogtreecommitdiff
authorzecke <zecke>2004-11-15 15:25:22 (UTC)
committer zecke <zecke>2004-11-15 15:25:22 (UTC)
commitef26112d97cd5573642a0f00fd54347229857402 (patch) (unidiff)
treecb62b1e2a6a6a5ccd301fcbb0faac535ff865ee1
parent3b935c93d5576e6590ed89c75066983124e2c628 (diff)
downloadopie-ef26112d97cd5573642a0f00fd54347229857402.zip
opie-ef26112d97cd5573642a0f00fd54347229857402.tar.gz
opie-ef26112d97cd5573642a0f00fd54347229857402.tar.bz2
-Remove char cast for homedir but use QFile::encodeName
-Make it quicklaunchable
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sshkeys/main.cpp28
-rw-r--r--noncore/settings/sshkeys/opie-sshkeys.control2
-rw-r--r--noncore/settings/sshkeys/sshkeys.cpp16
-rw-r--r--noncore/settings/sshkeys/sshkeys.h1
-rw-r--r--noncore/settings/sshkeys/sshkeys.pro4
5 files changed, 20 insertions, 31 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
@@ -1,7 +1,7 @@
1/* 1/*
2 * ssh-agent key manipulation utility 2 * ssh-agent key manipulation utility
3 * 3 *
4 * (C) 2002 David Woodhouse <dwmw2@infradead.org> 4 * (C) 2002 David Woodhouse <dwmw2@infradead.org>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -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
31int main(int argc, char *argv[]) 25OPIE_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 @@
1Package: opie-sshkeys 1Package: opie-sshkeys
2Files: bin/sshkeys apps/Settings/sshkeys.desktop pics/sshkeys/sshkeys.png 2Files: plugins/applications/libsshkeys.so* bin/sshkeys apps/Settings/sshkeys.desktop pics/sshkeys/sshkeys.png
3Priority: optional 3Priority: optional
4Section: opie/settings 4Section: opie/settings
5Maintainer: David Woodhouse <dwmw2@infradead.org> 5Maintainer: David Woodhouse <dwmw2@infradead.org>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal, ssh, opie-sh-ssh-askpass, libopiecore2 7Depends: task-opie-minimal, ssh, opie-sh-ssh-askpass, libopiecore2
8Description: Utility for managing ssh-agent keys. 8Description: 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
36using namespace Opie::Core; 40using namespace Opie::Core;
37static char *keynames[] = { "identity", "id_rsa", "id_dsa" }; 41static char *keynames[] = { "identity", "id_rsa", "id_dsa" };
38 42
39SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) 43SSHKeysApp::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 @@
1TEMPLATE = app 1CONFIG += qt quick-app
2CONFIG += qt warn_on
3HEADERS = sshkeys.h 2HEADERS = sshkeys.h
4SOURCES = main.cpp sshkeys.cpp 3SOURCES = main.cpp sshkeys.cpp
5TARGET = sshkeys 4TARGET = sshkeys
6INTERFACES = sshkeysbase.ui 5INTERFACES = sshkeysbase.ui
7INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 7DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lopiecore2 8LIBS += -lqpe -lopiecore2
10DESTDIR = $(OPIEDIR)/bin
11 9
12include ( $(OPIEDIR)/include.pro ) 10include ( $(OPIEDIR)/include.pro )