author | zecke <zecke> | 2004-11-15 15:37:47 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-11-15 15:37:47 (UTC) |
commit | 0d5b9141a5bda1406c513d174dbce95eb5ed0a97 (patch) (side-by-side diff) | |
tree | b15b19e2b7e5bec80d7570d10545b51bac9a9a36 | |
parent | ef26112d97cd5573642a0f00fd54347229857402 (diff) | |
download | opie-0d5b9141a5bda1406c513d174dbce95eb5ed0a97.zip opie-0d5b9141a5bda1406c513d174dbce95eb5ed0a97.tar.gz opie-0d5b9141a5bda1406c513d174dbce95eb5ed0a97.tar.bz2 |
Move the method out
-rw-r--r-- | noncore/settings/sshkeys/sshkeys.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/noncore/settings/sshkeys/sshkeys.cpp b/noncore/settings/sshkeys/sshkeys.cpp index d8b1014..57118c9 100644 --- a/noncore/settings/sshkeys/sshkeys.cpp +++ b/noncore/settings/sshkeys/sshkeys.cpp @@ -1,100 +1,107 @@ /* * 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" }; +static const char *keynames[] = { "identity", "id_rsa", "id_dsa" }; -SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) - : SSHKeysBase( parent, name, fl ) -{ + +static void detachTerminal() { /* 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); } +} + + +SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) + : SSHKeysBase( parent, name, fl ) +{ + detachTerminal(); + 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.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; } |