-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 3f6e0b4..b0d28fc 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -189,233 +189,233 @@ void Konsole::initCommandList() | |||
189 | commonCombo->clear(); | 189 | commonCombo->clear(); |
190 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { | 190 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { |
191 | for (int i = 0; commonCmds[i] != NULL; i++) { | 191 | for (int i = 0; commonCmds[i] != NULL; i++) { |
192 | commonCombo->insertItem(commonCmds[i],i); | 192 | commonCombo->insertItem(commonCmds[i],i); |
193 | } | 193 | } |
194 | } else { | 194 | } else { |
195 | for (int i = 0; i < 100; i++) { | 195 | for (int i = 0; i < 100; i++) { |
196 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 196 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
197 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); | 197 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | } | 201 | } |
202 | 202 | ||
203 | void Konsole::init(const char* _pgm, QStrList & _args) | 203 | void Konsole::init(const char* _pgm, QStrList & _args) |
204 | { | 204 | { |
205 | b_scroll = TRUE; // histon; | 205 | b_scroll = TRUE; // histon; |
206 | n_keytab = 0; | 206 | n_keytab = 0; |
207 | n_render = 0; | 207 | n_render = 0; |
208 | startUp=0; | 208 | startUp=0; |
209 | setCaption( tr("Terminal") ); | 209 | setCaption( tr("Terminal") ); |
210 | setIcon( Resource::loadPixmap( "konsole" ) ); | 210 | setIcon( Resource::loadPixmap( "konsole" ) ); |
211 | 211 | ||
212 | Config cfg("Konsole"); | 212 | Config cfg("Konsole"); |
213 | cfg.setGroup("Konsole"); | 213 | cfg.setGroup("Konsole"); |
214 | QString tmp; | 214 | QString tmp; |
215 | // initialize the list of allowed fonts /////////////////////////////////// | 215 | // initialize the list of allowed fonts /////////////////////////////////// |
216 | cfont = cfg.readNumEntry("FontID", 1); | 216 | cfont = cfg.readNumEntry("FontID", 1); |
217 | QFont f = QFont("Micro", 4, QFont::Normal); | 217 | QFont f = QFont("Micro", 4, QFont::Normal); |
218 | f.setFixedPitch(TRUE); | 218 | f.setFixedPitch(TRUE); |
219 | fonts.append(new VTFont(tr("Micro"), f)); | 219 | fonts.append(new VTFont(tr("Micro"), f)); |
220 | 220 | ||
221 | f = QFont("Fixed", 7, QFont::Normal); | 221 | f = QFont("Fixed", 7, QFont::Normal); |
222 | f.setFixedPitch(TRUE); | 222 | f.setFixedPitch(TRUE); |
223 | fonts.append(new VTFont(tr("Small Fixed"), f)); | 223 | fonts.append(new VTFont(tr("Small Fixed"), f)); |
224 | 224 | ||
225 | f = QFont("Fixed", 12, QFont::Normal); | 225 | f = QFont("Fixed", 12, QFont::Normal); |
226 | f.setFixedPitch(TRUE); | 226 | f.setFixedPitch(TRUE); |
227 | fonts.append(new VTFont(tr("Medium Fixed"), f)); | 227 | fonts.append(new VTFont(tr("Medium Fixed"), f)); |
228 | 228 | ||
229 | // create terminal emulation framework //////////////////////////////////// | 229 | // create terminal emulation framework //////////////////////////////////// |
230 | nsessions = 0; | 230 | nsessions = 0; |
231 | 231 | ||
232 | tab = new EKNumTabWidget(this); | 232 | tab = new EKNumTabWidget(this); |
233 | 233 | ||
234 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 234 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
235 | 235 | ||
236 | // create terminal toolbar //////////////////////////////////////////////// | 236 | // create terminal toolbar //////////////////////////////////////////////// |
237 | setToolBarsMovable( FALSE ); | 237 | setToolBarsMovable( FALSE ); |
238 | QPEToolBar *menuToolBar = new QPEToolBar( this ); | 238 | QPEToolBar *menuToolBar = new QPEToolBar( this ); |
239 | menuToolBar->setHorizontalStretchable( TRUE ); | 239 | menuToolBar->setHorizontalStretchable( TRUE ); |
240 | 240 | ||
241 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); | 241 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); |
242 | 242 | ||
243 | fontList = new QPopupMenu( this ); | 243 | fontList = new QPopupMenu( this ); |
244 | for(uint i = 0; i < fonts.count(); i++) { | 244 | for(uint i = 0; i < fonts.count(); i++) { |
245 | VTFont *fnt = fonts.at(i); | 245 | VTFont *fnt = fonts.at(i); |
246 | fontList->insertItem(fnt->getName(), i); | 246 | fontList->insertItem(fnt->getName(), i); |
247 | } | 247 | } |
248 | fontChanged(cfont); | 248 | fontChanged(cfont); |
249 | 249 | ||
250 | configMenu = new QPopupMenu( this); | 250 | configMenu = new QPopupMenu( this); |
251 | colorMenu = new QPopupMenu( this); | 251 | colorMenu = new QPopupMenu( this); |
252 | scrollMenu = new QPopupMenu( this); | 252 | scrollMenu = new QPopupMenu( this); |
253 | editCommandListMenu = new QPopupMenu( this); | 253 | editCommandListMenu = new QPopupMenu( this); |
254 | 254 | ||
255 | configMenu->insertItem("Command List",editCommandListMenu); | 255 | configMenu->insertItem("Command List",editCommandListMenu); |
256 | 256 | ||
257 | bool listHidden; | 257 | bool listHidden; |
258 | cfg.setGroup("Menubar"); | 258 | cfg.setGroup("Menubar"); |
259 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { | 259 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { |
260 | editCommandListMenu->insertItem( tr( "Show command list" )); | 260 | editCommandListMenu->insertItem( tr( "Show command list" )); |
261 | listHidden=TRUE; | 261 | listHidden=TRUE; |
262 | } else { | 262 | } else { |
263 | editCommandListMenu->insertItem( tr( "Hide command list" )); | 263 | editCommandListMenu->insertItem( tr( "Hide command list" )); |
264 | listHidden=FALSE; | 264 | listHidden=FALSE; |
265 | } | 265 | } |
266 | 266 | ||
267 | cfg.setGroup("Tabs"); | 267 | cfg.setGroup("Tabs"); |
268 | tmp=cfg.readEntry("Position","Bottom"); | 268 | tmp=cfg.readEntry("Position","Bottom"); |
269 | if(tmp=="Top") { | 269 | if(tmp=="Top") { |
270 | tab->setTabPosition(QTabWidget::Top); | 270 | tab->setTabPosition(QTabWidget::Top); |
271 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); | 271 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); |
272 | } else { | 272 | } else { |
273 | tab->setTabPosition(QTabWidget::Bottom); | 273 | tab->setTabPosition(QTabWidget::Bottom); |
274 | configMenu->insertItem("Tabs on Top"); | 274 | configMenu->insertItem("Tabs on Top"); |
275 | } | 275 | } |
276 | configMenu->insertSeparator(2); | 276 | configMenu->insertSeparator(2); |
277 | 277 | ||
278 | colorMenu->insertItem(tr( "Green on Black")); | 278 | colorMenu->insertItem(tr( "Green on Black")); |
279 | colorMenu->insertItem(tr( "Black on White")); | 279 | colorMenu->insertItem(tr( "Black on White")); |
280 | colorMenu->insertItem(tr( "White on Black")); | 280 | colorMenu->insertItem(tr( "White on Black")); |
281 | colorMenu->insertItem(tr( "Black on Transparent")); | 281 | colorMenu->insertItem(tr( "Black on Transparent")); |
282 | colorMenu->insertItem(tr( "Black on Red")); | 282 | colorMenu->insertItem(tr( "Black on Red")); |
283 | colorMenu->insertItem(tr( "Red on Black")); | 283 | colorMenu->insertItem(tr( "Red on Black")); |
284 | colorMenu->insertItem(tr( "Green on Yellow")); | 284 | colorMenu->insertItem(tr( "Green on Yellow")); |
285 | colorMenu->insertItem(tr( "Blue on Magenta")); | 285 | colorMenu->insertItem(tr( "Blue on Magenta")); |
286 | colorMenu->insertItem(tr( "Magenta on Blue")); | 286 | colorMenu->insertItem(tr( "Magenta on Blue")); |
287 | colorMenu->insertItem(tr( "Cyan on White")); | 287 | colorMenu->insertItem(tr( "Cyan on White")); |
288 | colorMenu->insertItem(tr( "White on Cyan")); | 288 | colorMenu->insertItem(tr( "White on Cyan")); |
289 | colorMenu->insertItem(tr( "Blue on Black")); | 289 | colorMenu->insertItem(tr( "Blue on Black")); |
290 | colorMenu->insertItem(tr( "Amber on Black")); | 290 | colorMenu->insertItem(tr( "Amber on Black")); |
291 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 291 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
292 | 292 | ||
293 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 293 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
294 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 294 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
295 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); | 295 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); |
296 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 296 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
297 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 297 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
298 | menuBar->insertItem( tr("Font"), fontList ); | 298 | menuBar->insertItem( tr("Font"), fontList ); |
299 | menuBar->insertItem( tr("Options"), configMenu ); | 299 | menuBar->insertItem( tr("Options"), configMenu ); |
300 | 300 | ||
301 | QPEToolBar *toolbar = new QPEToolBar( this ); | 301 | QPEToolBar *toolbar = new QPEToolBar( this ); |
302 | 302 | ||
303 | QAction *a; | 303 | QAction *a; |
304 | 304 | ||
305 | // Button Commands | 305 | // Button Commands |
306 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); | 306 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); |
307 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); | 307 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); |
308 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 308 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
309 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); | 309 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); |
310 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 310 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
311 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); | 311 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); |
312 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 312 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
313 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); | 313 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); |
314 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 314 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
315 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 315 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
316 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 316 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
317 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 317 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
318 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 318 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
319 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); | 319 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); |
320 | /* | 320 | /* |
321 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); | 321 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); |
322 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 322 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
323 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); | 323 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); |
324 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 324 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
325 | */ | 325 | */ |
326 | 326 | ||
327 | secondToolBar = new QPEToolBar( this ); | 327 | secondToolBar = new QPEToolBar( this ); |
328 | secondToolBar->setHorizontalStretchable( TRUE ); | 328 | secondToolBar->setHorizontalStretchable( TRUE ); |
329 | 329 | ||
330 | commonCombo = new QComboBox( secondToolBar ); | 330 | commonCombo = new QComboBox( secondToolBar ); |
331 | commonCombo->setMaximumWidth(236); | 331 | commonCombo->setMaximumWidth(236); |
332 | 332 | ||
333 | editCommandListMenu->insertItem( tr( "Quick Edit" ) ); | 333 | editCommandListMenu->insertItem( tr( "Quick Edit" ) ); |
334 | if( listHidden) { | 334 | if( listHidden) { |
335 | secondToolBar->hide(); | 335 | secondToolBar->hide(); |
336 | editCommandListMenu->setItemEnabled(-22 ,FALSE); | 336 | editCommandListMenu->setItemEnabled(-22 ,FALSE); |
337 | } | 337 | } |
338 | editCommandListMenu->insertItem(tr( "Edit" ) ); | 338 | editCommandListMenu->insertItem(tr( "Edit" ) ); |
339 | 339 | ||
340 | cfg.setGroup("Commands"); | 340 | cfg.setGroup("Commands"); |
341 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 341 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
342 | 342 | ||
343 | initCommandList(); | 343 | initCommandList(); |
344 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 344 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
345 | // commonCombo->insertItem( commonCmds[i], i ); | 345 | // commonCombo->insertItem( commonCmds[i], i ); |
346 | // tmp = cfg.readEntry( QString::number(i),""); | 346 | // tmp = cfg.readEntry( QString::number(i),""); |
347 | // if(tmp != "") | 347 | // if(tmp != "") |
348 | // commonCombo->changeItem( tmp,i ); | 348 | // commonCombo->changeItem( tmp,i ); |
349 | // } | 349 | // } |
350 | 350 | ||
351 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 351 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
352 | 352 | ||
353 | scrollMenu->insertItem(tr( "None" )); | 353 | scrollMenu->insertItem(tr( "None" )); |
354 | scrollMenu->insertItem(tr( "Left" )); | 354 | scrollMenu->insertItem(tr( "Left" )); |
355 | scrollMenu->insertItem(tr( "Right" )); | 355 | scrollMenu->insertItem(tr( "Right" )); |
356 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 356 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
357 | 357 | ||
358 | // create applications ///////////////////////////////////////////////////// | 358 | // create applications ///////////////////////////////////////////////////// |
359 | setCentralWidget(tab); | 359 | setCentralWidget(tab); |
360 | 360 | ||
361 | // load keymaps //////////////////////////////////////////////////////////// | 361 | // load keymaps //////////////////////////////////////////////////////////// |
362 | KeyTrans::loadAll(); | 362 | KeyTrans::loadAll(); |
363 | for (int i = 0; i < KeyTrans::count(); i++) | 363 | for (int i = 0; i < KeyTrans::count(); i++) |
364 | { KeyTrans* s = KeyTrans::find(i); | 364 | { KeyTrans* s = KeyTrans::find(i); |
365 | assert( s ); | 365 | assert( s ); |
366 | } | 366 | } |
367 | 367 | ||
368 | se_pgm = _pgm; | 368 | se_pgm = _pgm; |
369 | se_args = _args; | 369 | se_args = _args; |
370 | 370 | ||
371 | parseCommandLine(); | 371 | parseCommandLine(); |
372 | // read and apply default values /////////////////////////////////////////// | 372 | // read and apply default values /////////////////////////////////////////// |
373 | resize(321, 321); // Dummy. | 373 | resize(321, 321); // Dummy. |
374 | QSize currentSize = size(); | 374 | QSize currentSize = size(); |
375 | if (currentSize != size()) | 375 | if (currentSize != size()) |
376 | defaultSize = size(); | 376 | defaultSize = size(); |
377 | } | 377 | } |
378 | 378 | ||
379 | void Konsole::show() | 379 | void Konsole::show() |
380 | { | 380 | { |
381 | if ( !nsessions ) { | 381 | if ( !nsessions ) { |
382 | newSession(); | 382 | newSession(); |
383 | } | 383 | } |
384 | QMainWindow::show(); | 384 | QMainWindow::show(); |
385 | } | 385 | } |
386 | 386 | ||
387 | void Konsole::initSession(const char*, QStrList &) | 387 | void Konsole::initSession(const char*, QStrList &) |
388 | { | 388 | { |
389 | QMainWindow::show(); | 389 | QMainWindow::show(); |
390 | } | 390 | } |
391 | 391 | ||
392 | Konsole::~Konsole() | 392 | Konsole::~Konsole() |
393 | { | 393 | { |
394 | while (nsessions > 0) { | 394 | while (nsessions > 0) { |
395 | doneSession(getTe()->currentSession, 0); | 395 | doneSession(getTe()->currentSession, 0); |
396 | } | 396 | } |
397 | 397 | ||
398 | Config cfg("Konsole"); | 398 | Config cfg("Konsole"); |
399 | cfg.setGroup("Konsole"); | 399 | cfg.setGroup("Konsole"); |
400 | cfg.writeEntry("FontID", cfont); | 400 | cfg.writeEntry("FontID", cfont); |
401 | } | 401 | } |
402 | 402 | ||
403 | void Konsole::fontChanged(int f) | 403 | void Konsole::fontChanged(int f) |
404 | { | 404 | { |
405 | VTFont* font = fonts.at(f); | 405 | VTFont* font = fonts.at(f); |
406 | if (font != 0) { | 406 | if (font != 0) { |
407 | for(uint i = 0; i < fonts.count(); i++) { | 407 | for(uint i = 0; i < fonts.count(); i++) { |
408 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); | 408 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); |
409 | } | 409 | } |
410 | 410 | ||
411 | cfont = f; | 411 | cfont = f; |
412 | 412 | ||
413 | TEWidget* te = getTe(); | 413 | TEWidget* te = getTe(); |
414 | if (te != 0) { | 414 | if (te != 0) { |
415 | te->setVTFont(font->getFont()); | 415 | te->setVTFont(font->getFont()); |
416 | } | 416 | } |
417 | } | 417 | } |
418 | } | 418 | } |
419 | 419 | ||
420 | 420 | ||
421 | void Konsole::enterCommand(int c) | 421 | void Konsole::enterCommand(int c) |
@@ -716,144 +716,144 @@ void Konsole::colorMenuSelected(int iD) | |||
716 | for (i = 0; i < TABLE_COLORS; i++) { | 716 | for (i = 0; i < TABLE_COLORS; i++) { |
717 | if(i==0 || i == 10) { | 717 | if(i==0 || i == 10) { |
718 | m_table[i].color = foreground; | 718 | m_table[i].color = foreground; |
719 | } | 719 | } |
720 | else if(i==1 || i == 11) { | 720 | else if(i==1 || i == 11) { |
721 | m_table[i].color = background; m_table[i].transparent=0; | 721 | m_table[i].color = background; m_table[i].transparent=0; |
722 | } | 722 | } |
723 | else | 723 | else |
724 | m_table[i].color = defaultCt[i].color; | 724 | m_table[i].color = defaultCt[i].color; |
725 | } | 725 | } |
726 | } | 726 | } |
727 | lastSelectedMenu = iD; | 727 | lastSelectedMenu = iD; |
728 | te->setColorTable(m_table); | 728 | te->setColorTable(m_table); |
729 | update(); | 729 | update(); |
730 | } | 730 | } |
731 | 731 | ||
732 | void Konsole::configMenuSelected(int iD) | 732 | void Konsole::configMenuSelected(int iD) |
733 | { | 733 | { |
734 | // QString temp; | 734 | // QString temp; |
735 | // qDebug( temp.sprintf("configmenu %d",iD)); | 735 | // qDebug( temp.sprintf("configmenu %d",iD)); |
736 | TEWidget* te = getTe(); | 736 | TEWidget* te = getTe(); |
737 | Config cfg("Konsole"); | 737 | Config cfg("Konsole"); |
738 | cfg.setGroup("Menubar"); | 738 | cfg.setGroup("Menubar"); |
739 | if( iD == -4) { | 739 | if( iD == -4) { |
740 | cfg.setGroup("Tabs"); | 740 | cfg.setGroup("Tabs"); |
741 | QString tmp=cfg.readEntry("Position","Bottom"); | 741 | QString tmp=cfg.readEntry("Position","Bottom"); |
742 | 742 | ||
743 | if(tmp=="Top") { | 743 | if(tmp=="Top") { |
744 | tab->setTabPosition(QTabWidget::Bottom); | 744 | tab->setTabPosition(QTabWidget::Bottom); |
745 | configMenu->changeItem( iD,"Tabs on Top"); | 745 | configMenu->changeItem( iD,"Tabs on Top"); |
746 | cfg.writeEntry("Position","Bottom"); | 746 | cfg.writeEntry("Position","Bottom"); |
747 | } else { | 747 | } else { |
748 | tab->setTabPosition(QTabWidget::Top); | 748 | tab->setTabPosition(QTabWidget::Top); |
749 | configMenu->changeItem( iD,"Tabs on Bottom"); | 749 | configMenu->changeItem( iD,"Tabs on Bottom"); |
750 | cfg.writeEntry("Position","Top"); | 750 | cfg.writeEntry("Position","Top"); |
751 | } | 751 | } |
752 | } | 752 | } |
753 | } | 753 | } |
754 | 754 | ||
755 | void Konsole::changeCommand(const QString &text, int c) | 755 | void Konsole::changeCommand(const QString &text, int c) |
756 | { | 756 | { |
757 | Config cfg("Konsole"); | 757 | Config cfg("Konsole"); |
758 | cfg.setGroup("Commands"); | 758 | cfg.setGroup("Commands"); |
759 | if(commonCmds[c] != text) { | 759 | if(commonCmds[c] != text) { |
760 | cfg.writeEntry(QString::number(c),text); | 760 | cfg.writeEntry(QString::number(c),text); |
761 | commonCombo->clearEdit(); | 761 | commonCombo->clearEdit(); |
762 | commonCombo->setCurrentItem(c); | 762 | commonCombo->setCurrentItem(c); |
763 | } | 763 | } |
764 | } | 764 | } |
765 | 765 | ||
766 | void Konsole::setColor() | 766 | void Konsole::setColor() |
767 | { | 767 | { |
768 | Config cfg("Konsole"); | 768 | Config cfg("Konsole"); |
769 | cfg.setGroup("Colors"); | 769 | cfg.setGroup("Colors"); |
770 | int scheme = cfg.readNumEntry("Schema",1); | 770 | int scheme = cfg.readNumEntry("Schema",1); |
771 | if(scheme != 1) colorMenuSelected( -scheme); | 771 | if(scheme != 1) colorMenuSelected( -scheme); |
772 | } | 772 | } |
773 | 773 | ||
774 | void Konsole::scrollMenuSelected(int index) | 774 | void Konsole::scrollMenuSelected(int index) |
775 | { | 775 | { |
776 | // QString temp; | 776 | // QString temp; |
777 | // qDebug( temp.sprintf("scrollbar menu %d",index)); | 777 | // qDebug( temp.sprintf("scrollbar menu %d",index)); |
778 | TEWidget* te = getTe(); | 778 | TEWidget* te = getTe(); |
779 | Config cfg("Konsole"); | 779 | Config cfg("Konsole"); |
780 | cfg.setGroup("Scrollbar"); | 780 | cfg.setGroup("ScrollBar"); |
781 | switch( index){ | 781 | switch( index){ |
782 | case -24: | 782 | case -24: |
783 | te->setScrollbarLocation(0); | 783 | te->setScrollbarLocation(0); |
784 | cfg.writeEntry("Position",0); | 784 | cfg.writeEntry("Position",0); |
785 | break; | 785 | break; |
786 | case -25: | 786 | case -25: |
787 | te->setScrollbarLocation(1); | 787 | te->setScrollbarLocation(1); |
788 | cfg.writeEntry("Position",1); | 788 | cfg.writeEntry("Position",1); |
789 | break; | 789 | break; |
790 | case -26: | 790 | case -26: |
791 | te->setScrollbarLocation(2); | 791 | te->setScrollbarLocation(2); |
792 | cfg.writeEntry("Position",2); | 792 | cfg.writeEntry("Position",2); |
793 | break; | 793 | break; |
794 | }; | 794 | }; |
795 | 795 | ||
796 | } | 796 | } |
797 | 797 | ||
798 | void Konsole::editCommandListMenuSelected(int iD) | 798 | void Konsole::editCommandListMenuSelected(int iD) |
799 | { | 799 | { |
800 | // QString temp; | 800 | // QString temp; |
801 | // qDebug( temp.sprintf("edit command list %d",iD)); | 801 | // qDebug( temp.sprintf("edit command list %d",iD)); |
802 | TEWidget* te = getTe(); | 802 | TEWidget* te = getTe(); |
803 | Config cfg("Konsole"); | 803 | Config cfg("Konsole"); |
804 | cfg.setGroup("Menubar"); | 804 | cfg.setGroup("Menubar"); |
805 | if( iD == -3) { | 805 | if( iD == -3) { |
806 | if(!secondToolBar->isHidden()) { | 806 | if(!secondToolBar->isHidden()) { |
807 | secondToolBar->hide(); | 807 | secondToolBar->hide(); |
808 | configMenu->changeItem( iD,tr( "Show Command List" )); | 808 | configMenu->changeItem( iD,tr( "Show Command List" )); |
809 | cfg.writeEntry("Hidden","TRUE"); | 809 | cfg.writeEntry("Hidden","TRUE"); |
810 | configMenu->setItemEnabled(-22 ,FALSE); | 810 | configMenu->setItemEnabled(-22 ,FALSE); |
811 | } else { | 811 | } else { |
812 | secondToolBar->show(); | 812 | secondToolBar->show(); |
813 | configMenu->changeItem( iD,tr( "Hide Command List" )); | 813 | configMenu->changeItem( iD,tr( "Hide Command List" )); |
814 | cfg.writeEntry("Hidden","FALSE"); | 814 | cfg.writeEntry("Hidden","FALSE"); |
815 | configMenu->setItemEnabled(-22 ,TRUE); | 815 | configMenu->setItemEnabled(-22 ,TRUE); |
816 | 816 | ||
817 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { | 817 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { |
818 | configMenu->setItemChecked(-22,TRUE); | 818 | configMenu->setItemChecked(-22,TRUE); |
819 | commonCombo->setEditable( TRUE ); | 819 | commonCombo->setEditable( TRUE ); |
820 | } else { | 820 | } else { |
821 | configMenu->setItemChecked(-22,FALSE); | 821 | configMenu->setItemChecked(-22,FALSE); |
822 | commonCombo->setEditable( FALSE ); | 822 | commonCombo->setEditable( FALSE ); |
823 | } | 823 | } |
824 | } | 824 | } |
825 | } | 825 | } |
826 | if( iD == -22) { | 826 | if( iD == -22) { |
827 | cfg.setGroup("Commands"); | 827 | cfg.setGroup("Commands"); |
828 | // qDebug("enableCommandEdit"); | 828 | // qDebug("enableCommandEdit"); |
829 | if( !configMenu->isItemChecked(iD) ) { | 829 | if( !configMenu->isItemChecked(iD) ) { |
830 | commonCombo->setEditable( TRUE ); | 830 | commonCombo->setEditable( TRUE ); |
831 | configMenu->setItemChecked(iD,TRUE); | 831 | configMenu->setItemChecked(iD,TRUE); |
832 | commonCombo->setCurrentItem(0); | 832 | commonCombo->setCurrentItem(0); |
833 | cfg.writeEntry("EditEnabled","TRUE"); | 833 | cfg.writeEntry("EditEnabled","TRUE"); |
834 | } else { | 834 | } else { |
835 | commonCombo->setEditable( FALSE ); | 835 | commonCombo->setEditable( FALSE ); |
836 | configMenu->setItemChecked(iD,FALSE); | 836 | configMenu->setItemChecked(iD,FALSE); |
837 | cfg.writeEntry("EditEnabled","FALSE"); | 837 | cfg.writeEntry("EditEnabled","FALSE"); |
838 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 838 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
839 | te->setFocus(); | 839 | te->setFocus(); |
840 | } | 840 | } |
841 | } | 841 | } |
842 | if(iD == -23) { | 842 | if(iD == -23) { |
843 | // "edit commands" | 843 | // "edit commands" |
844 | CommandEditDialog *m = new CommandEditDialog(this); | 844 | CommandEditDialog *m = new CommandEditDialog(this); |
845 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); | 845 | connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); |
846 | m->showMaximized(); | 846 | m->showMaximized(); |
847 | } | 847 | } |
848 | 848 | ||
849 | } | 849 | } |
850 | 850 | ||
851 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' | 851 | // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' |
852 | void Konsole::setDocument( const QString &cmd) { | 852 | void Konsole::setDocument( const QString &cmd) { |
853 | newSession(); | 853 | newSession(); |
854 | TEWidget* te = getTe(); | 854 | TEWidget* te = getTe(); |
855 | if(cmd.find("-e", 0, TRUE) != -1) { | 855 | if(cmd.find("-e", 0, TRUE) != -1) { |
856 | QString cmd2; | 856 | QString cmd2; |
857 | cmd2=cmd.right(cmd.length()-3)+" &"; | 857 | cmd2=cmd.right(cmd.length()-3)+" &"; |
858 | system(cmd2.latin1()); | 858 | system(cmd2.latin1()); |
859 | if(startUp <= 1 && nsessions < 2) { | 859 | if(startUp <= 1 && nsessions < 2) { |