summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index e2f4d12..02a3fa9 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -68,48 +68,58 @@ void MainWindow::initUI() {
/*
* the settings action
*/
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 );
m_setProfiles->addTo( m_console );
connect( m_setProfiles, SIGNAL(activated() ),
this, SLOT(slotConfigure() ) );
m_console->insertSeparator();
/*
* new Action for new sessions
*/
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() ) );
+ m_console->insertSeparator();
+ /* save icon is not available */
+ a = new QAction(tr("Save Connection"),
+ Resource::loadPixmap("save"), QString::null,
+ 0, this, 0 );
+ a->addTo( m_console );
+ connect(a, SIGNAL(activated() ),
+ this, SLOT(slotSaveSession() ) );
+ m_console->insertSeparator();
+
/*
* 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_console->insertSeparator();
m_transfer = new QAction();
m_transfer->setText( tr("Transfer file...") );
m_transfer->addTo( m_console );
connect(m_transfer, SIGNAL(activated() ),
@@ -201,48 +211,62 @@ void MainWindow::initUI() {
/* 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(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)),
this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool)));
m_buttonBar = new QToolBar( this );
addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE );
m_buttonBar->setHorizontalStretchable( TRUE );
m_buttonBar->hide();
/*
m_qb = new QuickButton( m_buttonBar );
connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ),
this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) );
*/
+ /* now add the copy and paste actions */
+ a = new QAction(tr("Copy"),
+ Resource::loadPixmap("copy"), QString::null,
+ 0, this, 0 );
+ //a->addTo( m_icons );
+ connect( a, SIGNAL(activated() ),
+ this, SLOT(slotCopy() ) );
+
+ a = new QAction(tr("Paste"),
+ Resource::loadPixmap("paste"), QString::null,
+ 0, this, 0 );
+ a->addTo( m_icons );
+ connect( a, SIGNAL(activated() ),
+ this, SLOT(slotPaste() ) );
m_connect->setEnabled( false );
m_disconnect->setEnabled( false );
m_terminate->setEnabled( false );
m_transfer->setEnabled( false );
m_recordScript->setEnabled( false );
m_saveScript->setEnabled( false );
m_runScript->setEnabled( false );
m_fullscreen->setEnabled( false );
m_closewindow->setEnabled( false );
/*
* connect to the menu activation
*/
connect( m_sessionsPop, SIGNAL(activated( int ) ),
this, SLOT(slotProfile( int ) ) );
m_consoleWindow = new TabWidget( this, "blah");
connect(m_consoleWindow, SIGNAL(activated(Session*) ),
this, SLOT(slotSessionChanged(Session*) ) );
setCentralWidget( m_consoleWindow );
}
@@ -518,24 +542,47 @@ void MainWindow::slotFullscreen() {
connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
}
m_isFullscreen = !m_isFullscreen;
}
void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
if ( m_curSession ) {
QEvent::Type state;
if (pressed) state = QEvent::KeyPress;
else state = QEvent::KeyRelease;
QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode)));
// where should i send this event? doesnt work sending it here
QApplication::sendEvent((QObject *)m_curSession->widget(), &ke);
ke.ignore();
}
}
+void MainWindow::slotCopy() {
+ if (!currentSession() ) return;
+ currentSession()->emulationHandler()->copy();
+}
+void MainWindow::slotPaste() {
+ if (!currentSession() ) return;
+ currentSession()->emulationHandler()->paste();
+}
+
+/*
+ * Save the session
+ */
+
+void MainWindow::slotSaveSession() {
+ if (!currentSession() ) {
+ QMessageBox::information(this, tr("Save Connection"),
+ tr("<qt>There is no Connection.</qt>"), 1 );
+ return;
+ }
+ manager()->add( currentSession()->profile() );
+ manager()->save();
+ populateProfiles();
+}