summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp67
1 files changed, 64 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index e9b5eda..1ae4a20 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -2,61 +2,122 @@
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 7
8#include "metafactory.h" 8#include "metafactory.h"
9#include "mainwindow.h" 9#include "mainwindow.h"
10 10
11MainWindow::MainWindow() { 11MainWindow::MainWindow() {
12 m_factory = new MetaFactory(); 12 m_factory = new MetaFactory();
13 m_sessions.setAutoDelete( TRUE ); 13 m_sessions.setAutoDelete( TRUE );
14 m_curSession = -1; 14 m_curSession = 0;
15 15
16 initUI(); 16 initUI();
17} 17}
18void MainWindow::initUI() { 18void MainWindow::initUI() {
19 setToolBarsMovable( FALSE ); 19 setToolBarsMovable( FALSE );
20 20
21 m_tool = new QToolBar( this ); 21 m_tool = new QToolBar( this );
22 m_tool->setHorizontalStretchable( TRUE ); 22 m_tool->setHorizontalStretchable( TRUE );
23 23
24 m_bar = new QMenuBar( m_tool ); 24 m_bar = new QMenuBar( m_tool );
25 m_console = new QPopupMenu( this ); 25 m_console = new QPopupMenu( this );
26 m_sessionsPop= new QPopupMenu( this );
27 m_settings = new QPopupMenu( this );
26 28
27 /* 29 /*
28 * new Action for new sessions 30 * new Action for new sessions
29 */ 31 */
30 QAction* a = new QAction(); 32 QAction* a = new QAction();
31 a->setText( tr("New Connection") ); 33 a->setText( tr("New Connection") );
32 a->addTo( m_console ); 34 a->addTo( m_console );
33 connect(a, SIGNAL(activated() ), 35 connect(a, SIGNAL(activated() ),
34 this, SLOT(slotNew() ) ); 36 this, SLOT(slotNew() ) );
35 37
36 a = new QAction();
37 a->setText( tr("New from Session") );
38 38
39
40 /*
41 * connect action
42 */
39 m_connect = new QAction(); 43 m_connect = new QAction();
40 m_connect->setText( tr("Connect") ); 44 m_connect->setText( tr("Connect") );
41 m_connect->addTo( m_console ); 45 m_connect->addTo( m_console );
42 connect(m_connect, SIGNAL(activated() ), 46 connect(m_connect, SIGNAL(activated() ),
43 this, SLOT(slotConnect() ) ); 47 this, SLOT(slotConnect() ) );
44 48
49
50 /*
51 * disconnect action
52 */
53 m_disconnect = new QAction();
54 m_disconnect->setText( tr("Disconnect") );
55 m_disconnect->addTo( m_console );
56 connect(m_disconnect, SIGNAL(activated() ),
57 this, SLOT(slotDisconnect() ) );
58
59 /*
60 * terminate action
61 */
62 m_terminate = new QAction();
63 m_terminate->setText( tr("Terminate") );
64 m_terminate->addTo( m_console );
65 connect(m_disconnect, SIGNAL(activated() ),
66 this, SLOT(slotTerminate() ) );
67
68 /*
69 * the settings action
70 */
71 m_setProfiles = new QAction();
72 m_setProfiles->setText( tr("Configure Profiles") );
73 m_setProfiles->addTo( m_settings );
74 connect( m_setProfiles, SIGNAL(activated() ),
75 this, SLOT(slotConfigure() ) );
76
77 /* insert the submenu */
78 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
79 -1, 0);
80
81 /* insert the connection menu */
45 m_bar->insertItem( tr("Connection"), m_console ); 82 m_bar->insertItem( tr("Connection"), m_console );
46 83
84 /* the settings menu */
85 m_bar->insertItem( tr("Settings"), m_settings );
86
47} 87}
48MainWindow::~MainWindow() { 88MainWindow::~MainWindow() {
49 delete m_factory; 89 delete m_factory;
50} 90}
51 91
52MetaFactory* MainWindow::factory() { 92MetaFactory* MainWindow::factory() {
53 return m_factory; 93 return m_factory;
54} 94}
55 95
56Session* MainWindow::currentSession() { 96Session* MainWindow::currentSession() {
57 return m_curSession; 97 return m_curSession;
58} 98}
59 99
60QList<Session> MainWindow::sessions() { 100QList<Session> MainWindow::sessions() {
61 return m_sessions; 101 return m_sessions;
62} 102}
103void MainWindow::slotNew() {
104 qWarning("New Connection");
105}
106void MainWindow::slotConnect() {
107 if ( currentSession() )
108 currentSession()->layer()->open();
109}
110void MainWindow::slotDisconnect() {
111 if ( currentSession() )
112 currentSession()->layer()->close();
113}
114void MainWindow::slotTerminate() {
115 if ( currentSession() )
116 currentSession()->layer()->close();
117 delete m_curSession;
118 m_curSession = 0l;
119 /* FIXME move to the next session */
120}
121void MainWindow::slotConfigure() {
122 qWarning("configure");
123}