Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp new file mode 100644 index 0000000..b6b2a2e --- a/dev/null +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -0,0 +1,62 @@ | |||
1 | |||
2 | #include <qaction.h> | ||
3 | #include <qmenubar.h> | ||
4 | #include <qlabel.h> | ||
5 | #include <qpopupmenu.h> | ||
6 | #include <qtoolbar.h> | ||
7 | |||
8 | #include "metafactory.h" | ||
9 | #include "mainwindow.h" | ||
10 | |||
11 | MainWindow::MainWindow() | ||
12 | { | ||
13 | qWarning("c'tor"); | ||
14 | m_factory = new MetaFactory(); | ||
15 | m_sessions.setAutoDelete( TRUE ); | ||
16 | m_curSession = 0l; | ||
17 | |||
18 | initUI(); | ||
19 | |||
20 | } | ||
21 | void MainWindow::initUI() { | ||
22 | setToolBarsMovable( FALSE ); | ||
23 | |||
24 | m_tool = new QToolBar( this ); | ||
25 | m_tool->setHorizontalStretchable( TRUE ); | ||
26 | |||
27 | m_bar = new QMenuBar( m_tool ); | ||
28 | m_console = new QPopupMenu( this ); | ||
29 | |||
30 | /* | ||
31 | * new Action for new sessions | ||
32 | */ | ||
33 | QAction* a = new QAction(); | ||
34 | a->setText( tr("New Connection") ); | ||
35 | a->addTo( m_console ); | ||
36 | connect(a, SIGNAL(activated() ), | ||
37 | this, SLOT(slotNew() ) ); | ||
38 | |||
39 | a = new QAction(); | ||
40 | a->setText( tr("New from Session") ); | ||
41 | |||
42 | m_connect = new QAction(); | ||
43 | m_connect->setText( tr("Connect") ); | ||
44 | m_connect->addTo( m_console ); | ||
45 | connect(m_connect, SIGNAL(activated() ), | ||
46 | this, SLOT(slotConnect() ) ); | ||
47 | |||
48 | m_bar->insertItem( tr("Connection"), m_console ); | ||
49 | |||
50 | } | ||
51 | MainWindow::~MainWindow() { | ||
52 | delete m_factory; | ||
53 | } | ||
54 | MetaFactory* MainWindow::factory() { | ||
55 | return m_factory; | ||
56 | } | ||
57 | Session* MainWindow::currentSession() { | ||
58 | return m_curSession; | ||
59 | } | ||
60 | QList<Session> MainWindow::sessions() { | ||
61 | return m_sessions; | ||
62 | } | ||