summaryrefslogtreecommitdiff
authorzecke <zecke>2004-03-14 18:51:10 (UTC)
committer zecke <zecke>2004-03-14 18:51:10 (UTC)
commitddfee0836adbd62be48888fbe05e7a79481e81c9 (patch) (unidiff)
treec423c4f5cd9be39e892a6f3a346dde7c7c4400a9
parent617e15d4cdbe7bc962388f9710bce834182bee24 (diff)
downloadopie-ddfee0836adbd62be48888fbe05e7a79481e81c9.zip
opie-ddfee0836adbd62be48888fbe05e7a79481e81c9.tar.gz
opie-ddfee0836adbd62be48888fbe05e7a79481e81c9.tar.bz2
more ODP and right signal syntax
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp4
-rw-r--r--noncore/settings/netsystemtime/mainwindow.cpp4
-rw-r--r--noncore/settings/sshkeys/sshkeys.cpp14
3 files changed, 11 insertions, 11 deletions
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 0091a3b..420863c 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -248,100 +248,100 @@ void Ipkg :: removeStatusEntry()
248 } 248 }
249 249
250 if ( key == "Package" && value == package ) 250 if ( key == "Package" && value == package )
251 { 251 {
252 //skip lines from the deleted package 252 //skip lines from the deleted package
253 while ( ( !readStream.atEnd() ) && ( line.stripWhiteSpace() != "" ) ) 253 while ( ( !readStream.atEnd() ) && ( line.stripWhiteSpace() != "" ) )
254 { 254 {
255 line = readStream.readLine(); 255 line = readStream.readLine();
256 } 256 }
257 } else { 257 } else {
258 258
259 //write other lines into the tempfile 259 //write other lines into the tempfile
260 writeStream << line << "\n"; 260 writeStream << line << "\n";
261 261
262 // Improve UI responsiveness 262 // Improve UI responsiveness
263 i++; 263 i++;
264 if ( ( i % 50 ) == 0 ) 264 if ( ( i % 50 ) == 0 )
265 qApp->processEvents(); 265 qApp->processEvents();
266 } 266 }
267 } 267 }
268 268
269 readFile.close(); 269 readFile.close();
270 writeFile.close(); 270 writeFile.close();
271 271
272 // Remove old status file and put tmp stats file in its place 272 // Remove old status file and put tmp stats file in its place
273 remove( statusFile ); 273 remove( statusFile );
274 rename( outStatusFile, statusFile ); 274 rename( outStatusFile, statusFile );
275 } 275 }
276 276
277int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ ) 277int Ipkg :: executeIpkgCommand( QStringList &cmd, const QString /*option*/ )
278{ 278{
279 // If one is already running - should never be but just to be safe 279 // If one is already running - should never be but just to be safe
280 if ( proc ) 280 if ( proc )
281 { 281 {
282 delete proc; 282 delete proc;
283 proc = 0; 283 proc = 0;
284 } 284 }
285 285
286 // OK we're gonna use OProcess to run this thing 286 // OK we're gonna use OProcess to run this thing
287 proc = new OProcess(); 287 proc = new OProcess();
288 aborted = false; 288 aborted = false;
289 289
290 290
291 // Connect up our slots 291 // Connect up our slots
292 connect(proc, SIGNAL(processExited(Opie::Core::OProcess*)), 292 connect(proc, SIGNAL(processExited(Opie::Core::OProcess*)),
293 this, SLOT( processFinished())); 293 this, SLOT( processFinished()));
294 294
295 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), 295 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
296 this, SLOT(commandStdout(OProcess*,char*,int))); 296 this, SLOT(commandStdout(Opie::Core::OProcess*,char*,int)));
297 297
298 connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), 298 connect(proc, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
299 this, SLOT(commandStderr(OProcess*,char*,int))); 299 this, SLOT(commandStderr(Opie::Core::OProcess*,char*,int)));
300 300
301 for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it ) 301 for ( QStringList::Iterator it = cmd.begin(); it != cmd.end(); ++it )
302 { 302 {
303 *proc << (*it).latin1(); 303 *proc << (*it).latin1();
304 } 304 }
305 305
306 // Start the process going 306 // Start the process going
307 finished = false; 307 finished = false;
308 if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) 308 if(!proc->start(OProcess::NotifyOnExit, OProcess::All))
309 { 309 {
310 emit outputText( tr("Couldn't start ipkg process" ) ); 310 emit outputText( tr("Couldn't start ipkg process" ) );
311 } 311 }
312} 312}
313 313
314void Ipkg::commandStdout(OProcess*, char *buffer, int buflen) 314void Ipkg::commandStdout(OProcess*, char *buffer, int buflen)
315{ 315{
316 QString lineStr = buffer; 316 QString lineStr = buffer;
317 if ( lineStr[buflen-1] == '\n' ) 317 if ( lineStr[buflen-1] == '\n' )
318 buflen --; 318 buflen --;
319 lineStr = lineStr.left( buflen ); 319 lineStr = lineStr.left( buflen );
320 emit outputText( lineStr ); 320 emit outputText( lineStr );
321 321
322 // check if we are installing dependant packages 322 // check if we are installing dependant packages
323 if ( option == "install" || option == "reinstall" ) 323 if ( option == "install" || option == "reinstall" )
324 { 324 {
325 // Need to keep track of any dependant packages that get installed 325 // Need to keep track of any dependant packages that get installed
326 // so that we can create links to them as necessary 326 // so that we can create links to them as necessary
327 if ( lineStr.startsWith( "Installing " ) ) 327 if ( lineStr.startsWith( "Installing " ) )
328 { 328 {
329 int start = lineStr.find( " " ) + 1; 329 int start = lineStr.find( " " ) + 1;
330 int end = lineStr.find( " ", start ); 330 int end = lineStr.find( " ", start );
331 QString *package = new QString( lineStr.mid( start, end-start ) ); 331 QString *package = new QString( lineStr.mid( start, end-start ) );
332 dependantPackages->append( package ); 332 dependantPackages->append( package );
333 } 333 }
334 } 334 }
335 else if ( option == "remove" && !( flags & FORCE_DEPENDS ) && 335 else if ( option == "remove" && !( flags & FORCE_DEPENDS ) &&
336 lineStr.find( "is depended upon by packages:" ) != -1 ) 336 lineStr.find( "is depended upon by packages:" ) != -1 )
337 { 337 {
338 // Ipkg should send this to STDERR, but doesn't - so trap here 338 // Ipkg should send this to STDERR, but doesn't - so trap here
339 error = true; 339 error = true;
340 } 340 }
341 341
342 buffer[0] = '\0'; 342 buffer[0] = '\0';
343} 343}
344 344
345void Ipkg::commandStderr(OProcess*, char *buffer, int buflen) 345void Ipkg::commandStderr(OProcess*, char *buffer, int buflen)
346{ 346{
347 QString lineStr = buffer; 347 QString lineStr = buffer;
diff --git a/noncore/settings/netsystemtime/mainwindow.cpp b/noncore/settings/netsystemtime/mainwindow.cpp
index ba96f33..385d355 100644
--- a/noncore/settings/netsystemtime/mainwindow.cpp
+++ b/noncore/settings/netsystemtime/mainwindow.cpp
@@ -146,99 +146,99 @@ void MainWindow::accept()
146 146
147 // Exit app 147 // Exit app
148 qApp->quit(); 148 qApp->quit();
149} 149}
150 150
151void MainWindow::reject() 151void MainWindow::reject()
152{ 152{
153 // Reset time settings 153 // Reset time settings
154 timeTab->saveSettings( FALSE ); 154 timeTab->saveSettings( FALSE );
155 155
156 // Send notifications but do not save settings 156 // Send notifications but do not save settings
157 formatTab->saveSettings( FALSE ); 157 formatTab->saveSettings( FALSE );
158 158
159 // Exit app 159 // Exit app
160 qApp->quit(); 160 qApp->quit();
161} 161}
162 162
163void MainWindow::runNTP() 163void MainWindow::runNTP()
164{ 164{
165 if ( !ntpDelayElapsed() && ntpInteractive ) 165 if ( !ntpDelayElapsed() && ntpInteractive )
166 { 166 {
167 QString msg = tr( "You asked for a delay of %1 minutes, but only %2 minutes elapsed since last lookup.<br>Continue?" ).arg( QString::number( ntpDelay ) ).arg( QString::number( _lookupDiff / 60 ) ); 167 QString msg = tr( "You asked for a delay of %1 minutes, but only %2 minutes elapsed since last lookup.<br>Continue?" ).arg( QString::number( ntpDelay ) ).arg( QString::number( _lookupDiff / 60 ) );
168 168
169 switch ( 169 switch (
170 QMessageBox::warning( this, tr( "Continue?" ), msg, QMessageBox::Yes, QMessageBox::No ) 170 QMessageBox::warning( this, tr( "Continue?" ), msg, QMessageBox::Yes, QMessageBox::No )
171 ) 171 )
172 { 172 {
173 case QMessageBox::Yes: break; 173 case QMessageBox::Yes: break;
174 case QMessageBox::No: return; 174 case QMessageBox::No: return;
175 default: return; 175 default: return;
176 } 176 }
177 } 177 }
178 178
179 QString srv = settingsTab->ntpServer(); 179 QString srv = settingsTab->ntpServer();
180 180
181 // Send information to time server tab if enabled 181 // Send information to time server tab if enabled
182 if ( ntpTabEnabled ) 182 if ( ntpTabEnabled )
183 { 183 {
184 ntpTab->setStartTime( QDateTime::currentDateTime().toString() ); 184 ntpTab->setStartTime( QDateTime::currentDateTime().toString() );
185 QString output = tr( "Running:\nntpdate " ); 185 QString output = tr( "Running:\nntpdate " );
186 output.append( srv ); 186 output.append( srv );
187 ntpTab->addNtpOutput( output ); 187 ntpTab->addNtpOutput( output );
188 } 188 }
189 189
190 if ( !ntpProcess ) 190 if ( !ntpProcess )
191 { 191 {
192 ntpProcess = new OProcess(); 192 ntpProcess = new OProcess();
193 connect( ntpProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), 193 connect( ntpProcess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
194 this, SLOT(slotNtpOutput(OProcess*,char*,int)) ); 194 this, SLOT(slotNtpOutput(Opie::Core::OProcess*,char*,int)) );
195 connect( ntpProcess, SIGNAL(processExited(Opie::Core::OProcess*)), 195 connect( ntpProcess, SIGNAL(processExited(Opie::Core::OProcess*)),
196 this, SLOT(slotNtpFinished(OProcess*)) ); 196 this, SLOT(slotNtpFinished(Opie::Core::OProcess*)) );
197 } 197 }
198 198
199 else 199 else
200 ntpProcess->clearArguments(); 200 ntpProcess->clearArguments();
201 201
202 *ntpProcess << "ntpdate" << srv; 202 *ntpProcess << "ntpdate" << srv;
203 bool ret = ntpProcess->start( OProcess::NotifyOnExit, OProcess::AllOutput ); 203 bool ret = ntpProcess->start( OProcess::NotifyOnExit, OProcess::AllOutput );
204 if ( !ret ) 204 if ( !ret )
205 { 205 {
206 QMessageBox::critical( this, tr( "Error" ), tr( "Error while getting time from network." ) ); 206 QMessageBox::critical( this, tr( "Error" ), tr( "Error while getting time from network." ) );
207 if ( ntpTabEnabled ) 207 if ( ntpTabEnabled )
208 ntpTab->addNtpOutput( tr( "Error while executing ntpdate" ) ); 208 ntpTab->addNtpOutput( tr( "Error while executing ntpdate" ) );
209 } 209 }
210} 210}
211 211
212bool MainWindow::ntpDelayElapsed() 212bool MainWindow::ntpDelayElapsed()
213{ 213{
214 // Determine if time elapsed is greater than time delay 214 // Determine if time elapsed is greater than time delay
215 Config config( "ntp" ); 215 Config config( "ntp" );
216 config.setGroup( "lookups" ); 216 config.setGroup( "lookups" );
217 _lookupDiff = TimeConversion::toUTC( QDateTime::currentDateTime() ) - config.readNumEntry( "time", 0 ); 217 _lookupDiff = TimeConversion::toUTC( QDateTime::currentDateTime() ) - config.readNumEntry( "time", 0 );
218 if ( _lookupDiff < 0 ) 218 if ( _lookupDiff < 0 )
219 return true; 219 return true;
220 return ( _lookupDiff - ( ntpDelay * 60) ) > 0; 220 return ( _lookupDiff - ( ntpDelay * 60) ) > 0;
221} 221}
222 222
223void MainWindow::slotSetTime( const QDateTime &dt ) 223void MainWindow::slotSetTime( const QDateTime &dt )
224{ 224{
225 timeTab->setDateTime( dt ); 225 timeTab->setDateTime( dt );
226} 226}
227 227
228void MainWindow::slotQCopReceive( const QCString &msg, const QByteArray & ) 228void MainWindow::slotQCopReceive( const QCString &msg, const QByteArray & )
229{ 229{
230 if ( msg == "ntpLookup(QString)" ) 230 if ( msg == "ntpLookup(QString)" )
231 { 231 {
232 ntpInteractive = false; 232 ntpInteractive = false;
233 runNTP(); 233 runNTP();
234 } 234 }
235 if ( msg == "setPredictedTime(QString)" ) 235 if ( msg == "setPredictedTime(QString)" )
236 { 236 {
237 //setPredictTime(); 237 //setPredictTime();
238 } 238 }
239} 239}
240 240
241void MainWindow::slotDisplayNTPTab( bool display ) 241void MainWindow::slotDisplayNTPTab( bool display )
242{ 242{
243 ntpTabEnabled = display; 243 ntpTabEnabled = display;
244 244
diff --git a/noncore/settings/sshkeys/sshkeys.cpp b/noncore/settings/sshkeys/sshkeys.cpp
index 31f6b85..cebc845 100644
--- a/noncore/settings/sshkeys/sshkeys.cpp
+++ b/noncore/settings/sshkeys/sshkeys.cpp
@@ -2,140 +2,140 @@
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
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 * 10 *
11 * This program is distributed in the hope that it will be useful, 11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 * 15 *
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#include "sshkeys.h" 21#include "sshkeys.h"
22 22
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qmultilineedit.h> 24#include <qmultilineedit.h>
25#include <qpushbutton.h> 25#include <qpushbutton.h>
26#include <qlistview.h> 26#include <qlistview.h>
27#include <qcombobox.h> 27#include <qcombobox.h>
28 28
29#include <sys/types.h> 29#include <sys/types.h>
30#include <sys/stat.h> 30#include <sys/stat.h>
31#include <stdlib.h> 31#include <stdlib.h>
32#include <unistd.h> 32#include <unistd.h>
33#include <stdio.h> 33#include <stdio.h>
34#include <ctype.h> 34#include <ctype.h>
35 35
36using namespace Opie::Core; 36using namespace Opie::Core;
37static char *keynames[] = { "identity", "id_rsa", "id_dsa" }; 37static char *keynames[] = { "identity", "id_rsa", "id_dsa" };
38 38
39SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl ) 39SSHKeysApp::SSHKeysApp( QWidget* parent, const char* name, WFlags fl )
40 : SSHKeysBase( parent, name, fl ) 40 : SSHKeysBase( parent, name, fl )
41{ 41{
42 char *home = getenv("HOME"); 42 char *home = getenv("HOME");
43 unsigned i; 43 unsigned i;
44 44
45 connect(AddButton, SIGNAL(clicked()), this, SLOT(doAddButton())); 45 connect(AddButton, SIGNAL(clicked()), this, SLOT(doAddButton()));
46 connect(RefreshListButton, SIGNAL(clicked()), this, SLOT(doRefreshListButton())); 46 connect(RefreshListButton, SIGNAL(clicked()), this, SLOT(doRefreshListButton()));
47 connect(RemoveAllButton, SIGNAL(clicked()), this, SLOT(doRemoveAllButton())); 47 connect(RemoveAllButton, SIGNAL(clicked()), this, SLOT(doRemoveAllButton()));
48 48
49 connect(&addprocess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), 49 connect(&addprocess, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
50 this, SLOT(log_sshadd_output(OProcess*,char*,int))); 50 this, SLOT(log_sshadd_output(Opie::Core::OProcess*,char*,int)));
51 connect(&addprocess, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), 51 connect(&addprocess, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
52 this, SLOT(log_sshadd_stderr(OProcess*,char*,int))); 52 this, SLOT(log_sshadd_stderr(Opie::Core::OProcess*,char*,int)));
53 connect(&addprocess, SIGNAL(processExited(Opie::Core::OProcess*)), 53 connect(&addprocess, SIGNAL(processExited(Opie::Core::OProcess*)),
54 this, SLOT(ssh_add_exited(OProcess*))); 54 this, SLOT(ssh_add_exited(Opie::Core::OProcess*)));
55 55
56 connect(KeyFileName, SIGNAL(textChanged(const QString&)), 56 connect(KeyFileName, SIGNAL(textChanged(const QString&)),
57 this, SLOT(add_text_changed(const QString&))); 57 this, SLOT(add_text_changed(const QString&)));
58 58
59 if (home) { 59 if (home) {
60 for (i = 0; i < sizeof(keynames)/sizeof(keynames[0]); i++) { 60 for (i = 0; i < sizeof(keynames)/sizeof(keynames[0]); i++) {
61 char thiskeyname[32]; 61 char thiskeyname[32];
62 62
63 thiskeyname[31] = 0; 63 thiskeyname[31] = 0;
64 snprintf(thiskeyname, 31, "%s/.ssh/%s", home, keynames[i]); 64 snprintf(thiskeyname, 31, "%s/.ssh/%s", home, keynames[i]);
65 if (!access(thiskeyname, R_OK)) { 65 if (!access(thiskeyname, R_OK)) {
66 KeyFileName->insertItem(thiskeyname); 66 KeyFileName->insertItem(thiskeyname);
67 } 67 }
68 } 68 }
69 } 69 }
70 70
71 doRefreshListButton(); 71 doRefreshListButton();
72} 72}
73 73
74SSHKeysApp::~SSHKeysApp() 74SSHKeysApp::~SSHKeysApp()
75{ 75{
76} 76}
77 77
78void SSHKeysApp::doRefreshListButton() 78void SSHKeysApp::doRefreshListButton()
79{ 79{
80 OProcess sshadd_process; 80 OProcess sshadd_process;
81 QListViewItem *t = KeyList->firstChild(); 81 QListViewItem *t = KeyList->firstChild();
82 82
83 while(t) { 83 while(t) {
84 QListViewItem *next = t->nextSibling(); 84 QListViewItem *next = t->nextSibling();
85 KeyList->takeItem(t); 85 KeyList->takeItem(t);
86 delete(t); 86 delete(t);
87 t = next; 87 t = next;
88 } 88 }
89 89
90 connect(&sshadd_process, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), 90 connect(&sshadd_process, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
91 this, SLOT(get_list_keys_output(OProcess*,char*,int))); 91 this, SLOT(get_list_keys_output(Opie::Core::OProcess*,char*,int)));
92 connect(&sshadd_process, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), 92 connect(&sshadd_process, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
93 this, SLOT(log_sshadd_stderr(OProcess*,char*,int))); 93 this, SLOT(log_sshadd_stderr(Opie::Core::OProcess*,char*,int)));
94 94
95 keystate = KeySize; 95 keystate = KeySize;
96 incoming_keyname=""; 96 incoming_keyname="";
97 incoming_keysize=""; 97 incoming_keysize="";
98 incoming_keyfingerprint=""; 98 incoming_keyfingerprint="";
99 99
100// log_text("Running ssh-add -l"); 100// log_text("Running ssh-add -l");
101 sshadd_process << "ssh-add" << "-l"; 101 sshadd_process << "ssh-add" << "-l";
102 bool ret = sshadd_process.start(OProcess::Block, OProcess::AllOutput); 102 bool ret = sshadd_process.start(OProcess::Block, OProcess::AllOutput);
103 if (!ret) { 103 if (!ret) {
104 log_text(tr("Error running ssh-add")); 104 log_text(tr("Error running ssh-add"));
105 return; 105 return;
106 } 106 }
107 flush_sshadd_output(); 107 flush_sshadd_output();
108 if (sshadd_process.exitStatus() == 2) { 108 if (sshadd_process.exitStatus() == 2) {
109 setEnabled(FALSE); 109 setEnabled(FALSE);
110 } 110 }
111} 111}
112 112
113void SSHKeysApp::get_list_keys_output(OProcess *proc, char *buffer, int buflen) 113void SSHKeysApp::get_list_keys_output(OProcess *proc, char *buffer, int buflen)
114{ 114{
115 int i; 115 int i;
116 (void) proc; 116 (void) proc;
117 117
118 for (i=0; i<buflen; i++) { 118 for (i=0; i<buflen; i++) {
119 switch(keystate) { 119 switch(keystate) {
120 case Noise: 120 case Noise:
121 noise: 121 noise:
122 if (buffer[i] == '\n') { 122 if (buffer[i] == '\n') {
123 log_text(incoming_noise.local8Bit()); 123 log_text(incoming_noise.local8Bit());
124 incoming_noise = ""; 124 incoming_noise = "";
125 keystate = KeySize; 125 keystate = KeySize;
126 } else { 126 } else {
127 incoming_noise += buffer[i]; 127 incoming_noise += buffer[i];
128 } 128 }
129 break; 129 break;
130 130
131 case KeySize: 131 case KeySize:
132 if (isdigit(buffer[i])) { 132 if (isdigit(buffer[i])) {
133 incoming_keysize += buffer[i]; 133 incoming_keysize += buffer[i];
134 } else if (buffer[i] == ' ') { 134 } else if (buffer[i] == ' ') {
135 keystate = KeyFingerprint; 135 keystate = KeyFingerprint;
136 } else { 136 } else {
137 incoming_keysize = ""; 137 incoming_keysize = "";
138 incoming_noise = ""; 138 incoming_noise = "";
139 keystate = Noise; 139 keystate = Noise;
140 goto noise; 140 goto noise;
141 } 141 }
@@ -234,61 +234,61 @@ void SSHKeysApp::ssh_add_exited(OProcess *proc)
234 } 234 }
235} 235}
236 236
237void SSHKeysApp::add_text_changed(const QString &text) 237void SSHKeysApp::add_text_changed(const QString &text)
238{ 238{
239 struct stat sbuf; 239 struct stat sbuf;
240 240
241 if (!text.length() || (!access(text.ascii(), R_OK) && 241 if (!text.length() || (!access(text.ascii(), R_OK) &&
242 !stat(text.ascii(), &sbuf) && 242 !stat(text.ascii(), &sbuf) &&
243 S_ISREG(sbuf.st_mode))) 243 S_ISREG(sbuf.st_mode)))
244 AddButton->setEnabled(TRUE); 244 AddButton->setEnabled(TRUE);
245 else 245 else
246 AddButton->setEnabled(FALSE); 246 AddButton->setEnabled(FALSE);
247} 247}
248 248
249void SSHKeysApp::doAddButton() 249void SSHKeysApp::doAddButton()
250{ 250{
251 addprocess.clearArguments(); 251 addprocess.clearArguments();
252 252
253 setEnabled(FALSE); 253 setEnabled(FALSE);
254 254
255 if (KeyFileName->currentText().length()) { 255 if (KeyFileName->currentText().length()) {
256 addprocess << "ssh-add" << "--" << KeyFileName->currentText(); 256 addprocess << "ssh-add" << "--" << KeyFileName->currentText();
257// log_text(QString(tr("Running ssh-add -- ")) + KeyFileName->currentText()); 257// log_text(QString(tr("Running ssh-add -- ")) + KeyFileName->currentText());
258 } else { 258 } else {
259 addprocess << "ssh-add"; 259 addprocess << "ssh-add";
260// log_text(tr("Running ssh-add")); 260// log_text(tr("Running ssh-add"));
261 } 261 }
262 bool ret = addprocess.start(OProcess::NotifyOnExit, OProcess::AllOutput); 262 bool ret = addprocess.start(OProcess::NotifyOnExit, OProcess::AllOutput);
263 if (!ret) { 263 if (!ret) {
264 log_text(tr("Error running ssh-add")); 264 log_text(tr("Error running ssh-add"));
265 doRefreshListButton(); 265 doRefreshListButton();
266 setEnabled(TRUE); 266 setEnabled(TRUE);
267 } 267 }
268 flush_sshadd_output(); 268 flush_sshadd_output();
269} 269}
270 270
271void SSHKeysApp::log_text(const char *text) 271void SSHKeysApp::log_text(const char *text)
272{ 272{
273 TextOutput->append(text); 273 TextOutput->append(text);
274 TextOutput->setCursorPosition(TextOutput->numLines()+1, 0, FALSE); 274 TextOutput->setCursorPosition(TextOutput->numLines()+1, 0, FALSE);
275} 275}
276 276
277void SSHKeysApp::doRemoveAllButton() 277void SSHKeysApp::doRemoveAllButton()
278{ 278{
279 OProcess sshadd_process; 279 OProcess sshadd_process;
280 280
281 connect(&sshadd_process, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)), 281 connect(&sshadd_process, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int)),
282 this, SLOT(log_sshadd_output(OProcess*,char*,int))); 282 this, SLOT(log_sshadd_output(Opie::Core::OProcess*,char*,int)));
283 connect(&sshadd_process, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)), 283 connect(&sshadd_process, SIGNAL(receivedStderr(Opie::Core::OProcess*,char*,int)),
284 this, SLOT(log_sshadd_stderr(OProcess*,char*,int))); 284 this, SLOT(log_sshadd_stderr(Opie::Core::OProcess*,char*,int)));
285 285
286// log_text(tr("Running ssh-add -D")); 286// log_text(tr("Running ssh-add -D"));
287 sshadd_process << "ssh-add" << "-D"; 287 sshadd_process << "ssh-add" << "-D";
288 bool ret = sshadd_process.start(OProcess::Block, OProcess::AllOutput); 288 bool ret = sshadd_process.start(OProcess::Block, OProcess::AllOutput);
289 if (!ret) { 289 if (!ret) {
290 log_text(tr("Error running ssh-add")); 290 log_text(tr("Error running ssh-add"));
291 } 291 }
292 flush_sshadd_output(); 292 flush_sshadd_output();
293 doRefreshListButton(); 293 doRefreshListButton();
294} 294}