author | harlekin <harlekin> | 2002-10-17 17:44:01 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-17 17:44:01 (UTC) |
commit | eb70c5c231b80d1e925b0098ad3c951917900071 (patch) (unidiff) | |
tree | 6527f98fb76bbf5c2c484490b8113d078be4fde0 | |
parent | ec202e5d2956f2cde0f2a6be5c452bd67347e21f (diff) | |
download | opie-eb70c5c231b80d1e925b0098ad3c951917900071.zip opie-eb70c5c231b80d1e925b0098ad3c951917900071.tar.gz opie-eb70c5c231b80d1e925b0098ad3c951917900071.tar.bz2 |
configure profile in connection menu - keep menubar as empty as possible to have space for icons and avoid having them in a second row - as much space for terminal as possible
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 408d3dd..3066b35 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,372 +1,378 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | 3 | ||
4 | 4 | ||
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qmenubar.h> | 6 | #include <qmenubar.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qpopupmenu.h> | 8 | #include <qpopupmenu.h> |
9 | #include <qtoolbar.h> | 9 | #include <qtoolbar.h> |
10 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
11 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
12 | #include <qwhatsthis.h> | 12 | #include <qwhatsthis.h> |
13 | 13 | ||
14 | #include <qpe/resource.h> | 14 | #include <qpe/resource.h> |
15 | #include <opie/ofiledialog.h> | 15 | #include <opie/ofiledialog.h> |
16 | 16 | ||
17 | 17 | ||
18 | #include "keytrans.h" | 18 | #include "keytrans.h" |
19 | #include "profileeditordialog.h" | 19 | #include "profileeditordialog.h" |
20 | #include "configdialog.h" | 20 | #include "configdialog.h" |
21 | #include "default.h" | 21 | #include "default.h" |
22 | #include "metafactory.h" | 22 | #include "metafactory.h" |
23 | #include "profile.h" | 23 | #include "profile.h" |
24 | #include "profilemanager.h" | 24 | #include "profilemanager.h" |
25 | #include "mainwindow.h" | 25 | #include "mainwindow.h" |
26 | #include "tabwidget.h" | 26 | #include "tabwidget.h" |
27 | #include "transferdialog.h" | 27 | #include "transferdialog.h" |
28 | #include "function_keyboard.h" | 28 | #include "function_keyboard.h" |
29 | #include "emulation_handler.h" | 29 | #include "emulation_handler.h" |
30 | #include "script.h" | 30 | #include "script.h" |
31 | 31 | ||
32 | 32 | ||
33 | 33 | ||
34 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 34 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
35 | KeyTrans::loadAll(); | 35 | KeyTrans::loadAll(); |
36 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 36 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
37 | KeyTrans* s = KeyTrans::find(i ); | 37 | KeyTrans* s = KeyTrans::find(i ); |
38 | assert( s ); | 38 | assert( s ); |
39 | } | 39 | } |
40 | m_factory = new MetaFactory(); | 40 | m_factory = new MetaFactory(); |
41 | Default def(m_factory); | 41 | Default def(m_factory); |
42 | m_sessions.setAutoDelete( TRUE ); | 42 | m_sessions.setAutoDelete( TRUE ); |
43 | m_curSession = 0; | 43 | m_curSession = 0; |
44 | m_manager = new ProfileManager( m_factory ); | 44 | m_manager = new ProfileManager( m_factory ); |
45 | m_manager->load(); | 45 | m_manager->load(); |
46 | 46 | ||
47 | initUI(); | 47 | initUI(); |
48 | populateProfiles(); | 48 | populateProfiles(); |
49 | } | 49 | } |
50 | void MainWindow::initUI() { | 50 | void MainWindow::initUI() { |
51 | setToolBarsMovable( FALSE ); | 51 | setToolBarsMovable( FALSE ); |
52 | 52 | ||
53 | /* tool bar for the menu */ | 53 | /* tool bar for the menu */ |
54 | m_tool = new QToolBar( this ); | 54 | m_tool = new QToolBar( this ); |
55 | m_tool->setHorizontalStretchable( TRUE ); | 55 | m_tool->setHorizontalStretchable( TRUE ); |
56 | 56 | ||
57 | m_bar = new QMenuBar( m_tool ); | 57 | m_bar = new QMenuBar( m_tool ); |
58 | m_console = new QPopupMenu( this ); | 58 | m_console = new QPopupMenu( this ); |
59 | m_scripts = new QPopupMenu( this ); | 59 | m_scripts = new QPopupMenu( this ); |
60 | m_sessionsPop= new QPopupMenu( this ); | 60 | m_sessionsPop= new QPopupMenu( this ); |
61 | m_settings = new QPopupMenu( this ); | 61 | //m_settings = new QPopupMenu( this ); |
62 | 62 | ||
63 | /* add a toolbar for icons */ | 63 | /* add a toolbar for icons */ |
64 | m_icons = new QToolBar(this); | 64 | m_icons = new QToolBar(this); |
65 | 65 | ||
66 | |||
67 | |||
68 | |||
69 | /* | ||
70 | * the settings action | ||
71 | */ | ||
72 | m_setProfiles = new QAction(tr("Configure Profiles"), | ||
73 | Resource::loadPixmap( "SettingsIcon" ), | ||
74 | QString::null, 0, this, 0); | ||
75 | // m_setProfiles->addTo( m_settings ); | ||
76 | m_setProfiles->addTo( m_icons ); | ||
77 | m_setProfiles->addTo( m_console ); | ||
78 | connect( m_setProfiles, SIGNAL(activated() ), | ||
79 | this, SLOT(slotConfigure() ) ); | ||
80 | |||
81 | |||
66 | /* | 82 | /* |
67 | * new Action for new sessions | 83 | * new Action for new sessions |
68 | */ | 84 | */ |
69 | QAction* a = new QAction(tr("New Connection"), | 85 | QAction* a = new QAction(tr("New Connection"), |
70 | Resource::loadPixmap( "new" ), | 86 | Resource::loadPixmap( "new" ), |
71 | QString::null, 0, this, 0); | 87 | QString::null, 0, this, 0); |
72 | a->addTo( m_console ); | 88 | a->addTo( m_console ); |
73 | a->addTo( m_icons ); | 89 | a->addTo( m_icons ); |
74 | connect(a, SIGNAL(activated() ), | 90 | connect(a, SIGNAL(activated() ), |
75 | this, SLOT(slotNew() ) ); | 91 | this, SLOT(slotNew() ) ); |
76 | 92 | ||
77 | /* | 93 | /* |
78 | * connect action | 94 | * connect action |
79 | */ | 95 | */ |
80 | m_connect = new QAction(); | 96 | m_connect = new QAction(); |
81 | m_connect->setText( tr("Connect") ); | 97 | m_connect->setText( tr("Connect") ); |
82 | m_connect->addTo( m_console ); | 98 | m_connect->addTo( m_console ); |
83 | connect(m_connect, SIGNAL(activated() ), | 99 | connect(m_connect, SIGNAL(activated() ), |
84 | this, SLOT(slotConnect() ) ); | 100 | this, SLOT(slotConnect() ) ); |
85 | 101 | ||
86 | /* | 102 | /* |
87 | * disconnect action | 103 | * disconnect action |
88 | */ | 104 | */ |
89 | m_disconnect = new QAction(); | 105 | m_disconnect = new QAction(); |
90 | m_disconnect->setText( tr("Disconnect") ); | 106 | m_disconnect->setText( tr("Disconnect") ); |
91 | m_disconnect->addTo( m_console ); | 107 | m_disconnect->addTo( m_console ); |
92 | connect(m_disconnect, SIGNAL(activated() ), | 108 | connect(m_disconnect, SIGNAL(activated() ), |
93 | this, SLOT(slotDisconnect() ) ); | 109 | this, SLOT(slotDisconnect() ) ); |
94 | 110 | ||
95 | m_transfer = new QAction(); | 111 | m_transfer = new QAction(); |
96 | m_transfer->setText( tr("Transfer file...") ); | 112 | m_transfer->setText( tr("Transfer file...") ); |
97 | m_transfer->addTo( m_console ); | 113 | m_transfer->addTo( m_console ); |
98 | connect(m_transfer, SIGNAL(activated() ), | 114 | connect(m_transfer, SIGNAL(activated() ), |
99 | this, SLOT(slotTransfer() ) ); | 115 | this, SLOT(slotTransfer() ) ); |
100 | 116 | ||
101 | 117 | ||
102 | /* | 118 | /* |
103 | * fullscreen | 119 | * fullscreen |
104 | */ | 120 | */ |
105 | m_isFullscreen = false; | 121 | m_isFullscreen = false; |
106 | 122 | ||
107 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 123 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
108 | , QString::null, 0, this, 0); | 124 | , QString::null, 0, this, 0); |
109 | m_fullscreen->addTo( m_console ); | 125 | m_fullscreen->addTo( m_console ); |
110 | m_fullscreen->addTo( m_icons ); | 126 | m_fullscreen->addTo( m_icons ); |
111 | connect( m_fullscreen, SIGNAL( activated() ), | 127 | connect( m_fullscreen, SIGNAL( activated() ), |
112 | this, SLOT( slotFullscreen() ) ); | 128 | this, SLOT( slotFullscreen() ) ); |
113 | 129 | ||
114 | /* | 130 | /* |
115 | * terminate action | 131 | * terminate action |
116 | */ | 132 | */ |
117 | m_terminate = new QAction(); | 133 | m_terminate = new QAction(); |
118 | m_terminate->setText( tr("Terminate") ); | 134 | m_terminate->setText( tr("Terminate") ); |
119 | m_terminate->addTo( m_console ); | 135 | m_terminate->addTo( m_console ); |
120 | connect(m_terminate, SIGNAL(activated() ), | 136 | connect(m_terminate, SIGNAL(activated() ), |
121 | this, SLOT(slotTerminate() ) ); | 137 | this, SLOT(slotTerminate() ) ); |
122 | 138 | ||
123 | m_closewindow = new QAction(); | 139 | m_closewindow = new QAction(); |
124 | m_closewindow->setText( tr("Close Window") ); | 140 | m_closewindow->setText( tr("Close Window") ); |
125 | m_closewindow->addTo( m_console ); | 141 | m_closewindow->addTo( m_console ); |
126 | connect( m_closewindow, SIGNAL(activated() ), | 142 | connect( m_closewindow, SIGNAL(activated() ), |
127 | this, SLOT(slotClose() ) ); | 143 | this, SLOT(slotClose() ) ); |
128 | 144 | ||
129 | /* | ||
130 | * the settings action | ||
131 | */ | ||
132 | m_setProfiles = new QAction(tr("Configure Profiles"), | ||
133 | Resource::loadPixmap( "SettingsIcon" ), | ||
134 | QString::null, 0, this, 0); | ||
135 | m_setProfiles->addTo( m_settings ); | ||
136 | m_setProfiles->addTo( m_icons ); | ||
137 | connect( m_setProfiles, SIGNAL(activated() ), | ||
138 | this, SLOT(slotConfigure() ) ); | ||
139 | 145 | ||
140 | /* | 146 | /* |
141 | * script actions | 147 | * script actions |
142 | */ | 148 | */ |
143 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 149 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
144 | m_recordScript->addTo(m_scripts); | 150 | m_recordScript->addTo(m_scripts); |
145 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 151 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
146 | 152 | ||
147 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 153 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
148 | m_saveScript->addTo(m_scripts); | 154 | m_saveScript->addTo(m_scripts); |
149 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 155 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
150 | 156 | ||
151 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 157 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
152 | m_runScript->addTo(m_scripts); | 158 | m_runScript->addTo(m_scripts); |
153 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 159 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
154 | 160 | ||
155 | /* | 161 | /* |
156 | * action that open/closes the keyboard | 162 | * action that open/closes the keyboard |
157 | */ | 163 | */ |
158 | m_openKeys = new QAction (tr("Open Keyboard..."), | 164 | m_openKeys = new QAction (tr("Open Keyboard..."), |
159 | Resource::loadPixmap( "down" ), | 165 | Resource::loadPixmap( "down" ), |
160 | QString::null, 0, this, 0); | 166 | QString::null, 0, this, 0); |
161 | 167 | ||
162 | m_openKeys->setToggleAction(true); | 168 | m_openKeys->setToggleAction(true); |
163 | 169 | ||
164 | connect (m_openKeys, SIGNAL(toggled(bool)), | 170 | connect (m_openKeys, SIGNAL(toggled(bool)), |
165 | this, SLOT(slotOpenKeb(bool))); | 171 | this, SLOT(slotOpenKeb(bool))); |
166 | m_openKeys->addTo(m_icons); | 172 | m_openKeys->addTo(m_icons); |
167 | 173 | ||
168 | 174 | ||
169 | /* insert the submenu */ | 175 | /* insert the submenu */ |
170 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 176 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
171 | -1, 0); | 177 | -1, 0); |
172 | 178 | ||
173 | /* insert the connection menu */ | 179 | /* insert the connection menu */ |
174 | m_bar->insertItem( tr("Connection"), m_console ); | 180 | m_bar->insertItem( tr("Connection"), m_console ); |
175 | 181 | ||
176 | /* the scripts menu */ | 182 | /* the scripts menu */ |
177 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 183 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
178 | 184 | ||
179 | /* the settings menu */ | 185 | /* the settings menu */ |
180 | m_bar->insertItem( tr("Settings"), m_settings ); | 186 | // m_bar->insertItem( tr("Settings"), m_settings ); |
181 | 187 | ||
182 | /* and the keyboard */ | 188 | /* and the keyboard */ |
183 | m_keyBar = new QToolBar(this); | 189 | m_keyBar = new QToolBar(this); |
184 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 190 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
185 | m_keyBar->setHorizontalStretchable( TRUE ); | 191 | m_keyBar->setHorizontalStretchable( TRUE ); |
186 | m_keyBar->hide(); | 192 | m_keyBar->hide(); |
187 | 193 | ||
188 | m_kb = new FunctionKeyboard(m_keyBar); | 194 | m_kb = new FunctionKeyboard(m_keyBar); |
189 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), | 195 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), |
190 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); | 196 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); |
191 | 197 | ||
192 | 198 | ||
193 | 199 | ||
194 | m_connect->setEnabled( false ); | 200 | m_connect->setEnabled( false ); |
195 | m_disconnect->setEnabled( false ); | 201 | m_disconnect->setEnabled( false ); |
196 | m_terminate->setEnabled( false ); | 202 | m_terminate->setEnabled( false ); |
197 | m_transfer->setEnabled( false ); | 203 | m_transfer->setEnabled( false ); |
198 | m_recordScript->setEnabled( false ); | 204 | m_recordScript->setEnabled( false ); |
199 | m_saveScript->setEnabled( false ); | 205 | m_saveScript->setEnabled( false ); |
200 | m_runScript->setEnabled( false ); | 206 | m_runScript->setEnabled( false ); |
201 | m_fullscreen->setEnabled( false ); | 207 | m_fullscreen->setEnabled( false ); |
202 | m_closewindow->setEnabled( false ); | 208 | m_closewindow->setEnabled( false ); |
203 | 209 | ||
204 | /* | 210 | /* |
205 | * connect to the menu activation | 211 | * connect to the menu activation |
206 | */ | 212 | */ |
207 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 213 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
208 | this, SLOT(slotProfile( int ) ) ); | 214 | this, SLOT(slotProfile( int ) ) ); |
209 | 215 | ||
210 | m_consoleWindow = new TabWidget( this, "blah"); | 216 | m_consoleWindow = new TabWidget( this, "blah"); |
211 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 217 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
212 | this, SLOT(slotSessionChanged(Session*) ) ); | 218 | this, SLOT(slotSessionChanged(Session*) ) ); |
213 | setCentralWidget( m_consoleWindow ); | 219 | setCentralWidget( m_consoleWindow ); |
214 | 220 | ||
215 | } | 221 | } |
216 | 222 | ||
217 | ProfileManager* MainWindow::manager() { | 223 | ProfileManager* MainWindow::manager() { |
218 | return m_manager; | 224 | return m_manager; |
219 | } | 225 | } |
220 | TabWidget* MainWindow::tabWidget() { | 226 | TabWidget* MainWindow::tabWidget() { |
221 | return m_consoleWindow; | 227 | return m_consoleWindow; |
222 | } | 228 | } |
223 | void MainWindow::populateProfiles() { | 229 | void MainWindow::populateProfiles() { |
224 | m_sessionsPop->clear(); | 230 | m_sessionsPop->clear(); |
225 | Profile::ValueList list = manager()->all(); | 231 | Profile::ValueList list = manager()->all(); |
226 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 232 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
227 | m_sessionsPop->insertItem( (*it).name() ); | 233 | m_sessionsPop->insertItem( (*it).name() ); |
228 | } | 234 | } |
229 | 235 | ||
230 | } | 236 | } |
231 | MainWindow::~MainWindow() { | 237 | MainWindow::~MainWindow() { |
232 | delete m_factory; | 238 | delete m_factory; |
233 | manager()->save(); | 239 | manager()->save(); |
234 | } | 240 | } |
235 | 241 | ||
236 | MetaFactory* MainWindow::factory() { | 242 | MetaFactory* MainWindow::factory() { |
237 | return m_factory; | 243 | return m_factory; |
238 | } | 244 | } |
239 | 245 | ||
240 | Session* MainWindow::currentSession() { | 246 | Session* MainWindow::currentSession() { |
241 | return m_curSession; | 247 | return m_curSession; |
242 | } | 248 | } |
243 | 249 | ||
244 | QList<Session> MainWindow::sessions() { | 250 | QList<Session> MainWindow::sessions() { |
245 | return m_sessions; | 251 | return m_sessions; |
246 | } | 252 | } |
247 | 253 | ||
248 | void MainWindow::slotNew() { | 254 | void MainWindow::slotNew() { |
249 | ProfileEditorDialog dlg(factory() ); | 255 | ProfileEditorDialog dlg(factory() ); |
250 | dlg.showMaximized(); | 256 | dlg.showMaximized(); |
251 | int ret = dlg.exec(); | 257 | int ret = dlg.exec(); |
252 | 258 | ||
253 | if ( ret == QDialog::Accepted ) { | 259 | if ( ret == QDialog::Accepted ) { |
254 | create( dlg.profile() ); | 260 | create( dlg.profile() ); |
255 | } | 261 | } |
256 | } | 262 | } |
257 | 263 | ||
258 | void MainWindow::slotRecordScript() { | 264 | void MainWindow::slotRecordScript() { |
259 | /* if (currentSession()) { | 265 | /* if (currentSession()) { |
260 | currentSession()->emulationLayer()->startRecording(); | 266 | currentSession()->emulationLayer()->startRecording(); |
261 | } | 267 | } |
262 | */ | 268 | */ |
263 | } | 269 | } |
264 | 270 | ||
265 | void MainWindow::slotSaveScript() { | 271 | void MainWindow::slotSaveScript() { |
266 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { | 272 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { |
267 | MimeTypes types; | 273 | MimeTypes types; |
268 | QStringList script; | 274 | QStringList script; |
269 | script << "text/plain"; | 275 | script << "text/plain"; |
270 | types.insert("Script", script); | 276 | types.insert("Script", script); |
271 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 277 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
272 | if (!filename.isEmpty()) { | 278 | if (!filename.isEmpty()) { |
273 | currentSession()->emulationLayer()->script()->saveTo(filename); | 279 | currentSession()->emulationLayer()->script()->saveTo(filename); |
274 | currentSession()->emulationLayer()->clearScript(); | 280 | currentSession()->emulationLayer()->clearScript(); |
275 | } | 281 | } |
276 | } | 282 | } |
277 | */ | 283 | */ |
278 | } | 284 | } |
279 | 285 | ||
280 | void MainWindow::slotRunScript() { | 286 | void MainWindow::slotRunScript() { |
281 | /* | 287 | /* |
282 | if (currentSession()) { | 288 | if (currentSession()) { |
283 | MimeTypes types; | 289 | MimeTypes types; |
284 | QStringList script; | 290 | QStringList script; |
285 | script << "text/plain"; | 291 | script << "text/plain"; |
286 | types.insert("Script", script); | 292 | types.insert("Script", script); |
287 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 293 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
288 | if (!filename.isEmpty()) { | 294 | if (!filename.isEmpty()) { |
289 | Script script(DocLnk(filename).file()); | 295 | Script script(DocLnk(filename).file()); |
290 | currentSession()->emulationLayer()->runScript(&script); | 296 | currentSession()->emulationLayer()->runScript(&script); |
291 | } | 297 | } |
292 | } | 298 | } |
293 | */ | 299 | */ |
294 | } | 300 | } |
295 | 301 | ||
296 | void MainWindow::slotConnect() { | 302 | void MainWindow::slotConnect() { |
297 | if ( currentSession() ) { | 303 | if ( currentSession() ) { |
298 | bool ret = currentSession()->layer()->open(); | 304 | bool ret = currentSession()->layer()->open(); |
299 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 305 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
300 | QObject::tr("Failed"), | 306 | QObject::tr("Failed"), |
301 | QObject::tr("Connecting failed for this session.")); | 307 | QObject::tr("Connecting failed for this session.")); |
302 | else { | 308 | else { |
303 | m_connect->setEnabled( false ); | 309 | m_connect->setEnabled( false ); |
304 | m_disconnect->setEnabled( true ); | 310 | m_disconnect->setEnabled( true ); |
305 | } | 311 | } |
306 | } | 312 | } |
307 | } | 313 | } |
308 | 314 | ||
309 | void MainWindow::slotDisconnect() { | 315 | void MainWindow::slotDisconnect() { |
310 | if ( currentSession() ) { | 316 | if ( currentSession() ) { |
311 | currentSession()->layer()->close(); | 317 | currentSession()->layer()->close(); |
312 | m_connect->setEnabled( true ); | 318 | m_connect->setEnabled( true ); |
313 | m_disconnect->setEnabled( false ); | 319 | m_disconnect->setEnabled( false ); |
314 | } | 320 | } |
315 | } | 321 | } |
316 | 322 | ||
317 | void MainWindow::slotTerminate() { | 323 | void MainWindow::slotTerminate() { |
318 | if ( currentSession() ) | 324 | if ( currentSession() ) |
319 | currentSession()->layer()->close(); | 325 | currentSession()->layer()->close(); |
320 | 326 | ||
321 | slotClose(); | 327 | slotClose(); |
322 | /* FIXME move to the next session */ | 328 | /* FIXME move to the next session */ |
323 | } | 329 | } |
324 | 330 | ||
325 | void MainWindow::slotConfigure() { | 331 | void MainWindow::slotConfigure() { |
326 | ConfigDialog conf( manager()->all(), factory() ); | 332 | ConfigDialog conf( manager()->all(), factory() ); |
327 | conf.showMaximized(); | 333 | conf.showMaximized(); |
328 | 334 | ||
329 | int ret = conf.exec(); | 335 | int ret = conf.exec(); |
330 | 336 | ||
331 | if ( QDialog::Accepted == ret ) { | 337 | if ( QDialog::Accepted == ret ) { |
332 | manager()->setProfiles( conf.list() ); | 338 | manager()->setProfiles( conf.list() ); |
333 | manager()->save(); | 339 | manager()->save(); |
334 | populateProfiles(); | 340 | populateProfiles(); |
335 | } | 341 | } |
336 | } | 342 | } |
337 | /* | 343 | /* |
338 | * we will remove | 344 | * we will remove |
339 | * this window from the tabwidget | 345 | * this window from the tabwidget |
340 | * remove it from the list | 346 | * remove it from the list |
341 | * delete it | 347 | * delete it |
342 | * and set the currentSession() | 348 | * and set the currentSession() |
343 | */ | 349 | */ |
344 | void MainWindow::slotClose() { | 350 | void MainWindow::slotClose() { |
345 | if (!currentSession() ) | 351 | if (!currentSession() ) |
346 | return; | 352 | return; |
347 | 353 | ||
348 | Session* ses = currentSession(); | 354 | Session* ses = currentSession(); |
349 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 355 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
350 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 356 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
351 | m_curSession = NULL; | 357 | m_curSession = NULL; |
352 | tabWidget()->remove( /*currentSession()*/ses ); | 358 | tabWidget()->remove( /*currentSession()*/ses ); |
353 | /*it's autodelete */ | 359 | /*it's autodelete */ |
354 | m_sessions.remove( ses ); | 360 | m_sessions.remove( ses ); |
355 | qWarning("after remove!!"); | 361 | qWarning("after remove!!"); |
356 | 362 | ||
357 | if (!currentSession() ) { | 363 | if (!currentSession() ) { |
358 | m_connect->setEnabled( false ); | 364 | m_connect->setEnabled( false ); |
359 | m_disconnect->setEnabled( false ); | 365 | m_disconnect->setEnabled( false ); |
360 | m_terminate->setEnabled( false ); | 366 | m_terminate->setEnabled( false ); |
361 | m_transfer->setEnabled( false ); | 367 | m_transfer->setEnabled( false ); |
362 | m_recordScript->setEnabled( false ); | 368 | m_recordScript->setEnabled( false ); |
363 | m_saveScript->setEnabled( false ); | 369 | m_saveScript->setEnabled( false ); |
364 | m_runScript->setEnabled( false ); | 370 | m_runScript->setEnabled( false ); |
365 | m_fullscreen->setEnabled( false ); | 371 | m_fullscreen->setEnabled( false ); |
366 | m_closewindow->setEnabled( false ); | 372 | m_closewindow->setEnabled( false ); |
367 | } | 373 | } |
368 | } | 374 | } |
369 | 375 | ||
370 | /* | 376 | /* |
371 | * We will get the name | 377 | * We will get the name |
372 | * Then the profile | 378 | * Then the profile |