From ef26112d97cd5573642a0f00fd54347229857402 Mon Sep 17 00:00:00 2001 From: zecke Date: Mon, 15 Nov 2004 15:25:22 +0000 Subject: -Remove char cast for homedir but use QFile::encodeName -Make it quicklaunchable --- (limited to 'noncore/settings/sshkeys') 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 @@ -/* +/* * ssh-agent key manipulation utility * * (C) 2002 David Woodhouse @@ -19,31 +19,9 @@ * */ -#include +#include #include "sshkeys.h" -#include -#include -#include -#include -#include -#include -int main(int argc, char *argv[]) -{ - QPEApplication a(argc, argv); - SSHKeysApp app; - int fd; +OPIE_EXPORT_APP( Opie::Core::OApplicationFactory ) - /* If we had a controlling TTY, detach from it. - This is to ensure that SSH uses ssh-askpass */ - fd = open("/dev/tty", O_RDONLY); - if (fd != -1) { - ioctl(fd, TIOCNOTTY, NULL); - close(fd); - } - - a.showMainWidget(&app); - - return a.exec(); -} 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 @@ Package: opie-sshkeys -Files: bin/sshkeys apps/Settings/sshkeys.desktop pics/sshkeys/sshkeys.png +Files: plugins/applications/libsshkeys.so* bin/sshkeys apps/Settings/sshkeys.desktop pics/sshkeys/sshkeys.png Priority: optional Section: opie/settings Maintainer: David Woodhouse 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 @@ #include "sshkeys.h" #include +#include +#include #include #include #include @@ -28,6 +30,8 @@ #include #include +#include +#include #include #include #include @@ -39,7 +43,15 @@ static char *keynames[] = { "identity", "id_rsa", "id_dsa" }; SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) : SSHKeysBase( parent, name, fl ) { - char *home = getenv("HOME"); + /* If we had a controlling TTY, detach from it. + This is to ensure that SSH uses ssh-askpass */ + int fd = open("/dev/tty", O_RDONLY); + if (fd != -1) { + ioctl(fd, TIOCNOTTY, NULL); + close(fd); + } + + QCString home = QFile::encodeName( QDir::homeDirPath() ); unsigned i; connect(AddButton, SIGNAL(clicked()), this, SLOT(doAddButton())); @@ -61,7 +73,7 @@ SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) char thiskeyname[32]; thiskeyname[31] = 0; - snprintf(thiskeyname, 31, "%s/.ssh/%s", home, keynames[i]); + snprintf(thiskeyname, 31, "%s/.ssh/%s", home.data(), keynames[i]); if (!access(thiskeyname, R_OK)) { KeyFileName->insertItem(thiskeyname); } 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 public: SSHKeysApp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~SSHKeysApp(); + static QString appName() { return QString::fromLatin1( QUICKAPP_NAME); } private: 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 @@ -TEMPLATE = app -CONFIG += qt warn_on +CONFIG += qt quick-app HEADERS = sshkeys.h SOURCES = main.cpp sshkeys.cpp TARGET = sshkeys @@ -7,6 +6,5 @@ INTERFACES = sshkeysbase.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopiecore2 -DESTDIR = $(OPIEDIR)/bin include ( $(OPIEDIR)/include.pro ) -- cgit v0.9.0.2