author | josef <josef> | 2002-10-15 22:36:10 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-15 22:36:10 (UTC) |
commit | 65ef0e86a879332cbf8b1575886d3c36c7d2d9bd (patch) (unidiff) | |
tree | b0b3f192c52dc15d639977e1d592412531d826eb | |
parent | 626b45872e1774b694727792f7306a39277e413e (diff) | |
download | opie-65ef0e86a879332cbf8b1575886d3c36c7d2d9bd.zip opie-65ef0e86a879332cbf8b1575886d3c36c7d2d9bd.tar.gz opie-65ef0e86a879332cbf8b1575886d3c36c7d2d9bd.tar.bz2 |
- 3 small fixes, please review:
- disable all relevant menu items when last session has been closed
(but this might not be the correct bugfix, so consider it temporary)
- don't set menu status to connected when connection fails
- modem sessions: when user cancels connection, close serial connection first
again, so we can reconnect (re-dial) later without problems
-rw-r--r-- | noncore/apps/opie-console/io_modem.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_serial.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 10 |
3 files changed, 13 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp index 22a3673..41f553b 100644 --- a/noncore/apps/opie-console/io_modem.cpp +++ b/noncore/apps/opie-console/io_modem.cpp | |||
@@ -1,78 +1,82 @@ | |||
1 | 1 | ||
2 | #include "io_modem.h" | 2 | #include "io_modem.h" |
3 | 3 | ||
4 | #include "dialer.h" | 4 | #include "dialer.h" |
5 | 5 | ||
6 | IOModem::IOModem( const Profile &profile ) | 6 | IOModem::IOModem( const Profile &profile ) |
7 | : IOSerial( profile ) { | 7 | : IOSerial( profile ) { |
8 | m_profile = profile; | 8 | m_profile = profile; |
9 | } | 9 | } |
10 | 10 | ||
11 | 11 | ||
12 | IOModem::~IOModem() { | 12 | IOModem::~IOModem() { |
13 | 13 | ||
14 | } | 14 | } |
15 | 15 | ||
16 | 16 | ||
17 | void IOModem::close() { | 17 | void IOModem::close() { |
18 | // maybe do a hangup here just in case...? | 18 | // maybe do a hangup here just in case...? |
19 | 19 | ||
20 | IOSerial::close(); | 20 | IOSerial::close(); |
21 | } | 21 | } |
22 | 22 | ||
23 | bool IOModem::open() { | 23 | bool IOModem::open() { |
24 | bool ret = IOSerial::open(); | 24 | bool ret = IOSerial::open(); |
25 | if(!ret) return false; | 25 | if(!ret) return false; |
26 | 26 | ||
27 | Dialer d(m_profile); | 27 | Dialer d(m_profile); |
28 | 28 | ||
29 | int result = d.exec(); | 29 | int result = d.exec(); |
30 | if(result == QDialog::Accepted) | 30 | if(result == QDialog::Accepted) |
31 | { | 31 | { |
32 | return true; | 32 | return true; |
33 | } | 33 | } |
34 | else return false; | 34 | else |
35 | { | ||
36 | close(); | ||
37 | return false; | ||
38 | } | ||
35 | } | 39 | } |
36 | 40 | ||
37 | void IOModem::reload( const Profile &config ) { | 41 | void IOModem::reload( const Profile &config ) { |
38 | 42 | ||
39 | m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); | 43 | m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); |
40 | m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); | 44 | m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); |
41 | m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); | 45 | m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); |
42 | m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); | 46 | m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); |
43 | m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); | 47 | m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); |
44 | m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); | 48 | m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); |
45 | 49 | ||
46 | m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); | 50 | m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); |
47 | m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); | 51 | m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); |
48 | m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); | 52 | m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); |
49 | m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 53 | m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
50 | m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); | 54 | m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); |
51 | m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 55 | m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
52 | m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); | 56 | m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); |
53 | m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 57 | m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
54 | m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); | 58 | m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); |
55 | m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); | 59 | m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); |
56 | m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); | 60 | m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); |
57 | m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); | 61 | m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); |
58 | m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); | 62 | m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); |
59 | m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); | 63 | m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); |
60 | m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); | 64 | m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); |
61 | m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); | 65 | m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); |
62 | m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); | 66 | m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); |
63 | m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); | 67 | m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); |
64 | } | 68 | } |
65 | 69 | ||
66 | 70 | ||
67 | QString IOModem::identifier() const { | 71 | QString IOModem::identifier() const { |
68 | return "modem"; | 72 | return "modem"; |
69 | } | 73 | } |
70 | 74 | ||
71 | QString IOModem::name() const { | 75 | QString IOModem::name() const { |
72 | return "Modem IO Layer"; | 76 | return "Modem IO Layer"; |
73 | } | 77 | } |
74 | 78 | ||
75 | void IOModem::slotExited(OProcess* proc ){ | 79 | void IOModem::slotExited(OProcess* proc ){ |
76 | close(); | 80 | close(); |
77 | } | 81 | } |
78 | 82 | ||
diff --git a/noncore/apps/opie-console/io_serial.cpp b/noncore/apps/opie-console/io_serial.cpp index b89a53b..cc63c58 100644 --- a/noncore/apps/opie-console/io_serial.cpp +++ b/noncore/apps/opie-console/io_serial.cpp | |||
@@ -1,96 +1,97 @@ | |||
1 | #include <fcntl.h> | 1 | #include <fcntl.h> |
2 | #include <termios.h> | 2 | #include <termios.h> |
3 | #include <errno.h> | 3 | #include <errno.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include "io_serial.h" | 5 | #include "io_serial.h" |
6 | 6 | ||
7 | IOSerial::IOSerial(const Profile &config) : IOLayer(config) { | 7 | IOSerial::IOSerial(const Profile &config) : IOLayer(config) { |
8 | m_read = 0l; | 8 | m_read = 0l; |
9 | m_error = 0l; | 9 | m_error = 0l; |
10 | m_fd = 0; | 10 | m_fd = 0; |
11 | m_connected = false; | 11 | m_connected = false; |
12 | reload(config); | 12 | reload(config); |
13 | } | 13 | } |
14 | 14 | ||
15 | 15 | ||
16 | IOSerial::~IOSerial() { | 16 | IOSerial::~IOSerial() { |
17 | if (m_fd) { | 17 | if (m_fd) { |
18 | close(); | 18 | close(); |
19 | } | 19 | } |
20 | } | 20 | } |
21 | 21 | ||
22 | void IOSerial::send(const QByteArray &data) { | 22 | void IOSerial::send(const QByteArray &data) { |
23 | if (m_fd) { | 23 | if (m_fd) { |
24 | write(m_fd, data.data(), data.size()); | 24 | write(m_fd, data.data(), data.size()); |
25 | } else { | 25 | } else { |
26 | emit error(Refuse, tr("Not connected")); | 26 | emit error(Refuse, tr("Not connected")); |
27 | } | 27 | } |
28 | } | 28 | } |
29 | 29 | ||
30 | void IOSerial::close() { | 30 | void IOSerial::close() { |
31 | if (m_fd) { | 31 | if (m_fd) { |
32 | delete m_read; | 32 | delete m_read; |
33 | delete m_error; | 33 | delete m_error; |
34 | ::close(m_fd); | 34 | ::close(m_fd); |
35 | m_fd = 0; | 35 | m_fd = 0; |
36 | m_connected = false; | 36 | m_connected = false; |
37 | } else { | 37 | } else { |
38 | m_connected = false; | 38 | m_connected = false; |
39 | emit error(Refuse, tr("Not connected")); | 39 | emit error(Refuse, tr("Not connected")); |
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | bool IOSerial::open() { | 43 | bool IOSerial::open() { |
44 | if (!m_fd) { | 44 | if (!m_fd) { |
45 | struct termios tty; | 45 | struct termios tty; |
46 | m_fd = ::open(m_device, O_RDWR | O_NOCTTY | O_NONBLOCK); | 46 | m_fd = ::open(m_device, O_RDWR | O_NOCTTY | O_NONBLOCK); |
47 | if (m_fd < 0) { | 47 | if (m_fd < 0) { |
48 | emit error(CouldNotOpen, strerror(errno)); | 48 | emit error(CouldNotOpen, strerror(errno)); |
49 | m_fd = 0; | ||
49 | return FALSE; | 50 | return FALSE; |
50 | } | 51 | } |
51 | tcgetattr(m_fd, &tty); | 52 | tcgetattr(m_fd, &tty); |
52 | 53 | ||
53 | /* Baud rate */ | 54 | /* Baud rate */ |
54 | int speed = baud(m_baud); | 55 | int speed = baud(m_baud); |
55 | if (speed == -1) { | 56 | if (speed == -1) { |
56 | emit error(Refuse, tr("Invalid baud rate")); | 57 | emit error(Refuse, tr("Invalid baud rate")); |
57 | } | 58 | } |
58 | cfsetospeed(&tty, speed); | 59 | cfsetospeed(&tty, speed); |
59 | cfsetispeed(&tty, speed); | 60 | cfsetispeed(&tty, speed); |
60 | 61 | ||
61 | /* Take care of Space / Mark parity */ | 62 | /* Take care of Space / Mark parity */ |
62 | if (m_dbits == 7 && (m_parity == ParitySpace || m_parity == ParityMark)) { | 63 | if (m_dbits == 7 && (m_parity == ParitySpace || m_parity == ParityMark)) { |
63 | m_dbits = 8; | 64 | m_dbits = 8; |
64 | } | 65 | } |
65 | 66 | ||
66 | /* Data bits */ | 67 | /* Data bits */ |
67 | switch (m_dbits) { | 68 | switch (m_dbits) { |
68 | case 5: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS5; break; | 69 | case 5: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS5; break; |
69 | case 6: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS6; break; | 70 | case 6: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS6; break; |
70 | case 7: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS7; break; | 71 | case 7: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS7; break; |
71 | case 8: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; break; | 72 | case 8: tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; break; |
72 | default: break; | 73 | default: break; |
73 | } | 74 | } |
74 | 75 | ||
75 | /* Raw, no echo mode */ | 76 | /* Raw, no echo mode */ |
76 | tty.c_iflag = IGNBRK; | 77 | tty.c_iflag = IGNBRK; |
77 | tty.c_lflag = 0; | 78 | tty.c_lflag = 0; |
78 | tty.c_oflag = 0; | 79 | tty.c_oflag = 0; |
79 | tty.c_cflag |= CLOCAL | CREAD; | 80 | tty.c_cflag |= CLOCAL | CREAD; |
80 | 81 | ||
81 | /* Stop bits */ | 82 | /* Stop bits */ |
82 | if (m_sbits == 2) { | 83 | if (m_sbits == 2) { |
83 | tty.c_cflag |= CSTOPB; | 84 | tty.c_cflag |= CSTOPB; |
84 | } else { | 85 | } else { |
85 | tty.c_cflag &= ~CSTOPB; | 86 | tty.c_cflag &= ~CSTOPB; |
86 | } | 87 | } |
87 | 88 | ||
88 | tty.c_cc[VMIN] = 1; | 89 | tty.c_cc[VMIN] = 1; |
89 | tty.c_cc[VTIME] = 5; | 90 | tty.c_cc[VTIME] = 5; |
90 | 91 | ||
91 | /* Flow control */ | 92 | /* Flow control */ |
92 | if (m_flow & FlowSW) | 93 | if (m_flow & FlowSW) |
93 | tty.c_iflag |= IXON | IXOFF; | 94 | tty.c_iflag |= IXON | IXOFF; |
94 | else | 95 | else |
95 | tty.c_iflag &= ~(IXON|IXOFF|IXANY); | 96 | tty.c_iflag &= ~(IXON|IXOFF|IXANY); |
96 | 97 | ||
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 4326609..9ccefa0 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -273,143 +273,147 @@ void MainWindow::slotNew() { | |||
273 | create( dlg.profile() ); | 273 | create( dlg.profile() ); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
277 | void MainWindow::slotRecordScript() { | 277 | void MainWindow::slotRecordScript() { |
278 | /* if (currentSession()) { | 278 | /* if (currentSession()) { |
279 | currentSession()->emulationLayer()->startRecording(); | 279 | currentSession()->emulationLayer()->startRecording(); |
280 | } | 280 | } |
281 | */ | 281 | */ |
282 | } | 282 | } |
283 | 283 | ||
284 | void MainWindow::slotSaveScript() { | 284 | void MainWindow::slotSaveScript() { |
285 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { | 285 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { |
286 | MimeTypes types; | 286 | MimeTypes types; |
287 | QStringList script; | 287 | QStringList script; |
288 | script << "text/plain"; | 288 | script << "text/plain"; |
289 | types.insert("Script", script); | 289 | types.insert("Script", script); |
290 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 290 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
291 | if (!filename.isEmpty()) { | 291 | if (!filename.isEmpty()) { |
292 | currentSession()->emulationLayer()->script()->saveTo(filename); | 292 | currentSession()->emulationLayer()->script()->saveTo(filename); |
293 | currentSession()->emulationLayer()->clearScript(); | 293 | currentSession()->emulationLayer()->clearScript(); |
294 | } | 294 | } |
295 | } | 295 | } |
296 | */ | 296 | */ |
297 | } | 297 | } |
298 | 298 | ||
299 | void MainWindow::slotRunScript() { | 299 | void MainWindow::slotRunScript() { |
300 | /* | 300 | /* |
301 | if (currentSession()) { | 301 | if (currentSession()) { |
302 | MimeTypes types; | 302 | MimeTypes types; |
303 | QStringList script; | 303 | QStringList script; |
304 | script << "text/plain"; | 304 | script << "text/plain"; |
305 | types.insert("Script", script); | 305 | types.insert("Script", script); |
306 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 306 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
307 | if (!filename.isEmpty()) { | 307 | if (!filename.isEmpty()) { |
308 | Script script(DocLnk(filename).file()); | 308 | Script script(DocLnk(filename).file()); |
309 | currentSession()->emulationLayer()->runScript(&script); | 309 | currentSession()->emulationLayer()->runScript(&script); |
310 | } | 310 | } |
311 | } | 311 | } |
312 | */ | 312 | */ |
313 | } | 313 | } |
314 | 314 | ||
315 | void MainWindow::slotConnect() { | 315 | void MainWindow::slotConnect() { |
316 | if ( currentSession() ) { | 316 | if ( currentSession() ) { |
317 | bool ret = currentSession()->layer()->open(); | 317 | bool ret = currentSession()->layer()->open(); |
318 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 318 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
319 | QObject::tr("Failed"), | 319 | QObject::tr("Failed"), |
320 | QObject::tr("Connecting failed for this session.")); | 320 | QObject::tr("Connecting failed for this session.")); |
321 | m_connect->setEnabled( false ); | 321 | else { |
322 | m_disconnect->setEnabled( true ); | 322 | m_connect->setEnabled( false ); |
323 | m_disconnect->setEnabled( true ); | ||
324 | } | ||
323 | } | 325 | } |
324 | } | 326 | } |
325 | 327 | ||
326 | void MainWindow::slotDisconnect() { | 328 | void MainWindow::slotDisconnect() { |
327 | if ( currentSession() ) { | 329 | if ( currentSession() ) { |
328 | currentSession()->layer()->close(); | 330 | currentSession()->layer()->close(); |
329 | m_connect->setEnabled( true ); | 331 | m_connect->setEnabled( true ); |
330 | m_disconnect->setEnabled( false ); | 332 | m_disconnect->setEnabled( false ); |
331 | } | 333 | } |
332 | } | 334 | } |
333 | 335 | ||
334 | void MainWindow::slotTerminate() { | 336 | void MainWindow::slotTerminate() { |
335 | if ( currentSession() ) | 337 | if ( currentSession() ) |
336 | currentSession()->layer()->close(); | 338 | currentSession()->layer()->close(); |
337 | 339 | ||
338 | slotClose(); | 340 | slotClose(); |
339 | /* FIXME move to the next session */ | 341 | /* FIXME move to the next session */ |
340 | } | 342 | } |
341 | 343 | ||
342 | void MainWindow::slotConfigure() { | 344 | void MainWindow::slotConfigure() { |
343 | ConfigDialog conf( manager()->all(), factory() ); | 345 | ConfigDialog conf( manager()->all(), factory() ); |
344 | conf.showMaximized(); | 346 | conf.showMaximized(); |
345 | 347 | ||
346 | int ret = conf.exec(); | 348 | int ret = conf.exec(); |
347 | 349 | ||
348 | if ( QDialog::Accepted == ret ) { | 350 | if ( QDialog::Accepted == ret ) { |
349 | manager()->setProfiles( conf.list() ); | 351 | manager()->setProfiles( conf.list() ); |
350 | manager()->save(); | 352 | manager()->save(); |
351 | populateProfiles(); | 353 | populateProfiles(); |
352 | } | 354 | } |
353 | } | 355 | } |
354 | /* | 356 | /* |
355 | * we will remove | 357 | * we will remove |
356 | * this window from the tabwidget | 358 | * this window from the tabwidget |
357 | * remove it from the list | 359 | * remove it from the list |
358 | * delete it | 360 | * delete it |
359 | * and set the currentSession() | 361 | * and set the currentSession() |
360 | */ | 362 | */ |
361 | void MainWindow::slotClose() { | 363 | void MainWindow::slotClose() { |
362 | if (!currentSession() ) | 364 | if (!currentSession() ) |
363 | return; | 365 | return; |
364 | 366 | ||
365 | Session* ses = currentSession(); | 367 | Session* ses = currentSession(); |
366 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 368 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
367 | tabWidget()->remove( currentSession() ); | 369 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
370 | m_curSession = NULL; | ||
371 | tabWidget()->remove( /*currentSession()*/ses ); | ||
368 | /*it's autodelete */ | 372 | /*it's autodelete */ |
369 | m_sessions.remove( ses ); | 373 | m_sessions.remove( ses ); |
370 | qWarning("after remove!!"); | 374 | qWarning("after remove!!"); |
371 | 375 | ||
372 | if (!currentSession() ) { | 376 | if (!currentSession() ) { |
373 | m_connect->setEnabled( false ); | 377 | m_connect->setEnabled( false ); |
374 | m_disconnect->setEnabled( false ); | 378 | m_disconnect->setEnabled( false ); |
375 | m_terminate->setEnabled( false ); | 379 | m_terminate->setEnabled( false ); |
376 | m_transfer->setEnabled( false ); | 380 | m_transfer->setEnabled( false ); |
377 | m_recordScript->setEnabled( false ); | 381 | m_recordScript->setEnabled( false ); |
378 | m_saveScript->setEnabled( false ); | 382 | m_saveScript->setEnabled( false ); |
379 | m_runScript->setEnabled( false ); | 383 | m_runScript->setEnabled( false ); |
380 | m_fullscreen->setEnabled( false ); | 384 | m_fullscreen->setEnabled( false ); |
381 | m_closewindow->setEnabled( false ); | 385 | m_closewindow->setEnabled( false ); |
382 | } | 386 | } |
383 | } | 387 | } |
384 | 388 | ||
385 | /* | 389 | /* |
386 | * We will get the name | 390 | * We will get the name |
387 | * Then the profile | 391 | * Then the profile |
388 | * and then we will make a profile | 392 | * and then we will make a profile |
389 | */ | 393 | */ |
390 | void MainWindow::slotProfile( int id) { | 394 | void MainWindow::slotProfile( int id) { |
391 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 395 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
392 | create( prof ); | 396 | create( prof ); |
393 | } | 397 | } |
394 | void MainWindow::create( const Profile& prof ) { | 398 | void MainWindow::create( const Profile& prof ) { |
395 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 399 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
396 | 400 | ||
397 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 401 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
398 | { | 402 | { |
399 | QMessageBox::warning(this, | 403 | QMessageBox::warning(this, |
400 | QObject::tr("Session failed"), | 404 | QObject::tr("Session failed"), |
401 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 405 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
402 | //if(ses) delete ses; | 406 | //if(ses) delete ses; |
403 | return; | 407 | return; |
404 | } | 408 | } |
405 | 409 | ||
406 | m_sessions.append( ses ); | 410 | m_sessions.append( ses ); |
407 | tabWidget()->add( ses ); | 411 | tabWidget()->add( ses ); |
408 | m_curSession = ses; | 412 | m_curSession = ses; |
409 | 413 | ||
410 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 414 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
411 | m_connect->setEnabled( true ); | 415 | m_connect->setEnabled( true ); |
412 | m_disconnect->setEnabled( false ); | 416 | m_disconnect->setEnabled( false ); |
413 | m_terminate->setEnabled( true ); | 417 | m_terminate->setEnabled( true ); |
414 | m_transfer->setEnabled( true ); | 418 | m_transfer->setEnabled( true ); |
415 | m_recordScript->setEnabled( true ); | 419 | m_recordScript->setEnabled( true ); |