summaryrefslogtreecommitdiff
Side-by-side diff
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,49 +1,27 @@
-/*
+/*
* ssh-agent key manipulation utility
*
* (C) 2002 David Woodhouse <dwmw2@infradead.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
-#include <qpe/qpeapplication.h>
+#include <opie2/oapplicationfactory.h>
#include "sshkeys.h"
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-int main(int argc, char *argv[])
-{
- QPEApplication a(argc, argv);
- SSHKeysApp app;
- int fd;
+OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<SSHKeysApp> )
- /* 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,9 +1,9 @@
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 <dwmw2@infradead.org>
Architecture: arm
Depends: task-opie-minimal, ssh, opie-sh-ssh-askpass, libopiecore2
Description: Utility for managing ssh-agent keys.
Version: $QPE_VERSION$EXTRAVERSION
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
@@ -1,128 +1,140 @@
/*
* ssh-agent key manipulation utility
*
* (C) 2002 David Woodhouse <dwmw2@infradead.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "sshkeys.h"
#include <qpe/qpeapplication.h>
+#include <qdir.h>
+#include <qfile.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
#include <qlistview.h>
#include <qcombobox.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
using namespace Opie::Core;
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()));
connect(RefreshListButton, SIGNAL(clicked()), this, SLOT(doRefreshListButton()));
connect(RemoveAllButton, SIGNAL(clicked()), this, SLOT(doRemoveAllButton()));
connect(&addprocess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
this, SLOT(log_sshadd_output(Opie::Core::OProcess*,char*,int)));
connect(&addprocess, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
this, SLOT(log_sshadd_stderr(Opie::Core::OProcess*,char*,int)));
connect(&addprocess, SIGNAL(processExited(Opie::Core::OProcess*)),
this, SLOT(ssh_add_exited(Opie::Core::OProcess*)));
connect(KeyFileName, SIGNAL(textChanged(const QString&)),
this, SLOT(add_text_changed(const QString&)));
if (home) {
for (i = 0; i < sizeof(keynames)/sizeof(keynames[0]); i++) {
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);
}
}
}
doRefreshListButton();
}
SSHKeysApp::~SSHKeysApp()
{
}
void SSHKeysApp::doRefreshListButton()
{
OProcess sshadd_process;
QListViewItem *t = KeyList->firstChild();
while(t) {
QListViewItem *next = t->nextSibling();
KeyList->takeItem(t);
delete(t);
t = next;
}
connect(&sshadd_process, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
this, SLOT(get_list_keys_output(Opie::Core::OProcess*,char*,int)));
connect(&sshadd_process, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
this, SLOT(log_sshadd_stderr(Opie::Core::OProcess*,char*,int)));
keystate = KeySize;
incoming_keyname="";
incoming_keysize="";
incoming_keyfingerprint="";
// log_text("Running ssh-add -l");
sshadd_process << "ssh-add" << "-l";
bool ret = sshadd_process.start(OProcess::Block, OProcess::AllOutput);
if (!ret) {
log_text(tr("Error running ssh-add"));
return;
}
flush_sshadd_output();
if (sshadd_process.exitStatus() == 2) {
setEnabled(FALSE);
}
}
void SSHKeysApp::get_list_keys_output(OProcess *proc, char *buffer, int buflen)
{
int i;
(void) proc;
for (i=0; i<buflen; i++) {
switch(keystate) {
case Noise:
noise:
if (buffer[i] == '\n') {
log_text(incoming_noise.local8Bit());
incoming_noise = "";
keystate = KeySize;
} else {
incoming_noise += buffer[i];
}
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
@@ -1,61 +1,62 @@
/*
* ssh-agent key manipulation utility
*
* (C) 2002 David Woodhouse <dwmw2@infradead.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef SSHKEYSAPP_H
#define SSHKEYSAPP_H
#include "sshkeysbase.h"
#include <opie2/oprocess.h>
class SSHKeysApp : public SSHKeysBase
{
Q_OBJECT
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);
void flush_sshadd_output(void);
enum { Noise, KeyName, KeySize, KeyFingerprint } keystate;
QString incoming_keyname;
QString incoming_keysize;
QString incoming_keyfingerprint;
QString incoming_noise;
Opie::Core::OProcess addprocess;
QString pending_stdout;
QString pending_stderr;
private slots:
void doAddButton();
void doRefreshListButton();
void doRemoveAllButton();
void get_list_keys_output(Opie::Core::OProcess *proc, char *buffer, int buflen);
void log_sshadd_output(Opie::Core::OProcess *proc, char *buffer, int buflen);
void log_sshadd_stderr(Opie::Core::OProcess *proc, char *buffer, int buflen);
void ssh_add_exited(Opie::Core::OProcess *proc);
void add_text_changed(const QString &text);
};
#endif
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 @@
-TEMPLATE = app
-CONFIG += qt warn_on
+CONFIG += qt quick-app
HEADERS = sshkeys.h
SOURCES = main.cpp sshkeys.cpp
TARGET = sshkeys
INTERFACES = sshkeysbase.ui
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopiecore2
-DESTDIR = $(OPIEDIR)/bin
include ( $(OPIEDIR)/include.pro )