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,4 +1,4 @@
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>
@@ -19,31 +19,9 @@
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,5 +1,5 @@
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>
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
@@ -21,6 +21,8 @@
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>
@@ -28,6 +30,8 @@
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>
@@ -39,7 +43,15 @@ static char *keynames[] = { "identity", "id_rsa", "id_dsa" };
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()));
@@ -61,7 +73,7 @@ SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl )
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 }
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
@@ -33,6 +33,7 @@ class SSHKeysApp : public SSHKeysBase
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);
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,5 +1,4 @@
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
@@ -7,6 +6,5 @@ INTERFACES = 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 )