summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
blob: b6b2a2e74c2216a6f4b9782d91893905ec5b1fb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

#include <qaction.h>
#include <qmenubar.h>
#include <qlabel.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>

#include "metafactory.h"
#include "mainwindow.h"

MainWindow::MainWindow()
{
    qWarning("c'tor");
    m_factory = new MetaFactory();
    m_sessions.setAutoDelete( TRUE );
    m_curSession = 0l;

    initUI();

}
void MainWindow::initUI() {
    setToolBarsMovable( FALSE  );

    m_tool = new QToolBar( this );
    m_tool->setHorizontalStretchable( TRUE );

    m_bar = new QMenuBar( m_tool );
    m_console = new QPopupMenu( this );

    /*
     * new Action for new sessions
     */
    QAction* a = new QAction();
    a->setText( tr("New Connection") );
    a->addTo( m_console );
    connect(a, SIGNAL(activated() ),
            this, SLOT(slotNew() ) );

    a = new QAction();
    a->setText( tr("New from Session") );

    m_connect = new QAction();
    m_connect->setText( tr("Connect") );
    m_connect->addTo( m_console );
    connect(m_connect, SIGNAL(activated() ),
            this, SLOT(slotConnect() ) );

    m_bar->insertItem( tr("Connection"), m_console );

}
MainWindow::~MainWindow() {
    delete m_factory;
}
MetaFactory* MainWindow::factory() {
    return m_factory;
}
Session* MainWindow::currentSession() {
    return m_curSession;
}
QList<Session> MainWindow::sessions() {
    return m_sessions;
}