author | hash <hash> | 2002-10-18 19:50:27 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-18 19:50:27 (UTC) |
commit | bb98ac35db9807efbcc1b59dd8abbdb05ad7656b (patch) (unidiff) | |
tree | 60f83f4c10c68da1ca7641b26b91b8970ef0eaa3 | |
parent | 081001a515f23626b6299e39af4511f36db46d07 (diff) | |
download | opie-bb98ac35db9807efbcc1b59dd8abbdb05ad7656b.zip opie-bb98ac35db9807efbcc1b59dd8abbdb05ad7656b.tar.gz opie-bb98ac35db9807efbcc1b59dd8abbdb05ad7656b.tar.bz2 |
added autoconnect support. feel free to revert if i messed something up.
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/profile.cpp | 11 | ||||
-rw-r--r-- | noncore/apps/opie-console/profile.h | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.cpp | 7 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/profilemanager.cpp | 2 |
6 files changed, 25 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index cf1fbc3..5900785 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -429,13 +429,14 @@ void MainWindow::create( const Profile& prof ) { | |||
429 | m_runScript->setEnabled( true ); | 429 | m_runScript->setEnabled( true ); |
430 | m_fullscreen->setEnabled( true ); | 430 | m_fullscreen->setEnabled( true ); |
431 | m_closewindow->setEnabled( true ); | 431 | m_closewindow->setEnabled( true ); |
432 | 432 | ||
433 | 433 | ||
434 | // is io_layer wants direct connection, then autoconnect | 434 | // is io_layer wants direct connection, then autoconnect |
435 | if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 435 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
436 | if (prof.autoConnect()) { | ||
436 | slotConnect(); | 437 | slotConnect(); |
437 | } | 438 | } |
438 | } | 439 | } |
439 | 440 | ||
440 | void MainWindow::slotTransfer() | 441 | void MainWindow::slotTransfer() |
441 | { | 442 | { |
diff --git a/noncore/apps/opie-console/profile.cpp b/noncore/apps/opie-console/profile.cpp index 1a94619..51d1aa8 100644 --- a/noncore/apps/opie-console/profile.cpp +++ b/noncore/apps/opie-console/profile.cpp | |||
@@ -6,13 +6,13 @@ Profile::Profile() { | |||
6 | Profile::Profile( const QString& name, | 6 | Profile::Profile( const QString& name, |
7 | const QCString& iolayerName, | 7 | const QCString& iolayerName, |
8 | const QCString& termName, | 8 | const QCString& termName, |
9 | int background, | 9 | int background, |
10 | int foreground, | 10 | int foreground, |
11 | int terminal ) | 11 | int terminal ) |
12 | : m_name( name ), m_ioLayer( iolayerName ), m_term( termName), | 12 | : m_name( name ), m_ioLayer( iolayerName ), m_term( termName), m_autoConnect(0), |
13 | m_back( background ), m_fore( foreground ), m_terminal( terminal ) | 13 | m_back( background ), m_fore( foreground ), m_terminal( terminal ) |
14 | {} | 14 | {} |
15 | Profile::Profile( const Profile& prof ) | 15 | Profile::Profile( const Profile& prof ) |
16 | { | 16 | { |
17 | (*this) = prof; | 17 | (*this) = prof; |
18 | } | 18 | } |
@@ -21,12 +21,13 @@ bool Profile::operator==( const Profile& prof ) { | |||
21 | 21 | ||
22 | return false; | 22 | return false; |
23 | } | 23 | } |
24 | Profile &Profile::operator=( const Profile& prof ) { | 24 | Profile &Profile::operator=( const Profile& prof ) { |
25 | m_name = prof.m_name; | 25 | m_name = prof.m_name; |
26 | m_ioLayer = prof.m_ioLayer; | 26 | m_ioLayer = prof.m_ioLayer; |
27 | m_autoConnect = prof.m_autoConnect; | ||
27 | m_back = prof.m_back; | 28 | m_back = prof.m_back; |
28 | m_fore = prof.m_fore; | 29 | m_fore = prof.m_fore; |
29 | m_terminal = prof.m_terminal; | 30 | m_terminal = prof.m_terminal; |
30 | m_conf = prof.m_conf; | 31 | m_conf = prof.m_conf; |
31 | m_term = prof.m_term; | 32 | m_term = prof.m_term; |
32 | 33 | ||
@@ -43,12 +44,16 @@ QString Profile::name()const { | |||
43 | QCString Profile::ioLayerName()const { | 44 | QCString Profile::ioLayerName()const { |
44 | return m_ioLayer; | 45 | return m_ioLayer; |
45 | } | 46 | } |
46 | QCString Profile::terminalName( )const { | 47 | QCString Profile::terminalName( )const { |
47 | return m_term; | 48 | return m_term; |
48 | } | 49 | } |
50 | bool Profile::autoConnect()const { | ||
51 | |||
52 | return m_autoConnect; | ||
53 | } | ||
49 | int Profile::foreground()const { | 54 | int Profile::foreground()const { |
50 | return m_fore; | 55 | return m_fore; |
51 | } | 56 | } |
52 | int Profile::background()const { | 57 | int Profile::background()const { |
53 | return m_back; | 58 | return m_back; |
54 | } | 59 | } |
@@ -61,12 +66,16 @@ void Profile::setName( const QString& str ) { | |||
61 | void Profile::setIOLayer( const QCString& name ) { | 66 | void Profile::setIOLayer( const QCString& name ) { |
62 | m_ioLayer = name; | 67 | m_ioLayer = name; |
63 | } | 68 | } |
64 | void Profile::setTerminalName( const QCString& str ) { | 69 | void Profile::setTerminalName( const QCString& str ) { |
65 | m_term = str; | 70 | m_term = str; |
66 | } | 71 | } |
72 | void Profile::setAutoConnect( const bool c) { | ||
73 | |||
74 | m_autoConnect = c; | ||
75 | } | ||
67 | void Profile::setBackground( int back ) { | 76 | void Profile::setBackground( int back ) { |
68 | m_back = back; | 77 | m_back = back; |
69 | } | 78 | } |
70 | void Profile::setForeground( int fore ) { | 79 | void Profile::setForeground( int fore ) { |
71 | m_fore = fore; | 80 | m_fore = fore; |
72 | } | 81 | } |
diff --git a/noncore/apps/opie-console/profile.h b/noncore/apps/opie-console/profile.h index 64eb022..4f9e9c2 100644 --- a/noncore/apps/opie-console/profile.h +++ b/noncore/apps/opie-console/profile.h | |||
@@ -34,12 +34,13 @@ public: | |||
34 | bool operator==( const Profile& prof ); | 34 | bool operator==( const Profile& prof ); |
35 | 35 | ||
36 | ~Profile(); | 36 | ~Profile(); |
37 | QString name()const; | 37 | QString name()const; |
38 | QCString ioLayerName()const; | 38 | QCString ioLayerName()const; |
39 | QCString terminalName()const; | 39 | QCString terminalName()const; |
40 | bool autoConnect()const; | ||
40 | int foreground()const; | 41 | int foreground()const; |
41 | int background()const; | 42 | int background()const; |
42 | int terminal()const; | 43 | int terminal()const; |
43 | 44 | ||
44 | /* | 45 | /* |
45 | * config stuff | 46 | * config stuff |
@@ -54,20 +55,22 @@ public: | |||
54 | int readNumEntry( const QString& key, int = -1 )const; | 55 | int readNumEntry( const QString& key, int = -1 )const; |
55 | bool readBoolEntry( const QString& key, bool = FALSE )const; | 56 | bool readBoolEntry( const QString& key, bool = FALSE )const; |
56 | 57 | ||
57 | void setName( const QString& ); | 58 | void setName( const QString& ); |
58 | void setIOLayer( const QCString& ); | 59 | void setIOLayer( const QCString& ); |
59 | void setTerminalName( const QCString& ); | 60 | void setTerminalName( const QCString& ); |
61 | void setAutoConnect( const bool ); | ||
60 | void setBackground( int back ); | 62 | void setBackground( int back ); |
61 | void setForeground( int fore ); | 63 | void setForeground( int fore ); |
62 | void setTerminal( int term ); | 64 | void setTerminal( int term ); |
63 | void setConf( const QMap<QString, QString>& ); | 65 | void setConf( const QMap<QString, QString>& ); |
64 | private: | 66 | private: |
65 | QMap<QString, QString> m_conf; | 67 | QMap<QString, QString> m_conf; |
66 | QString m_name; | 68 | QString m_name; |
67 | QCString m_ioLayer, m_term; | 69 | QCString m_ioLayer, m_term; |
70 | bool m_autoConnect; | ||
68 | int m_back; | 71 | int m_back; |
69 | int m_fore; | 72 | int m_fore; |
70 | int m_terminal; | 73 | int m_terminal; |
71 | }; | 74 | }; |
72 | 75 | ||
73 | #endif | 76 | #endif |
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 5c5c2b3..c48ea53 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp | |||
@@ -1,15 +1,16 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | #include <qlineedit.h> | 2 | #include <qlineedit.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qmessagebox.h> | 4 | #include <qmessagebox.h> |
5 | #include <qstringlist.h> | 5 | #include <qstringlist.h> |
6 | #include <qcombobox.h> | 6 | #include <qcombobox.h> |
7 | #include <qcheckbox.h> | ||
7 | 8 | ||
8 | 9 | ||
9 | #include "profileeditorplugins.h" | 10 | //#include "profileeditorplugins.h" |
10 | #include "metafactory.h" | 11 | #include "metafactory.h" |
11 | #include "profileeditordialog.h" | 12 | #include "profileeditordialog.h" |
12 | 13 | ||
13 | namespace { | 14 | namespace { |
14 | void setCurrent( const QString& str, QComboBox* bo ) { | 15 | void setCurrent( const QString& str, QComboBox* bo ) { |
15 | for (uint i = 0; i < bo->count(); i++ ) { | 16 | for (uint i = 0; i < bo->count(); i++ ) { |
@@ -75,21 +76,23 @@ void ProfileEditorDialog::initUI() | |||
75 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); | 76 | QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); |
76 | m_name = new QLineEdit(tabprof); | 77 | m_name = new QLineEdit(tabprof); |
77 | QLabel *con = new QLabel(tr("Connection"), tabprof ); | 78 | QLabel *con = new QLabel(tr("Connection"), tabprof ); |
78 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); | 79 | QLabel *term = new QLabel(tr("Terminal"), tabprof ); |
79 | m_conCmb = new QComboBox( tabprof ); | 80 | m_conCmb = new QComboBox( tabprof ); |
80 | m_termCmb = new QComboBox( tabprof ); | 81 | m_termCmb = new QComboBox( tabprof ); |
82 | m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); | ||
81 | 83 | ||
82 | // layouting | 84 | // layouting |
83 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); | 85 | QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); |
84 | vbox3->add(name); | 86 | vbox3->add(name); |
85 | vbox3->add(m_name); | 87 | vbox3->add(m_name); |
86 | vbox3->add(con ); | 88 | vbox3->add(con ); |
87 | vbox3->add(m_conCmb ); | 89 | vbox3->add(m_conCmb ); |
88 | vbox3->add(term ); | 90 | vbox3->add(term ); |
89 | vbox3->add(m_termCmb ); | 91 | vbox3->add(m_termCmb ); |
92 | vbox3->add(m_autoConnect); | ||
90 | vbox3->addStretch(1); | 93 | vbox3->addStretch(1); |
91 | 94 | ||
92 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); | 95 | tabWidget->addTab(tabprof, "", QObject::tr("Profile")); |
93 | tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); | 96 | tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); |
94 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); | 97 | tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); |
95 | tabWidget->setCurrentTab( tabprof ); | 98 | tabWidget->setCurrentTab( tabprof ); |
@@ -109,12 +112,13 @@ void ProfileEditorDialog::initUI() | |||
109 | // load profile values | 112 | // load profile values |
110 | m_name->setText(m_prof.name()); | 113 | m_name->setText(m_prof.name()); |
111 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); | 114 | slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); |
112 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); | 115 | slotTermActivated( m_fact->external(m_prof.terminalName() ) ); |
113 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); | 116 | setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); |
114 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); | 117 | setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); |
118 | m_autoConnect->setChecked(m_prof.autoConnect()); | ||
115 | 119 | ||
116 | 120 | ||
117 | // signal and slots | 121 | // signal and slots |
118 | connect(m_conCmb, SIGNAL(activated(const QString& ) ), | 122 | connect(m_conCmb, SIGNAL(activated(const QString& ) ), |
119 | this, SLOT(slotConActivated(const QString&) ) ); | 123 | this, SLOT(slotConActivated(const QString&) ) ); |
120 | connect(m_termCmb, SIGNAL(activated(const QString& ) ), | 124 | connect(m_termCmb, SIGNAL(activated(const QString& ) ), |
@@ -138,12 +142,13 @@ void ProfileEditorDialog::accept() | |||
138 | //if(plugin_plugin) plugin_plugin->save(); | 142 | //if(plugin_plugin) plugin_plugin->save(); |
139 | 143 | ||
140 | // Save general values | 144 | // Save general values |
141 | m_prof.setName(profName()); | 145 | m_prof.setName(profName()); |
142 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); | 146 | m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); |
143 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); | 147 | m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); |
148 | m_prof.setAutoConnect( m_autoConnect->isChecked() ); | ||
144 | 149 | ||
145 | if (m_con ) | 150 | if (m_con ) |
146 | m_con->save( m_prof ); | 151 | m_con->save( m_prof ); |
147 | if (m_term ) | 152 | if (m_term ) |
148 | m_term->save( m_prof ); | 153 | m_term->save( m_prof ); |
149 | 154 | ||
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index 6fde839..e01e636 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h | |||
@@ -9,12 +9,13 @@ | |||
9 | class MetaFactory; | 9 | class MetaFactory; |
10 | class EditBase; | 10 | class EditBase; |
11 | class QTabWidget; | 11 | class QTabWidget; |
12 | class QHBoxLayout; | 12 | class QHBoxLayout; |
13 | class QLineEdit; | 13 | class QLineEdit; |
14 | class QComboBox; | 14 | class QComboBox; |
15 | class QCheckBox; | ||
15 | class QLabel; | 16 | class QLabel; |
16 | class ProfileDialogWidget; | 17 | class ProfileDialogWidget; |
17 | 18 | ||
18 | class ProfileEditorDialog : public QDialog { | 19 | class ProfileEditorDialog : public QDialog { |
19 | Q_OBJECT | 20 | Q_OBJECT |
20 | public: | 21 | public: |
@@ -40,12 +41,13 @@ private: | |||
40 | MetaFactory* m_fact; | 41 | MetaFactory* m_fact; |
41 | QHBoxLayout* m_lay; | 42 | QHBoxLayout* m_lay; |
42 | Profile m_prof; | 43 | Profile m_prof; |
43 | 44 | ||
44 | QLineEdit *m_name; | 45 | QLineEdit *m_name; |
45 | QComboBox *m_conCmb, *m_termCmb; | 46 | QComboBox *m_conCmb, *m_termCmb; |
47 | QCheckBox *m_autoConnect; | ||
46 | 48 | ||
47 | QWidget *m_tabCon, *m_tabTerm; | 49 | QWidget *m_tabCon, *m_tabTerm; |
48 | ProfileDialogWidget* m_con, *m_term; | 50 | ProfileDialogWidget* m_con, *m_term; |
49 | QHBoxLayout *m_layCon, *m_layTerm; | 51 | QHBoxLayout *m_layCon, *m_layTerm; |
50 | OTabWidget *tabWidget; | 52 | OTabWidget *tabWidget; |
51 | }; | 53 | }; |
diff --git a/noncore/apps/opie-console/profilemanager.cpp b/noncore/apps/opie-console/profilemanager.cpp index 7c15560..5d39d96 100644 --- a/noncore/apps/opie-console/profilemanager.cpp +++ b/noncore/apps/opie-console/profilemanager.cpp | |||
@@ -35,12 +35,13 @@ void ProfileManager::load() { | |||
35 | for ( it = groups.begin(); it != groups.end(); ++it ) { | 35 | for ( it = groups.begin(); it != groups.end(); ++it ) { |
36 | conf.setGroup( (*it) ); | 36 | conf.setGroup( (*it) ); |
37 | Profile prof; | 37 | Profile prof; |
38 | prof.setName( conf.readEntry("name") ); | 38 | prof.setName( conf.readEntry("name") ); |
39 | prof.setIOLayer( conf.readEntry("iolayer").utf8() ); | 39 | prof.setIOLayer( conf.readEntry("iolayer").utf8() ); |
40 | prof.setTerminalName( conf.readEntry("term").utf8() ); | 40 | prof.setTerminalName( conf.readEntry("term").utf8() ); |
41 | prof.setAutoConnect( conf.readBoolEntry("autoConnect") ); | ||
41 | prof.setBackground( conf.readNumEntry("back") ); | 42 | prof.setBackground( conf.readNumEntry("back") ); |
42 | prof.setForeground( conf.readNumEntry("fore") ); | 43 | prof.setForeground( conf.readNumEntry("fore") ); |
43 | prof.setTerminal( conf.readNumEntry("terminal") ); | 44 | prof.setTerminal( conf.readNumEntry("terminal") ); |
44 | 45 | ||
45 | // THIS is evil because all data get's reset | 46 | // THIS is evil because all data get's reset |
46 | prof.setConf( conf.items( (*it) ) ); | 47 | prof.setConf( conf.items( (*it) ) ); |
@@ -111,12 +112,13 @@ void ProfileManager::save( ) { | |||
111 | 112 | ||
112 | conf.writeEntry( "name", (*it2).name() ); | 113 | conf.writeEntry( "name", (*it2).name() ); |
113 | QString str = QString::fromUtf8( (*it2).ioLayerName() ); | 114 | QString str = QString::fromUtf8( (*it2).ioLayerName() ); |
114 | 115 | ||
115 | conf.writeEntry( "iolayer", str ); | 116 | conf.writeEntry( "iolayer", str ); |
116 | conf.writeEntry( "term", QString::fromUtf8( (*it2).terminalName() ) ); | 117 | conf.writeEntry( "term", QString::fromUtf8( (*it2).terminalName() ) ); |
118 | conf.writeEntry( "autoConnect", (*it2).autoConnect()); | ||
117 | conf.writeEntry( "back", (*it2).background() ); | 119 | conf.writeEntry( "back", (*it2).background() ); |
118 | conf.writeEntry( "fore", (*it2).foreground() ); | 120 | conf.writeEntry( "fore", (*it2).foreground() ); |
119 | conf.writeEntry( "terminal", (*it2).terminal() ); | 121 | conf.writeEntry( "terminal", (*it2).terminal() ); |
120 | } | 122 | } |
121 | } | 123 | } |
122 | void ProfileManager::setProfiles( const Profile::ValueList& list ) { | 124 | void ProfileManager::setProfiles( const Profile::ValueList& list ) { |