Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 49 |
1 files changed, 48 insertions, 1 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 | |||
@@ -80,24 +80,34 @@ void MainWindow::initUI() { | |||
80 | m_console->insertSeparator(); | 80 | m_console->insertSeparator(); |
81 | /* | 81 | /* |
82 | * new Action for new sessions | 82 | * new Action for new sessions |
83 | */ | 83 | */ |
84 | QAction* a = new QAction(tr("New Connection"), | 84 | QAction* a = new QAction(tr("New Connection"), |
85 | Resource::loadPixmap( "new" ), | 85 | Resource::loadPixmap( "new" ), |
86 | QString::null, 0, this, 0); | 86 | QString::null, 0, this, 0); |
87 | a->addTo( m_console ); | 87 | a->addTo( m_console ); |
88 | a->addTo( m_icons ); | 88 | a->addTo( m_icons ); |
89 | connect(a, SIGNAL(activated() ), | 89 | connect(a, SIGNAL(activated() ), |
90 | this, SLOT(slotNew() ) ); | 90 | this, SLOT(slotNew() ) ); |
91 | 91 | ||
92 | m_console->insertSeparator(); | ||
93 | /* save icon is not available */ | ||
94 | a = new QAction(tr("Save Connection"), | ||
95 | Resource::loadPixmap("save"), QString::null, | ||
96 | 0, this, 0 ); | ||
97 | a->addTo( m_console ); | ||
98 | connect(a, SIGNAL(activated() ), | ||
99 | this, SLOT(slotSaveSession() ) ); | ||
100 | m_console->insertSeparator(); | ||
101 | |||
92 | /* | 102 | /* |
93 | * connect action | 103 | * connect action |
94 | */ | 104 | */ |
95 | m_connect = new QAction(); | 105 | m_connect = new QAction(); |
96 | m_connect->setText( tr("Connect") ); | 106 | m_connect->setText( tr("Connect") ); |
97 | m_connect->addTo( m_console ); | 107 | m_connect->addTo( m_console ); |
98 | connect(m_connect, SIGNAL(activated() ), | 108 | connect(m_connect, SIGNAL(activated() ), |
99 | this, SLOT(slotConnect() ) ); | 109 | this, SLOT(slotConnect() ) ); |
100 | 110 | ||
101 | /* | 111 | /* |
102 | * disconnect action | 112 | * disconnect action |
103 | */ | 113 | */ |
@@ -167,25 +177,25 @@ void MainWindow::initUI() { | |||
167 | Resource::loadPixmap( "down" ), | 177 | Resource::loadPixmap( "down" ), |
168 | QString::null, 0, this, 0); | 178 | QString::null, 0, this, 0); |
169 | 179 | ||
170 | m_openKeys->setToggleAction(true); | 180 | m_openKeys->setToggleAction(true); |
171 | 181 | ||
172 | connect (m_openKeys, SIGNAL(toggled(bool)), | 182 | connect (m_openKeys, SIGNAL(toggled(bool)), |
173 | this, SLOT(slotOpenKeb(bool))); | 183 | this, SLOT(slotOpenKeb(bool))); |
174 | m_openKeys->addTo(m_icons); | 184 | m_openKeys->addTo(m_icons); |
175 | 185 | ||
176 | 186 | ||
177 | /* | 187 | /* |
178 | * action that open/closes the keyboard | 188 | * action that open/closes the keyboard |
179 | 189 | ||
180 | m_openButtons = new QAction ( tr( "Open Buttons..." ), | 190 | m_openButtons = new QAction ( tr( "Open Buttons..." ), |
181 | Resource::loadPixmap( "" ), | 191 | Resource::loadPixmap( "" ), |
182 | QString::null, 0, this, 0 ); | 192 | QString::null, 0, this, 0 ); |
183 | 193 | ||
184 | m_openButtons->setToggleAction( true ); | 194 | m_openButtons->setToggleAction( true ); |
185 | 195 | ||
186 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), | 196 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), |
187 | this, SLOT( slotOpenButtons( bool ) ) ); | 197 | this, SLOT( slotOpenButtons( bool ) ) ); |
188 | m_openButtons->addTo( m_icons ); | 198 | m_openButtons->addTo( m_icons ); |
189 | 199 | ||
190 | */ | 200 | */ |
191 | 201 | ||
@@ -213,24 +223,38 @@ void MainWindow::initUI() { | |||
213 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 223 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
214 | 224 | ||
215 | m_buttonBar = new QToolBar( this ); | 225 | m_buttonBar = new QToolBar( this ); |
216 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | 226 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); |
217 | m_buttonBar->setHorizontalStretchable( TRUE ); | 227 | m_buttonBar->setHorizontalStretchable( TRUE ); |
218 | m_buttonBar->hide(); | 228 | m_buttonBar->hide(); |
219 | 229 | ||
220 | /* | 230 | /* |
221 | m_qb = new QuickButton( m_buttonBar ); | 231 | m_qb = new QuickButton( m_buttonBar ); |
222 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), | 232 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), |
223 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); | 233 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); |
224 | */ | 234 | */ |
235 | /* now add the copy and paste actions */ | ||
236 | a = new QAction(tr("Copy"), | ||
237 | Resource::loadPixmap("copy"), QString::null, | ||
238 | 0, this, 0 ); | ||
239 | //a->addTo( m_icons ); | ||
240 | connect( a, SIGNAL(activated() ), | ||
241 | this, SLOT(slotCopy() ) ); | ||
242 | |||
243 | a = new QAction(tr("Paste"), | ||
244 | Resource::loadPixmap("paste"), QString::null, | ||
245 | 0, this, 0 ); | ||
246 | a->addTo( m_icons ); | ||
247 | connect( a, SIGNAL(activated() ), | ||
248 | this, SLOT(slotPaste() ) ); | ||
225 | 249 | ||
226 | 250 | ||
227 | m_connect->setEnabled( false ); | 251 | m_connect->setEnabled( false ); |
228 | m_disconnect->setEnabled( false ); | 252 | m_disconnect->setEnabled( false ); |
229 | m_terminate->setEnabled( false ); | 253 | m_terminate->setEnabled( false ); |
230 | m_transfer->setEnabled( false ); | 254 | m_transfer->setEnabled( false ); |
231 | m_recordScript->setEnabled( false ); | 255 | m_recordScript->setEnabled( false ); |
232 | m_saveScript->setEnabled( false ); | 256 | m_saveScript->setEnabled( false ); |
233 | m_runScript->setEnabled( false ); | 257 | m_runScript->setEnabled( false ); |
234 | m_fullscreen->setEnabled( false ); | 258 | m_fullscreen->setEnabled( false ); |
235 | m_closewindow->setEnabled( false ); | 259 | m_closewindow->setEnabled( false ); |
236 | 260 | ||
@@ -530,12 +554,35 @@ void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { | |||
530 | QEvent::Type state; | 554 | QEvent::Type state; |
531 | 555 | ||
532 | if (pressed) state = QEvent::KeyPress; | 556 | if (pressed) state = QEvent::KeyPress; |
533 | else state = QEvent::KeyRelease; | 557 | else state = QEvent::KeyRelease; |
534 | 558 | ||
535 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); | 559 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); |
536 | 560 | ||
537 | // where should i send this event? doesnt work sending it here | 561 | // where should i send this event? doesnt work sending it here |
538 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); | 562 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
539 | ke.ignore(); | 563 | ke.ignore(); |
540 | } | 564 | } |
541 | } | 565 | } |
566 | void MainWindow::slotCopy() { | ||
567 | if (!currentSession() ) return; | ||
568 | currentSession()->emulationHandler()->copy(); | ||
569 | } | ||
570 | void MainWindow::slotPaste() { | ||
571 | if (!currentSession() ) return; | ||
572 | currentSession()->emulationHandler()->paste(); | ||
573 | } | ||
574 | |||
575 | /* | ||
576 | * Save the session | ||
577 | */ | ||
578 | |||
579 | void MainWindow::slotSaveSession() { | ||
580 | if (!currentSession() ) { | ||
581 | QMessageBox::information(this, tr("Save Connection"), | ||
582 | tr("<qt>There is no Connection.</qt>"), 1 ); | ||
583 | return; | ||
584 | } | ||
585 | manager()->add( currentSession()->profile() ); | ||
586 | manager()->save(); | ||
587 | populateProfiles(); | ||
588 | } | ||