author | harlekin <harlekin> | 2002-10-24 21:01:21 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-24 21:01:21 (UTC) |
commit | a8b95086dd331c67c728a346f56416c355142758 (patch) (unidiff) | |
tree | 1df20d3dfa7231005f9417c5cd318685d675efad | |
parent | 52266c9462d599ab3268bddb301698c90bb0212c (diff) | |
download | opie-a8b95086dd331c67c728a346f56416c355142758.zip opie-a8b95086dd331c67c728a346f56416c355142758.tar.gz opie-a8b95086dd331c67c728a346f56416c355142758.tar.bz2 |
give new connection a caption
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/modemconfigwidget.cpp | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index ccecdf8..c44b359 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -329,128 +329,129 @@ void MainWindow::initUI() { | |||
329 | * connect to the menu activation | 329 | * connect to the menu activation |
330 | */ | 330 | */ |
331 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 331 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
332 | this, SLOT(slotProfile( int ) ) ); | 332 | this, SLOT(slotProfile( int ) ) ); |
333 | 333 | ||
334 | m_consoleWindow = new TabWidget( this, "blah"); | 334 | m_consoleWindow = new TabWidget( this, "blah"); |
335 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 335 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
336 | this, SLOT(slotSessionChanged(Session*) ) ); | 336 | this, SLOT(slotSessionChanged(Session*) ) ); |
337 | setCentralWidget( m_consoleWindow ); | 337 | setCentralWidget( m_consoleWindow ); |
338 | 338 | ||
339 | } | 339 | } |
340 | 340 | ||
341 | ProfileManager* MainWindow::manager() { | 341 | ProfileManager* MainWindow::manager() { |
342 | return m_manager; | 342 | return m_manager; |
343 | } | 343 | } |
344 | TabWidget* MainWindow::tabWidget() { | 344 | TabWidget* MainWindow::tabWidget() { |
345 | return m_consoleWindow; | 345 | return m_consoleWindow; |
346 | } | 346 | } |
347 | void MainWindow::populateProfiles() { | 347 | void MainWindow::populateProfiles() { |
348 | m_sessionsPop->clear(); | 348 | m_sessionsPop->clear(); |
349 | Profile::ValueList list = manager()->all(); | 349 | Profile::ValueList list = manager()->all(); |
350 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 350 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
351 | m_sessionsPop->insertItem( (*it).name() ); | 351 | m_sessionsPop->insertItem( (*it).name() ); |
352 | } | 352 | } |
353 | 353 | ||
354 | } | 354 | } |
355 | 355 | ||
356 | void MainWindow::populateScripts() { | 356 | void MainWindow::populateScripts() { |
357 | m_scriptsPop->clear(); | 357 | m_scriptsPop->clear(); |
358 | m_scriptsData.clear(); | 358 | m_scriptsData.clear(); |
359 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); | 359 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); |
360 | QListIterator<DocLnk> dit(files.children()); | 360 | QListIterator<DocLnk> dit(files.children()); |
361 | for (; dit.current(); ++dit) { | 361 | for (; dit.current(); ++dit) { |
362 | if (*dit && (*dit)->name().length()>0) { | 362 | if (*dit && (*dit)->name().length()>0) { |
363 | QFileInfo info((*dit)->file()); | 363 | QFileInfo info((*dit)->file()); |
364 | if (info.extension(false) == "script") { | 364 | if (info.extension(false) == "script") { |
365 | m_scriptsData.append(new DocLnk(**dit)); | 365 | m_scriptsData.append(new DocLnk(**dit)); |
366 | m_scriptsPop->insertItem((*dit)->name()); | 366 | m_scriptsPop->insertItem((*dit)->name()); |
367 | } | 367 | } |
368 | } | 368 | } |
369 | } | 369 | } |
370 | 370 | ||
371 | } | 371 | } |
372 | 372 | ||
373 | MainWindow::~MainWindow() { | 373 | MainWindow::~MainWindow() { |
374 | delete m_factory; | 374 | delete m_factory; |
375 | manager()->save(); | 375 | manager()->save(); |
376 | } | 376 | } |
377 | 377 | ||
378 | MetaFactory* MainWindow::factory() { | 378 | MetaFactory* MainWindow::factory() { |
379 | return m_factory; | 379 | return m_factory; |
380 | } | 380 | } |
381 | 381 | ||
382 | Session* MainWindow::currentSession() { | 382 | Session* MainWindow::currentSession() { |
383 | return m_curSession; | 383 | return m_curSession; |
384 | } | 384 | } |
385 | 385 | ||
386 | QList<Session> MainWindow::sessions() { | 386 | QList<Session> MainWindow::sessions() { |
387 | return m_sessions; | 387 | return m_sessions; |
388 | } | 388 | } |
389 | 389 | ||
390 | void MainWindow::slotNew() { | 390 | void MainWindow::slotNew() { |
391 | ProfileEditorDialog dlg(factory() ); | 391 | ProfileEditorDialog dlg(factory() ); |
392 | dlg.showMaximized(); | 392 | dlg.showMaximized(); |
393 | dlg.setCaption( tr("New Connection") ); | ||
393 | int ret = dlg.exec(); | 394 | int ret = dlg.exec(); |
394 | 395 | ||
395 | if ( ret == QDialog::Accepted ) { | 396 | if ( ret == QDialog::Accepted ) { |
396 | create( dlg.profile() ); | 397 | create( dlg.profile() ); |
397 | } | 398 | } |
398 | } | 399 | } |
399 | 400 | ||
400 | void MainWindow::slotRecordScript() { | 401 | void MainWindow::slotRecordScript() { |
401 | if (currentSession()) { | 402 | if (currentSession()) { |
402 | currentSession()->emulationHandler()->startRecording(); | 403 | currentSession()->emulationHandler()->startRecording(); |
403 | m_saveScript->setEnabled(true); | 404 | m_saveScript->setEnabled(true); |
404 | m_recordScript->setEnabled(false); | 405 | m_recordScript->setEnabled(false); |
405 | } | 406 | } |
406 | } | 407 | } |
407 | 408 | ||
408 | void MainWindow::slotSaveScript() { | 409 | void MainWindow::slotSaveScript() { |
409 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 410 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
410 | QMap<QString, QStringList> map; | 411 | QMap<QString, QStringList> map; |
411 | QStringList text; | 412 | QStringList text; |
412 | text << "text/plain"; | 413 | text << "text/plain"; |
413 | map.insert(tr("Script"), text ); | 414 | map.insert(tr("Script"), text ); |
414 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 415 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
415 | if (!filename.isEmpty()) { | 416 | if (!filename.isEmpty()) { |
416 | QFileInfo info(filename); | 417 | QFileInfo info(filename); |
417 | if (info.extension(FALSE) != "script") | 418 | if (info.extension(FALSE) != "script") |
418 | filename += ".script"; | 419 | filename += ".script"; |
419 | DocLnk nf; | 420 | DocLnk nf; |
420 | nf.setType("text/plain"); | 421 | nf.setType("text/plain"); |
421 | nf.setFile(filename); | 422 | nf.setFile(filename); |
422 | nf.setName(info.fileName()); | 423 | nf.setName(info.fileName()); |
423 | FileManager fm; | 424 | FileManager fm; |
424 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); | 425 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); |
425 | currentSession()->emulationHandler()->clearScript(); | 426 | currentSession()->emulationHandler()->clearScript(); |
426 | m_saveScript->setEnabled(false); | 427 | m_saveScript->setEnabled(false); |
427 | m_recordScript->setEnabled(true); | 428 | m_recordScript->setEnabled(true); |
428 | populateScripts(); | 429 | populateScripts(); |
429 | } | 430 | } |
430 | } | 431 | } |
431 | } | 432 | } |
432 | 433 | ||
433 | void MainWindow::slotRunScript(int id) { | 434 | void MainWindow::slotRunScript(int id) { |
434 | if (currentSession()) { | 435 | if (currentSession()) { |
435 | int index = m_scriptsPop->indexOf(id); | 436 | int index = m_scriptsPop->indexOf(id); |
436 | DocLnk *lnk = m_scriptsData.at(index); | 437 | DocLnk *lnk = m_scriptsData.at(index); |
437 | QString filePath = lnk->file(); | 438 | QString filePath = lnk->file(); |
438 | Script script(filePath); | 439 | Script script(filePath); |
439 | currentSession()->emulationHandler()->runScript(&script); | 440 | currentSession()->emulationHandler()->runScript(&script); |
440 | } | 441 | } |
441 | } | 442 | } |
442 | 443 | ||
443 | void MainWindow::slotConnect() { | 444 | void MainWindow::slotConnect() { |
444 | if ( currentSession() ) { | 445 | if ( currentSession() ) { |
445 | bool ret = currentSession()->layer()->open(); | 446 | bool ret = currentSession()->layer()->open(); |
446 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 447 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
447 | QObject::tr("Failed"), | 448 | QObject::tr("Failed"), |
448 | QObject::tr("Connecting failed for this session.")); | 449 | QObject::tr("Connecting failed for this session.")); |
449 | else { | 450 | else { |
450 | m_connect->setEnabled( false ); | 451 | m_connect->setEnabled( false ); |
451 | m_disconnect->setEnabled( true ); | 452 | m_disconnect->setEnabled( true ); |
452 | m_transfer->setEnabled( true ); | 453 | m_transfer->setEnabled( true ); |
453 | m_recordScript->setEnabled( true ); | 454 | m_recordScript->setEnabled( true ); |
454 | m_scripts->setItemEnabled(m_runScript_id, true); | 455 | m_scripts->setItemEnabled(m_runScript_id, true); |
455 | } | 456 | } |
456 | } | 457 | } |
diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index da5db83..ec83b9f 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp | |||
@@ -1,104 +1,105 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qlayout.h> | 2 | #include <qlayout.h> |
3 | #include <qcombobox.h> | 3 | #include <qcombobox.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qhbox.h> | 6 | #include <qhbox.h> |
7 | #include <qregexp.h> | 7 | #include <qregexp.h> |
8 | 8 | ||
9 | #include "modemconfigwidget.h" | 9 | #include "modemconfigwidget.h" |
10 | #include "dialdialog.h" | 10 | #include "dialdialog.h" |
11 | 11 | ||
12 | namespace { | 12 | namespace { |
13 | void setCurrent( const QString& str, QComboBox* bo ) { | 13 | void setCurrent( const QString& str, QComboBox* bo ) { |
14 | uint b = bo->count(); | 14 | uint b = bo->count(); |
15 | for (int i = 0; i < bo->count(); i++ ) { | 15 | for (int i = 0; i < bo->count(); i++ ) { |
16 | if ( bo->text(i) == str ) { | 16 | if ( bo->text(i) == str ) { |
17 | bo->setCurrentItem( i ); | 17 | bo->setCurrentItem( i ); |
18 | return; | 18 | return; |
19 | } | 19 | } |
20 | } | 20 | } |
21 | bo->insertItem( str ); | 21 | bo->insertItem( str ); |
22 | bo->setCurrentItem( b ); | 22 | bo->setCurrentItem( b ); |
23 | } | 23 | } |
24 | } | 24 | } |
25 | 25 | ||
26 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, | 26 | ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, |
27 | const char* na ) | 27 | const char* na ) |
28 | : ProfileDialogConnectionWidget( name, parent, na ) { | 28 | : ProfileDialogConnectionWidget( name, parent, na ) { |
29 | 29 | ||
30 | m_lay = new QVBoxLayout( this ); | 30 | m_lay = new QVBoxLayout( this ); |
31 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); | 31 | m_device = new QLabel(tr( "Modem is attached to:" ), this ); |
32 | m_deviceCmb = new QComboBox(this ); | 32 | m_deviceCmb = new QComboBox(this ); |
33 | m_deviceCmb->setEditable( TRUE ); | 33 | m_deviceCmb->setEditable( TRUE ); |
34 | 34 | ||
35 | QLabel* telLabel = new QLabel( this ); | 35 | QLabel* telLabel = new QLabel( this ); |
36 | telLabel->setText( tr( "Enter telefon number here:" ) ); | 36 | telLabel->setText( tr( "Enter telefon number here:" ) ); |
37 | m_telNumber = new QLineEdit( this ); | 37 | m_telNumber = new QLineEdit( this ); |
38 | QHBox *buttonBox = new QHBox( this ); | 38 | QHBox *buttonBox = new QHBox( this ); |
39 | QPushButton *atButton = new QPushButton( buttonBox ); | 39 | QPushButton *atButton = new QPushButton( buttonBox ); |
40 | atButton->setText( tr( "AT commands" ) ); | 40 | atButton->setText( tr( "AT commands" ) ); |
41 | // disabled for now | ||
41 | atButton->hide(); | 42 | atButton->hide(); |
42 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); | 43 | connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); |
43 | 44 | ||
44 | QPushButton *dialButton = new QPushButton( buttonBox ); | 45 | QPushButton *dialButton = new QPushButton( buttonBox ); |
45 | dialButton->setText( tr( "Enter number" ) ); | 46 | dialButton->setText( tr( "Enter number" ) ); |
46 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); | 47 | connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); |
47 | 48 | ||
48 | 49 | ||
49 | m_base = new IOLayerBase( this, "base" ); | 50 | m_base = new IOLayerBase( this, "base" ); |
50 | 51 | ||
51 | m_lay->addWidget( m_device ); | 52 | m_lay->addWidget( m_device ); |
52 | m_lay->addWidget( m_deviceCmb ); | 53 | m_lay->addWidget( m_deviceCmb ); |
53 | m_lay->addWidget( telLabel ); | 54 | m_lay->addWidget( telLabel ); |
54 | m_lay->addWidget( m_telNumber ); | 55 | m_lay->addWidget( m_telNumber ); |
55 | m_lay->addWidget( buttonBox ); | 56 | m_lay->addWidget( buttonBox ); |
56 | m_lay->addWidget( m_base ); | 57 | m_lay->addWidget( m_base ); |
57 | 58 | ||
58 | m_deviceCmb->insertItem( "/dev/ttyS0" ); | 59 | m_deviceCmb->insertItem( "/dev/ttyS0" ); |
59 | m_deviceCmb->insertItem( "/dev/ttyS1" ); | 60 | m_deviceCmb->insertItem( "/dev/ttyS1" ); |
60 | m_deviceCmb->insertItem( "/dev/ttyS2" ); | 61 | m_deviceCmb->insertItem( "/dev/ttyS2" ); |
61 | 62 | ||
62 | atConf = new ATConfigDialog( this, "ATConfig", true ); | 63 | atConf = new ATConfigDialog( this, "ATConfig", true ); |
63 | } | 64 | } |
64 | 65 | ||
65 | ModemConfigWidget::~ModemConfigWidget() { | 66 | ModemConfigWidget::~ModemConfigWidget() { |
66 | 67 | ||
67 | } | 68 | } |
68 | void ModemConfigWidget::load( const Profile& prof ) { | 69 | void ModemConfigWidget::load( const Profile& prof ) { |
69 | 70 | ||
70 | int rad_flow = prof.readNumEntry( "Flow" ); | 71 | int rad_flow = prof.readNumEntry( "Flow" ); |
71 | int rad_parity = prof.readNumEntry( "Parity" ); | 72 | int rad_parity = prof.readNumEntry( "Parity" ); |
72 | int speed = prof.readNumEntry( "Speed" ); | 73 | int speed = prof.readNumEntry( "Speed" ); |
73 | QString number = prof.readEntry( "Number" ); | 74 | QString number = prof.readEntry( "Number" ); |
74 | 75 | ||
75 | if ( !number.isEmpty() ) { | 76 | if ( !number.isEmpty() ) { |
76 | m_telNumber->setText( number ); | 77 | m_telNumber->setText( number ); |
77 | } | 78 | } |
78 | 79 | ||
79 | if ( rad_flow == 1 ) { | 80 | if ( rad_flow == 1 ) { |
80 | m_base->setFlow( IOLayerBase::Hardware ); | 81 | m_base->setFlow( IOLayerBase::Hardware ); |
81 | } else if (rad_flow == 2) { | 82 | } else if (rad_flow == 2) { |
82 | m_base->setFlow( IOLayerBase::Software ); | 83 | m_base->setFlow( IOLayerBase::Software ); |
83 | } else if (rad_flow == 0) { | 84 | } else if (rad_flow == 0) { |
84 | m_base->setFlow( IOLayerBase::None ); | 85 | m_base->setFlow( IOLayerBase::None ); |
85 | } | 86 | } |
86 | 87 | ||
87 | 88 | ||
88 | if ( rad_parity == 1 ) { | 89 | if ( rad_parity == 1 ) { |
89 | m_base->setParity( IOLayerBase::Even ); | 90 | m_base->setParity( IOLayerBase::Even ); |
90 | } else if ( rad_parity == 2 ){ | 91 | } else if ( rad_parity == 2 ){ |
91 | m_base->setParity( IOLayerBase::Odd ); | 92 | m_base->setParity( IOLayerBase::Odd ); |
92 | } else { | 93 | } else { |
93 | m_base->setParity( IOLayerBase::NonePar ); | 94 | m_base->setParity( IOLayerBase::NonePar ); |
94 | } | 95 | } |
95 | 96 | ||
96 | switch( speed ) { | 97 | switch( speed ) { |
97 | case 115200: | 98 | case 115200: |
98 | m_base->setSpeed( IOLayerBase::Baud_115200 ); | 99 | m_base->setSpeed( IOLayerBase::Baud_115200 ); |
99 | break; | 100 | break; |
100 | case 57600: | 101 | case 57600: |
101 | m_base->setSpeed( IOLayerBase::Baud_57600 ); | 102 | m_base->setSpeed( IOLayerBase::Baud_57600 ); |
102 | break; | 103 | break; |
103 | case 38400: | 104 | case 38400: |
104 | m_base->setSpeed( IOLayerBase::Baud_38400 ); | 105 | m_base->setSpeed( IOLayerBase::Baud_38400 ); |