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.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
@@ -11,7 +11,7 @@
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}
@@ -23,6 +23,8 @@ void MainWindow::initUI() {
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
@@ -33,17 +35,55 @@ void MainWindow::initUI() {
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;
@@ -60,3 +100,24 @@ Session* MainWindow::currentSession() {
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}