Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 67 |
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 | |||
@@ -8,45 +8,85 @@ | |||
8 | #include "metafactory.h" | 8 | #include "metafactory.h" |
9 | #include "mainwindow.h" | 9 | #include "mainwindow.h" |
10 | 10 | ||
11 | MainWindow::MainWindow() { | 11 | MainWindow::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 | } |
18 | void MainWindow::initUI() { | 18 | void 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 | } |
48 | MainWindow::~MainWindow() { | 88 | MainWindow::~MainWindow() { |
49 | delete m_factory; | 89 | delete m_factory; |
50 | } | 90 | } |
51 | 91 | ||
52 | MetaFactory* MainWindow::factory() { | 92 | MetaFactory* MainWindow::factory() { |
@@ -57,6 +97,27 @@ Session* MainWindow::currentSession() { | |||
57 | return m_curSession; | 97 | return m_curSession; |
58 | } | 98 | } |
59 | 99 | ||
60 | QList<Session> MainWindow::sessions() { | 100 | QList<Session> MainWindow::sessions() { |
61 | return m_sessions; | 101 | return m_sessions; |
62 | } | 102 | } |
103 | void MainWindow::slotNew() { | ||
104 | qWarning("New Connection"); | ||
105 | } | ||
106 | void MainWindow::slotConnect() { | ||
107 | if ( currentSession() ) | ||
108 | currentSession()->layer()->open(); | ||
109 | } | ||
110 | void MainWindow::slotDisconnect() { | ||
111 | if ( currentSession() ) | ||
112 | currentSession()->layer()->close(); | ||
113 | } | ||
114 | void 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 | } | ||
121 | void MainWindow::slotConfigure() { | ||
122 | qWarning("configure"); | ||
123 | } | ||