summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 1d2385f..197f799 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -117,232 +117,232 @@ void MainWindow::initUI() {
117 connect( m_quickLaunch, SIGNAL( activated() ), 117 connect( m_quickLaunch, SIGNAL( activated() ),
118 this, SLOT( slotQuickLaunch() ) ); 118 this, SLOT( slotQuickLaunch() ) );
119 119
120 QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); 120 QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) );
121 121
122 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, 122 m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null,
123 0, this, 0 ); 123 0, this, 0 );
124 m_transfer->addTo( m_console ); 124 m_transfer->addTo( m_console );
125 connect(m_transfer, SIGNAL(activated() ), 125 connect(m_transfer, SIGNAL(activated() ),
126 this, SLOT(slotTransfer() ) ); 126 this, SLOT(slotTransfer() ) );
127 127
128 128
129 129
130 /* 130 /*
131 * immediate change of line wrap policy 131 * immediate change of line wrap policy
132 */ 132 */
133 m_isWrapped = false; 133 m_isWrapped = false;
134 m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); 134 m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 );
135 m_wrap->addTo( m_console ); 135 m_wrap->addTo( m_console );
136 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); 136 connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) );
137 137
138 /* 138 /*
139 * fullscreen 139 * fullscreen
140 */ 140 */
141 m_isFullscreen = false; 141 m_isFullscreen = false;
142 142
143 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 143 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
144 , QString::null, 0, this, 0); 144 , QString::null, 0, this, 0);
145 m_fullscreen->addTo( m_console ); 145 m_fullscreen->addTo( m_console );
146 connect( m_fullscreen, SIGNAL( activated() ), 146 connect( m_fullscreen, SIGNAL( activated() ),
147 this, SLOT( slotFullscreen() ) ); 147 this, SLOT( slotFullscreen() ) );
148 148
149 m_console->insertSeparator(); 149 m_console->insertSeparator();
150 150
151 QAction *a = new QAction(); 151 QAction *a = new QAction();
152 a->setText( tr("Save history") ); 152 a->setText( tr("Save history") );
153 a->addTo( m_console ); 153 a->addTo( m_console );
154 connect(a, SIGNAL(activated() ), 154 connect(a, SIGNAL(activated() ),
155 this, SLOT(slotSaveHistory() ) ); 155 this, SLOT(slotSaveHistory() ) );
156 /* 156 /*
157 * terminate action 157 * terminate action
158 */ 158 */
159 m_terminate = new QAction(); 159 m_terminate = new QAction();
160 m_terminate->setText( tr("Terminate") ); 160 m_terminate->setText( tr("Terminate") );
161 m_terminate->addTo( m_console ); 161 m_terminate->addTo( m_console );
162 connect(m_terminate, SIGNAL(activated() ), 162 connect(m_terminate, SIGNAL(activated() ),
163 this, SLOT(slotTerminate() ) ); 163 this, SLOT(slotTerminate() ) );
164 164
165 m_closewindow = new QAction(); 165 m_closewindow = new QAction();
166 m_closewindow->setText( tr("Close Window") ); 166 m_closewindow->setText( tr("Close Window") );
167 m_closewindow->addTo( m_console ); 167 m_closewindow->addTo( m_console );
168 connect( m_closewindow, SIGNAL(activated() ), 168 connect( m_closewindow, SIGNAL(activated() ),
169 this, SLOT(slotClose() ) ); 169 this, SLOT(slotClose() ) );
170 170
171 171
172 /* 172 /*
173 * script actions 173 * script actions
174 */ 174 */
175 m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); 175 m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0);
176 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); 176 connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int)));
177 177
178 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 178 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
179 m_recordScript->addTo(m_scripts); 179 m_recordScript->addTo(m_scripts);
180 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 180 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
181 181
182 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 182 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
183 m_saveScript->addTo(m_scripts); 183 m_saveScript->addTo(m_scripts);
184 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 184 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
185 185
186 186
187 /* 187 /*
188 * action that open/closes the keyboard 188 * action that open/closes the keyboard
189 */ 189 */
190 m_openKeys = new QAction (tr("Open Keyboard..."), 190 m_openKeys = new QAction (tr("Open Keyboard..."),
191 Resource::loadPixmap( "console/keys/keyboard_icon" ), 191 Resource::loadPixmap( "console/keys/keyboard_icon" ),
192 QString::null, 0, this, 0); 192 QString::null, 0, this, 0);
193 m_openKeys->setToggleAction(true); 193 m_openKeys->setToggleAction(true);
194 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); 194 connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool)));
195 195
196 /* insert the submenu */ 196 /* insert the submenu */
197 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 197 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
198 -1, 0); 198 -1, 0);
199 199
200 /* insert the connection menu */ 200 /* insert the connection menu */
201 m_bar->insertItem( tr("Connection"), m_console ); 201 m_bar->insertItem( tr("Connection"), m_console );
202 202
203 /* the scripts menu */ 203 /* the scripts menu */
204 m_bar->insertItem( tr("Scripts"), m_scripts ); 204 m_bar->insertItem( tr("Scripts"), m_scripts );
205 205
206 /* and the keyboard */ 206 /* and the keyboard */
207 m_keyBar = new QToolBar(this); 207 m_keyBar = new QToolBar(this);
208 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 208 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
209 m_keyBar->setHorizontalStretchable( TRUE ); 209 m_keyBar->setHorizontalStretchable( TRUE );
210 m_keyBar->hide(); 210 m_keyBar->hide();
211 211
212 m_kb = new FunctionKeyboard(m_keyBar); 212 m_kb = new FunctionKeyboard(m_keyBar);
213 connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), 213 connect(m_kb, SIGNAL(keyPressed(FKey,ushort,ushort,bool)),
214 this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); 214 this, SLOT(slotKeyReceived(FKey,ushort,ushort,bool)));
215 215
216 216
217 a = new QAction(tr("Copy"), 217 a = new QAction(tr("Copy"),
218 Resource::loadPixmap("copy"), QString::null, 218 Resource::loadPixmap("copy"), QString::null,
219 0, this, 0 ); 219 0, this, 0 );
220 //a->addTo( m_icons ); 220 //a->addTo( m_icons );
221 connect( a, SIGNAL(activated() ), 221 connect( a, SIGNAL(activated() ),
222 this, SLOT(slotCopy() ) ); 222 this, SLOT(slotCopy() ) );
223 223
224 QAction *paste = new QAction(tr("Paste"), 224 QAction *paste = new QAction(tr("Paste"),
225 Resource::loadPixmap("paste"), QString::null, 225 Resource::loadPixmap("paste"), QString::null,
226 0, this, 0 ); 226 0, this, 0 );
227 connect( paste, SIGNAL(activated() ), 227 connect( paste, SIGNAL(activated() ),
228 this, SLOT(slotPaste() ) ); 228 this, SLOT(slotPaste() ) );
229 229
230 230
231 newCon->addTo( m_icons ); 231 newCon->addTo( m_icons );
232 //m_setProfiles->addTo( m_icons ); 232 //m_setProfiles->addTo( m_icons );
233 paste->addTo( m_icons ); 233 paste->addTo( m_icons );
234 m_openKeys->addTo(m_icons); 234 m_openKeys->addTo(m_icons);
235 m_fullscreen->addTo( m_icons ); 235 m_fullscreen->addTo( m_icons );
236 236
237 m_connect->setEnabled( false ); 237 m_connect->setEnabled( false );
238 m_disconnect->setEnabled( false ); 238 m_disconnect->setEnabled( false );
239 m_terminate->setEnabled( false ); 239 m_terminate->setEnabled( false );
240 m_transfer->setEnabled( false ); 240 m_transfer->setEnabled( false );
241 m_scripts->setItemEnabled(m_runScript_id, false); 241 m_scripts->setItemEnabled(m_runScript_id, false);
242 m_recordScript->setEnabled( false ); 242 m_recordScript->setEnabled( false );
243 m_saveScript->setEnabled( false ); 243 m_saveScript->setEnabled( false );
244 m_fullscreen->setEnabled( false ); 244 m_fullscreen->setEnabled( false );
245 m_closewindow->setEnabled( false ); 245 m_closewindow->setEnabled( false );
246 m_wrap->setEnabled( false ); 246 m_wrap->setEnabled( false );
247 247
248 /* 248 /*
249 * connect to the menu activation 249 * connect to the menu activation
250 */ 250 */
251 connect( m_sessionsPop, SIGNAL(activated( int ) ), 251 connect( m_sessionsPop, SIGNAL(activated(int) ),
252 this, SLOT(slotProfile( int ) ) ); 252 this, SLOT(slotProfile(int) ) );
253 253
254 m_consoleWindow = new TabWidget( this, "blah"); 254 m_consoleWindow = new TabWidget( this, "blah");
255 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 255 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
256 this, SLOT(slotSessionChanged(Session*) ) ); 256 this, SLOT(slotSessionChanged(Session*) ) );
257 setCentralWidget( m_consoleWindow ); 257 setCentralWidget( m_consoleWindow );
258 258
259 slotQuickLaunch(); 259 slotQuickLaunch();
260} 260}
261 261
262ProfileManager* MainWindow::manager() { 262ProfileManager* MainWindow::manager() {
263 return m_manager; 263 return m_manager;
264} 264}
265TabWidget* MainWindow::tabWidget() { 265TabWidget* MainWindow::tabWidget() {
266 return m_consoleWindow; 266 return m_consoleWindow;
267} 267}
268void MainWindow::populateProfiles() { 268void MainWindow::populateProfiles() {
269 m_sessionsPop->clear(); 269 m_sessionsPop->clear();
270 Profile::ValueList list = manager()->all(); 270 Profile::ValueList list = manager()->all();
271 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 271 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
272 m_sessionsPop->insertItem( (*it).name() ); 272 m_sessionsPop->insertItem( (*it).name() );
273 } 273 }
274 274
275} 275}
276 276
277void MainWindow::populateScripts() { 277void MainWindow::populateScripts() {
278 m_scriptsPop->clear(); 278 m_scriptsPop->clear();
279 m_scriptsData.clear(); 279 m_scriptsData.clear();
280 DocLnkSet files(QPEApplication::documentDir(), "text/plain"); 280 DocLnkSet files(QPEApplication::documentDir(), "text/plain");
281 QListIterator<DocLnk> dit(files.children()); 281 QListIterator<DocLnk> dit(files.children());
282 for (; dit.current(); ++dit) { 282 for (; dit.current(); ++dit) {
283 if (*dit && (*dit)->name().length()>0) { 283 if (*dit && (*dit)->name().length()>0) {
284 QFileInfo info((*dit)->file()); 284 QFileInfo info((*dit)->file());
285 if (info.extension(false) == "script") { 285 if (info.extension(false) == "script") {
286 m_scriptsData.append(new DocLnk(**dit)); 286 m_scriptsData.append(new DocLnk(**dit));
287 m_scriptsPop->insertItem((*dit)->name()); 287 m_scriptsPop->insertItem((*dit)->name());
288 } 288 }
289 } 289 }
290 } 290 }
291 291
292} 292}
293 293
294MainWindow::~MainWindow() { 294MainWindow::~MainWindow() {
295 delete m_factory; 295 delete m_factory;
296 manager()->save(); 296 manager()->save();
297} 297}
298 298
299MetaFactory* MainWindow::factory() { 299MetaFactory* MainWindow::factory() {
300 return m_factory; 300 return m_factory;
301} 301}
302 302
303Session* MainWindow::currentSession() { 303Session* MainWindow::currentSession() {
304 return m_curSession; 304 return m_curSession;
305} 305}
306 306
307QList<Session> MainWindow::sessions() { 307QList<Session> MainWindow::sessions() {
308 return m_sessions; 308 return m_sessions;
309} 309}
310 310
311void MainWindow::slotNew() { 311void MainWindow::slotNew() {
312 ProfileEditorDialog dlg(factory() ); 312 ProfileEditorDialog dlg(factory() );
313 dlg.setCaption( tr("New Connection") ); 313 dlg.setCaption( tr("New Connection") );
314 int ret = QPEApplication::execDialog( &dlg ); 314 int ret = QPEApplication::execDialog( &dlg );
315 315
316 if ( ret == QDialog::Accepted ) { 316 if ( ret == QDialog::Accepted ) {
317 create( dlg.profile() ); 317 create( dlg.profile() );
318 } 318 }
319} 319}
320 320
321void MainWindow::slotRecordScript() { 321void MainWindow::slotRecordScript() {
322 if (currentSession()) { 322 if (currentSession()) {
323 currentSession()->emulationHandler()->startRecording(); 323 currentSession()->emulationHandler()->startRecording();
324 m_saveScript->setEnabled(true); 324 m_saveScript->setEnabled(true);
325 m_recordScript->setEnabled(false); 325 m_recordScript->setEnabled(false);
326 } 326 }
327} 327}
328 328
329void MainWindow::slotSaveScript() { 329void MainWindow::slotSaveScript() {
330 if (currentSession() && currentSession()->emulationHandler()->isRecording()) { 330 if (currentSession() && currentSession()->emulationHandler()->isRecording()) {
331 QMap<QString, QStringList> map; 331 QMap<QString, QStringList> map;
332 QStringList text; 332 QStringList text;
333 text << "text/plain"; 333 text << "text/plain";
334 map.insert(tr("Script"), text ); 334 map.insert(tr("Script"), text );
335 QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); 335 QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map);
336 if (!filename.isEmpty()) { 336 if (!filename.isEmpty()) {
337 QFileInfo info(filename); 337 QFileInfo info(filename);
338 if (info.extension(FALSE) != "script") 338 if (info.extension(FALSE) != "script")
339 filename += ".script"; 339 filename += ".script";
340 DocLnk nf; 340 DocLnk nf;
341 nf.setType("text/plain"); 341 nf.setType("text/plain");
342 nf.setFile(filename); 342 nf.setFile(filename);
343 nf.setName(info.fileName()); 343 nf.setName(info.fileName());
344 FileManager fm; 344 FileManager fm;
345 fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); 345 fm.saveFile(nf, currentSession()->emulationHandler()->script()->script());
346 currentSession()->emulationHandler()->clearScript(); 346 currentSession()->emulationHandler()->clearScript();
347 m_saveScript->setEnabled(false); 347 m_saveScript->setEnabled(false);
348 m_recordScript->setEnabled(true); 348 m_recordScript->setEnabled(true);