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