author | hash <hash> | 2002-10-13 02:20:23 (UTC) |
---|---|---|
committer | hash <hash> | 2002-10-13 02:20:23 (UTC) |
commit | 2ce86d9be1bbf99092348adf815578b110fe7289 (patch) (side-by-side diff) | |
tree | 4c2812b4f4edb1704a379e2f6a4d9b2af1a39c23 | |
parent | 173c272fa2dc860dbb2ff54b6be2680c544340bb (diff) | |
download | opie-2ce86d9be1bbf99092348adf815578b110fe7289.zip opie-2ce86d9be1bbf99092348adf815578b110fe7289.tar.gz opie-2ce86d9be1bbf99092348adf815578b110fe7289.tar.bz2 |
added a couple more buttons to the bar
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 2a4d069..3af0cba 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -1,204 +1,207 @@ #include <qaction.h> #include <qmenubar.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qtoolbar.h> #include <qpe/resource.h> #include "profileeditordialog.h" #include "configdialog.h" #include "default.h" #include "metafactory.h" #include "profile.h" #include "profilemanager.h" #include "mainwindow.h" #include "tabwidget.h" #include "transferdialog.h" #include "function_keyboard.h" MainWindow::MainWindow() { m_factory = new MetaFactory(); Default def(m_factory); m_sessions.setAutoDelete( TRUE ); m_curSession = 0; m_manager = new ProfileManager( m_factory ); m_manager->load(); initUI(); populateProfiles(); } void MainWindow::initUI() { setToolBarsMovable( FALSE ); /* tool bar for the menu */ m_tool = new QToolBar( this ); m_tool->setHorizontalStretchable( TRUE ); m_bar = new QMenuBar( m_tool ); m_console = new QPopupMenu( this ); m_sessionsPop= new QPopupMenu( this ); m_settings = new QPopupMenu( this ); /* add a toolbar for icons */ m_icons = new QToolBar(this); - m_icons->setHorizontalStretchable( TRUE ); /* * new Action for new sessions */ - QAction* a = new QAction(); - a->setText( tr("New Connection") ); + QAction* a = new QAction(tr("New Connection"), + Resource::loadPixmap( "new" ), + QString::null, 0, this, 0); a->addTo( m_console ); + a->addTo( m_icons ); connect(a, SIGNAL(activated() ), this, SLOT(slotNew() ) ); /* * connect action */ m_connect = new QAction(); m_connect->setText( tr("Connect") ); m_connect->addTo( m_console ); connect(m_connect, SIGNAL(activated() ), this, SLOT(slotConnect() ) ); /* * disconnect action */ m_disconnect = new QAction(); m_disconnect->setText( tr("Disconnect") ); m_disconnect->addTo( m_console ); connect(m_disconnect, SIGNAL(activated() ), this, SLOT(slotDisconnect() ) ); m_transfer = new QAction(); m_transfer->setText( tr("Transfer file...") ); m_transfer->addTo( m_console ); connect(m_transfer, SIGNAL(activated() ), this, SLOT(slotTransfer() ) ); /* * terminate action */ m_terminate = new QAction(); m_terminate->setText( tr("Terminate") ); m_terminate->addTo( m_console ); connect(m_terminate, SIGNAL(activated() ), this, SLOT(slotTerminate() ) ); a = new QAction(); a->setText( tr("Close Window") ); a->addTo( m_console ); connect(a, SIGNAL(activated() ), this, SLOT(slotClose() ) ); /* * the settings action */ - m_setProfiles = new QAction(); - m_setProfiles->setText( tr("Configure Profiles") ); + m_setProfiles = new QAction(tr("Configure Profiles"), + Resource::loadPixmap( "SettingsIcon" ), + QString::null, 0, this, 0); m_setProfiles->addTo( m_settings ); + m_setProfiles->addTo( m_icons ); connect( m_setProfiles, SIGNAL(activated() ), this, SLOT(slotConfigure() ) ); /* * action that open/closes the keyboard */ - m_openKeys = new QAction ("Keyboard...", + m_openKeys = new QAction (tr("Open Keyboard..."), Resource::loadPixmap( "down" ), QString::null, 0, this, 0); m_openKeys->setToggleAction(true); connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); m_openKeys->addTo(m_icons); /* insert the submenu */ m_console->insertItem(tr("New from Profile"), m_sessionsPop, -1, 0); /* insert the connection menu */ m_bar->insertItem( tr("Connection"), m_console ); /* the settings menu */ m_bar->insertItem( tr("Settings"), m_settings ); /* and the keyboard */ m_keyBar = new QToolBar(this); addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); m_keyBar->setHorizontalStretchable( TRUE ); m_keyBar->hide(); m_kb = new FunctionKeyboard(m_keyBar); /* * connect to the menu activation */ connect( m_sessionsPop, SIGNAL(activated( int ) ), this, SLOT(slotProfile( int ) ) ); m_consoleWindow = new TabWidget( this, "blah"); setCentralWidget( m_consoleWindow ); } ProfileManager* MainWindow::manager() { return m_manager; } TabWidget* MainWindow::tabWidget() { return m_consoleWindow; } void MainWindow::populateProfiles() { m_sessionsPop->clear(); Profile::ValueList list = manager()->all(); for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { m_sessionsPop->insertItem( (*it).name() ); } } MainWindow::~MainWindow() { delete m_factory; manager()->save(); } MetaFactory* MainWindow::factory() { return m_factory; } Session* MainWindow::currentSession() { return m_curSession; } QList<Session> MainWindow::sessions() { return m_sessions; } void MainWindow::slotNew() { qWarning("New Connection"); ProfileEditorDialog dlg(factory() ); int ret = dlg.exec(); if ( ret == QDialog::Accepted ) { create( dlg.profile() ); } } void MainWindow::slotConnect() { if ( currentSession() ) currentSession()->layer()->open(); } void MainWindow::slotDisconnect() { if ( currentSession() ) currentSession()->layer()->close(); } void MainWindow::slotTerminate() { if ( currentSession() ) currentSession()->layer()->close(); slotClose(); /* FIXME move to the next session */ |