summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 415259e..1adb43d 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,32 +1,33 @@
1 1
2#include <qaction.h> 2#include <qaction.h>
3#include <qmenubar.h> 3#include <qmenubar.h>
4#include <qlabel.h> 4#include <qlabel.h>
5#include <qpopupmenu.h> 5#include <qpopupmenu.h>
6#include <qtoolbar.h> 6#include <qtoolbar.h>
7#include <qpe/resource.h> 7#include <qpe/resource.h>
8#include <opie/ofiledialog.h> 8#include <opie/ofiledialog.h>
9#include <qmessagebox.h>
9 10
10#include "profileeditordialog.h" 11#include "profileeditordialog.h"
11#include "configdialog.h" 12#include "configdialog.h"
12#include "default.h" 13#include "default.h"
13#include "metafactory.h" 14#include "metafactory.h"
14#include "profile.h" 15#include "profile.h"
15#include "profilemanager.h" 16#include "profilemanager.h"
16#include "mainwindow.h" 17#include "mainwindow.h"
17#include "tabwidget.h" 18#include "tabwidget.h"
18#include "transferdialog.h" 19#include "transferdialog.h"
19#include "function_keyboard.h" 20#include "function_keyboard.h"
20#include "script.h" 21#include "script.h"
21 22
22MainWindow::MainWindow() { 23MainWindow::MainWindow() {
23 m_factory = new MetaFactory(); 24 m_factory = new MetaFactory();
24 Default def(m_factory); 25 Default def(m_factory);
25 m_sessions.setAutoDelete( TRUE ); 26 m_sessions.setAutoDelete( TRUE );
26 m_curSession = 0; 27 m_curSession = 0;
27 m_manager = new ProfileManager( m_factory ); 28 m_manager = new ProfileManager( m_factory );
28 m_manager->load(); 29 m_manager->load();
29 30
30 initUI(); 31 initUI();
31 populateProfiles(); 32 populateProfiles();
32} 33}
@@ -288,48 +289,57 @@ void MainWindow::slotConfigure() {
288void MainWindow::slotClose() { 289void MainWindow::slotClose() {
289 qWarning("close"); 290 qWarning("close");
290 if (!currentSession() ) 291 if (!currentSession() )
291 return; 292 return;
292 293
293 tabWidget()->remove( currentSession() ); 294 tabWidget()->remove( currentSession() );
294 /*it's autodelete */ 295 /*it's autodelete */
295 m_sessions.remove( m_curSession ); 296 m_sessions.remove( m_curSession );
296 m_curSession = m_sessions.first(); 297 m_curSession = m_sessions.first();
297 tabWidget()->setCurrent( m_curSession ); 298 tabWidget()->setCurrent( m_curSession );
298} 299}
299 300
300/* 301/*
301 * We will get the name 302 * We will get the name
302 * Then the profile 303 * Then the profile
303 * and then we will make a profile 304 * and then we will make a profile
304 */ 305 */
305void MainWindow::slotProfile( int id) { 306void MainWindow::slotProfile( int id) {
306 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 307 Profile prof = manager()->profile( m_sessionsPop->text( id) );
307 create( prof ); 308 create( prof );
308} 309}
309void MainWindow::create( const Profile& prof ) { 310void MainWindow::create( const Profile& prof ) {
310 Session *ses = manager()->fromProfile( prof, tabWidget() ); 311 Session *ses = manager()->fromProfile( prof, tabWidget() );
311 312
313 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
314 {
315 QMessageBox::warning(this,
316 QObject::tr("Session failed"),
317 QObject::tr("Cannot open session: Not all components were found."));
318 //if(ses) delete ses;
319 return;
320 }
321
312 m_sessions.append( ses ); 322 m_sessions.append( ses );
313 tabWidget()->add( ses ); 323 tabWidget()->add( ses );
314 m_curSession = ses; 324 m_curSession = ses;
315 325
316} 326}
317 327
318void MainWindow::slotTransfer() 328void MainWindow::slotTransfer()
319{ 329{
320 // if ( currentSession() ) { 330 // if ( currentSession() ) {
321 TransferDialog dlg(this); 331 TransferDialog dlg(this);
322 dlg.showMaximized(); 332 dlg.showMaximized();
323 dlg.exec(); 333 dlg.exec();
324 // } 334 // }
325} 335}
326 336
327 337
328void MainWindow::slotOpenKeb(bool state) { 338void MainWindow::slotOpenKeb(bool state) {
329 339
330 if (state) m_keyBar->show(); 340 if (state) m_keyBar->show();
331 else m_keyBar->hide(); 341 else m_keyBar->hide();
332 342
333} 343}
334void MainWindow::slotSessionChanged( Session* ses ) { 344void MainWindow::slotSessionChanged( Session* ses ) {
335 if ( ses ) { 345 if ( ses ) {