-rw-r--r-- | core/apps/embeddedkonsole/commandeditdialog.cpp | 34 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 3 |
2 files changed, 8 insertions, 29 deletions
diff --git a/core/apps/embeddedkonsole/commandeditdialog.cpp b/core/apps/embeddedkonsole/commandeditdialog.cpp index ce21c47..8b2abfa 100644 --- a/core/apps/embeddedkonsole/commandeditdialog.cpp +++ b/core/apps/embeddedkonsole/commandeditdialog.cpp @@ -1,223 +1,199 @@ //comandeditdialog.cpp #include "commandeditdialog.h" #include "playlistselection.h" #include <qstring.h> #include <qpe/config.h> #include <qpe/qpetoolbar.h> #include <qwidget.h> #include <qpe/qpemenubar.h> #include <qpe/resource.h> #include <qlist.h> #include <qtoolbutton.h> #include <qvbox.h> #include <qlistview.h> #include <qlineedit.h> #include <qheader.h> #include <qlabel.h> #include <qmessagebox.h> #include "smallcommandeditdialogbase.h" CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags fl ) : CommandEditDialogBase(parent, name, TRUE, fl) { m_SuggestedCommandList->addColumn( tr("Command Selection") ); m_SuggestedCommandList->header()->hide(); m_SuggestedCommandList->setSorting(-1,FALSE); m_SuggestedCommandList->clearSelection(); m_SuggestedCommandList->setSorting(0,TRUE); - - QListViewItem *item; - - - item = new QListViewItem( m_SuggestedCommandList,"ls "); - - item = new QListViewItem( m_SuggestedCommandList,"cat "); - item = new QListViewItem( m_SuggestedCommandList,"cd "); - item = new QListViewItem( m_SuggestedCommandList,"chmod "); - item = new QListViewItem( m_SuggestedCommandList,"cp "); - item = new QListViewItem( m_SuggestedCommandList,"dc "); - item = new QListViewItem( m_SuggestedCommandList,"df "); - item = new QListViewItem( m_SuggestedCommandList,"dmesg "); - item = new QListViewItem( m_SuggestedCommandList,"echo "); + QListViewItem *item; item = new QListViewItem( m_SuggestedCommandList,"export "); - item = new QListViewItem( m_SuggestedCommandList,"env "); - item = new QListViewItem( m_SuggestedCommandList,"find "); - item = new QListViewItem( m_SuggestedCommandList,"free "); item = new QListViewItem( m_SuggestedCommandList,"ifconfig "); item = new QListViewItem( m_SuggestedCommandList,"ipkg "); - item = new QListViewItem( m_SuggestedCommandList,"mkdir "); - item = new QListViewItem( m_SuggestedCommandList,"mv "); - item = new QListViewItem( m_SuggestedCommandList,"nc localhost 7776 "); - item = new QListViewItem( m_SuggestedCommandList,"nc localhost 7777 "); - item = new QListViewItem( m_SuggestedCommandList,"nslookup "); - item = new QListViewItem( m_SuggestedCommandList,"ping "); - item = new QListViewItem( m_SuggestedCommandList,"ps aux"); - item = new QListViewItem( m_SuggestedCommandList,"pwd "); - item = new QListViewItem( m_SuggestedCommandList,"rm "); - item = new QListViewItem( m_SuggestedCommandList,"rmdir "); - item = new QListViewItem( m_SuggestedCommandList,"route "); item = new QListViewItem( m_SuggestedCommandList,"gzip "); item = new QListViewItem( m_SuggestedCommandList,"gunzip "); item = new QListViewItem( m_SuggestedCommandList,"chgrp "); item = new QListViewItem( m_SuggestedCommandList,"chown "); item = new QListViewItem( m_SuggestedCommandList,"date "); item = new QListViewItem( m_SuggestedCommandList,"dd "); - item = new QListViewItem( m_SuggestedCommandList,"df "); item = new QListViewItem( m_SuggestedCommandList,"dmesg "); item = new QListViewItem( m_SuggestedCommandList,"fuser "); item = new QListViewItem( m_SuggestedCommandList,"hostname "); item = new QListViewItem( m_SuggestedCommandList,"kill "); item = new QListViewItem( m_SuggestedCommandList,"killall "); item = new QListViewItem( m_SuggestedCommandList,"ln "); item = new QListViewItem( m_SuggestedCommandList,"ln -s "); + item = new QListViewItem( m_SuggestedCommandList,"lsmod"); + item = new QListViewItem( m_SuggestedCommandList,"depmod -a"); + item = new QListViewItem( m_SuggestedCommandList,"modprobe "); item = new QListViewItem( m_SuggestedCommandList,"mount "); item = new QListViewItem( m_SuggestedCommandList,"more "); item = new QListViewItem( m_SuggestedCommandList,"sort "); item = new QListViewItem( m_SuggestedCommandList,"touch "); item = new QListViewItem( m_SuggestedCommandList,"umount "); item = new QListViewItem( m_SuggestedCommandList,"mknod "); item = new QListViewItem( m_SuggestedCommandList,"netstat "); + item = new QListViewItem( m_SuggestedCommandList,"route "); item = new QListViewItem( m_SuggestedCommandList,"cardctl eject "); m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE); m_SuggestedCommandList->sort(); connect( m_SuggestedCommandList, SIGNAL( clicked( QListViewItem * ) ), m_PlayListSelection, SLOT( addToSelection( QListViewItem *) ) ); ToolButton1->setTextLabel("new"); ToolButton1->setPixmap(Resource::loadPixmap("new")); ToolButton1->setAutoRaise(TRUE); ToolButton1->setFocusPolicy(QWidget::NoFocus); connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog())); ToolButton2->setTextLabel("edit"); ToolButton2->setPixmap(Resource::loadPixmap("edit")); ToolButton2->setAutoRaise(TRUE); ToolButton2->setFocusPolicy(QWidget::NoFocus); connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog())); ToolButton3->setTextLabel("delete"); ToolButton3->setPixmap(Resource::loadPixmap("editdelete")); ToolButton3->setAutoRaise(TRUE); ToolButton3->setFocusPolicy(QWidget::NoFocus); connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected())); ToolButton4->setTextLabel("up"); ToolButton4->setPixmap(Resource::loadPixmap("up")); ToolButton4->setAutoRaise(TRUE); ToolButton4->setFocusPolicy(QWidget::NoFocus); connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp())); ToolButton5->setTextLabel("down"); ToolButton5->setPixmap(Resource::loadPixmap("down")); ToolButton5->setAutoRaise(TRUE); ToolButton5->setFocusPolicy(QWidget::NoFocus); connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown())); QListViewItem *current = m_SuggestedCommandList->selectedItem(); if ( current ) item->moveItem( current ); m_SuggestedCommandList->setSelected( item, TRUE ); m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() ); Config cfg("Konsole"); cfg.setGroup("Commands"); if (cfg.readEntry("Commands Set","FALSE") == "TRUE") { for (int i = 0; i < 100; i++) { QString tmp; tmp = cfg.readEntry( QString::number(i),""); if (!tmp.isEmpty()) m_PlayListSelection->addStringToSelection(tmp); } } else { m_PlayListSelection->addStringToSelection("ls "); m_PlayListSelection->addStringToSelection("cardctl eject"); m_PlayListSelection->addStringToSelection("cat "); m_PlayListSelection->addStringToSelection("cd "); m_PlayListSelection->addStringToSelection("chmod "); m_PlayListSelection->addStringToSelection("cp "); m_PlayListSelection->addStringToSelection("dc "); m_PlayListSelection->addStringToSelection("df "); m_PlayListSelection->addStringToSelection("dmesg"); m_PlayListSelection->addStringToSelection("echo "); m_PlayListSelection->addStringToSelection("env"); m_PlayListSelection->addStringToSelection("find "); m_PlayListSelection->addStringToSelection("free"); m_PlayListSelection->addStringToSelection("grep "); m_PlayListSelection->addStringToSelection("ifconfig "); m_PlayListSelection->addStringToSelection("ipkg "); m_PlayListSelection->addStringToSelection("mkdir "); m_PlayListSelection->addStringToSelection("mv "); m_PlayListSelection->addStringToSelection("nc localhost 7776"); m_PlayListSelection->addStringToSelection("nc localhost 7777"); m_PlayListSelection->addStringToSelection("nslookup "); m_PlayListSelection->addStringToSelection("ping "); m_PlayListSelection->addStringToSelection("ps aux"); m_PlayListSelection->addStringToSelection("pwd "); m_PlayListSelection->addStringToSelection("rm "); m_PlayListSelection->addStringToSelection("rmdir "); m_PlayListSelection->addStringToSelection("route "); m_PlayListSelection->addStringToSelection("set "); m_PlayListSelection->addStringToSelection("traceroute"); } } CommandEditDialog::~CommandEditDialog() { } void CommandEditDialog::accept() { int i = 0; Config *cfg = new Config("Konsole"); cfg->setGroup("Commands"); cfg->clearGroup(); QListViewItemIterator it( m_PlayListSelection ); for ( ; it.current(); ++it ) { // qDebug(it.current()->text(0)); cfg->writeEntry(QString::number(i),it.current()->text(0)); i++; } cfg->writeEntry("Commands Set","TRUE"); // qDebug("CommandEditDialog::accept() - written"); delete cfg; emit commandsEdited(); close(); } void CommandEditDialog::showEditDialog() { editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE); d->setCaption("Edit command"); d->TextLabel->setText("Edit command:"); d->commandEdit->setText(m_PlayListSelection->currentItem()->text(0)); int i = d->exec(); if ((i==1) && (!(d->commandEdit->text()).isEmpty())) m_PlayListSelection->currentItem()->setText(0,(d->commandEdit->text())); } void CommandEditDialog::showAddDialog() { editCommandBase *d = new editCommandBase(this,"smalleditdialog", TRUE); int i = d->exec(); if ((i==1) && (!(d->commandEdit->text()).isEmpty())) m_PlayListSelection->addStringToSelection(d->commandEdit->text()); } diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index f13d0c9..3f6e0b4 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -1,515 +1,518 @@ /* ---------------------------------------------------------------------- */ /* */ /* [main.C] Konsole */ /* */ /* ---------------------------------------------------------------------- */ /* */ /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ /* */ /* This file is part of Konsole, an X terminal. */ /* */ /* The material contained in here more or less directly orginates from */ /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ /* */ /* ---------------------------------------------------------------------- */ /* */ /* Ported Konsole to Qt/Embedded */ /* */ /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ /* */ /* -------------------------------------------------------------------------- */ // enhancements added by L.J. Potter <ljp@llornkcor.com> #include <qpe/resource.h> #include <qdir.h> #include <qevent.h> #include <qdragobject.h> #include <qobjectlist.h> #include <qtoolbutton.h> #include <qpe/qpetoolbar.h> #include <qpushbutton.h> #include <qfontdialog.h> #include <qglobal.h> #include <qpainter.h> #include <qpe/qpemenubar.h> #include <qmessagebox.h> #include <qaction.h> #include <qapplication.h> #include <qfontmetrics.h> #include <qcombobox.h> #include <qevent.h> #include <qtabwidget.h> #include <qtabbar.h> #include <qpe/config.h> #include <qstringlist.h> #include <qpalette.h> #include <sys/wait.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include "konsole.h" #include "keytrans.h" #include "commandeditdialog.h" class EKNumTabBar : public QTabBar { public: void numberTabs() { // Yes, it really is this messy. QTabWidget needs functions // that provide acces to tabs in a sequential way. int m=INT_MIN; for (int i=0; i<count(); i++) { QTab* left=0; QListIterator<QTab> it(*tabList()); int x=INT_MAX; for( QTab* t; (t=it.current()); ++it ) { int tx = t->rect().x(); if ( tx<x && tx>m ) { x = tx; left = t; } } if ( left ) { left->setText(QString::number(i+1)); m = left->rect().x(); } } } }; class EKNumTabWidget : public QTabWidget { public: EKNumTabWidget(QWidget* parent) : QTabWidget(parent) { } void addTab(QWidget* w) { QTab* t = new QTab(QString::number(tabBar()->count()+1)); QTabWidget::addTab(w,t); } void removeTab(QWidget* w) { removePage(w); ((EKNumTabBar*)tabBar())->numberTabs(); } }; // This could be configurable or dynamicly generated from the bash history // file of the user static const char *commonCmds[] = { "ls ", // I left this here, cause it looks better than the first alpha "cardctl eject", "cat ", "cd ", "chmod ", "clear", "cp ", "dc ", "df ", "dmesg", "echo ", "env", "find ", "free", "grep ", "ifconfig ", "ipkg ", "mkdir ", "mv ", "nc localhost 7776", "nc localhost 7777", "netstat ", "nslookup ", "ping ", "ps aux", "pwd ", + "qcop QPE/System 'linkChanged(QString)' ''", + "qcop QPE/System 'restart()'", + "qcop QPE/System 'quit()'", "rm ", "rmdir ", "route ", "set ", "traceroute", /* "gzip", "gunzip", "chgrp", "chown", "date", "dd", "df", "dmesg", "fuser", "hostname", "kill", "killall", "ln", "ping", "mount", "more", "sort", "touch", "umount", "mknod", "netstat", */ "exit", NULL }; Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : QMainWindow(parent, name, fl) { QStrList args; init("/bin/sh",args); } Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) : QMainWindow(0, name) { init(_pgm,_args); } void Konsole::initCommandList() { // qDebug("Konsole::initCommandList"); Config cfg("Konsole"); cfg.setGroup("Commands"); commonCombo->setInsertionPolicy(QComboBox::AtCurrent); commonCombo->clear(); if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { for (int i = 0; commonCmds[i] != NULL; i++) { commonCombo->insertItem(commonCmds[i],i); } } else { for (int i = 0; i < 100; i++) { if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); } } } void Konsole::init(const char* _pgm, QStrList & _args) { b_scroll = TRUE; // histon; n_keytab = 0; n_render = 0; startUp=0; setCaption( tr("Terminal") ); setIcon( Resource::loadPixmap( "konsole" ) ); Config cfg("Konsole"); cfg.setGroup("Konsole"); QString tmp; // initialize the list of allowed fonts /////////////////////////////////// cfont = cfg.readNumEntry("FontID", 1); QFont f = QFont("Micro", 4, QFont::Normal); f.setFixedPitch(TRUE); fonts.append(new VTFont(tr("Micro"), f)); f = QFont("Fixed", 7, QFont::Normal); f.setFixedPitch(TRUE); fonts.append(new VTFont(tr("Small Fixed"), f)); f = QFont("Fixed", 12, QFont::Normal); f.setFixedPitch(TRUE); fonts.append(new VTFont(tr("Medium Fixed"), f)); // create terminal emulation framework //////////////////////////////////// nsessions = 0; tab = new EKNumTabWidget(this); connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); // create terminal toolbar //////////////////////////////////////////////// setToolBarsMovable( FALSE ); QPEToolBar *menuToolBar = new QPEToolBar( this ); menuToolBar->setHorizontalStretchable( TRUE ); QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); fontList = new QPopupMenu( this ); for(uint i = 0; i < fonts.count(); i++) { VTFont *fnt = fonts.at(i); fontList->insertItem(fnt->getName(), i); } fontChanged(cfont); configMenu = new QPopupMenu( this); colorMenu = new QPopupMenu( this); scrollMenu = new QPopupMenu( this); editCommandListMenu = new QPopupMenu( this); configMenu->insertItem("Command List",editCommandListMenu); bool listHidden; cfg.setGroup("Menubar"); if( cfg.readEntry("Hidden","FALSE") == "TRUE") { editCommandListMenu->insertItem( tr( "Show command list" )); listHidden=TRUE; } else { editCommandListMenu->insertItem( tr( "Hide command list" )); listHidden=FALSE; } cfg.setGroup("Tabs"); tmp=cfg.readEntry("Position","Bottom"); if(tmp=="Top") { tab->setTabPosition(QTabWidget::Top); configMenu->insertItem( tr( "Tabs on Bottom" ) ); } else { tab->setTabPosition(QTabWidget::Bottom); configMenu->insertItem("Tabs on Top"); } configMenu->insertSeparator(2); colorMenu->insertItem(tr( "Green on Black")); colorMenu->insertItem(tr( "Black on White")); colorMenu->insertItem(tr( "White on Black")); colorMenu->insertItem(tr( "Black on Transparent")); colorMenu->insertItem(tr( "Black on Red")); colorMenu->insertItem(tr( "Red on Black")); colorMenu->insertItem(tr( "Green on Yellow")); colorMenu->insertItem(tr( "Blue on Magenta")); colorMenu->insertItem(tr( "Magenta on Blue")); colorMenu->insertItem(tr( "Cyan on White")); colorMenu->insertItem(tr( "White on Cyan")); colorMenu->insertItem(tr( "Blue on Black")); colorMenu->insertItem(tr( "Amber on Black")); configMenu->insertItem(tr( "Colors") ,colorMenu); connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); menuBar->insertItem( tr("Font"), fontList ); menuBar->insertItem( tr("Options"), configMenu ); QPEToolBar *toolbar = new QPEToolBar( this ); QAction *a; // Button Commands a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); /* a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); */ secondToolBar = new QPEToolBar( this ); secondToolBar->setHorizontalStretchable( TRUE ); commonCombo = new QComboBox( secondToolBar ); commonCombo->setMaximumWidth(236); editCommandListMenu->insertItem( tr( "Quick Edit" ) ); if( listHidden) { secondToolBar->hide(); editCommandListMenu->setItemEnabled(-22 ,FALSE); } editCommandListMenu->insertItem(tr( "Edit" ) ); cfg.setGroup("Commands"); commonCombo->setInsertionPolicy(QComboBox::AtCurrent); initCommandList(); // for (int i = 0; commonCmds[i] != NULL; i++) { // commonCombo->insertItem( commonCmds[i], i ); // tmp = cfg.readEntry( QString::number(i),""); // if(tmp != "") // commonCombo->changeItem( tmp,i ); // } connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); scrollMenu->insertItem(tr( "None" )); scrollMenu->insertItem(tr( "Left" )); scrollMenu->insertItem(tr( "Right" )); configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); // create applications ///////////////////////////////////////////////////// setCentralWidget(tab); // load keymaps //////////////////////////////////////////////////////////// KeyTrans::loadAll(); for (int i = 0; i < KeyTrans::count(); i++) { KeyTrans* s = KeyTrans::find(i); assert( s ); } se_pgm = _pgm; se_args = _args; parseCommandLine(); // read and apply default values /////////////////////////////////////////// resize(321, 321); // Dummy. QSize currentSize = size(); if (currentSize != size()) defaultSize = size(); } void Konsole::show() { if ( !nsessions ) { newSession(); } QMainWindow::show(); } void Konsole::initSession(const char*, QStrList &) { QMainWindow::show(); } Konsole::~Konsole() { while (nsessions > 0) { doneSession(getTe()->currentSession, 0); } Config cfg("Konsole"); cfg.setGroup("Konsole"); cfg.writeEntry("FontID", cfont); } void Konsole::fontChanged(int f) { VTFont* font = fonts.at(f); if (font != 0) { for(uint i = 0; i < fonts.count(); i++) { fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); } cfont = f; TEWidget* te = getTe(); if (te != 0) { te->setVTFont(font->getFont()); } } } void Konsole::enterCommand(int c) { TEWidget* te = getTe(); if (te != 0) { if(!commonCombo->editable()) { QString text = commonCombo->text(c); //commonCmds[c]; te->emitText(text); } else { changeCommand( commonCombo->text(c), c); } } } void Konsole::hitEnter() { TEWidget* te = getTe(); if (te != 0) { te->emitText(QString("\r")); } } void Konsole::hitSpace() { TEWidget* te = getTe(); if (te != 0) { te->emitText(QString(" ")); } } void Konsole::hitTab() { TEWidget* te = getTe(); if (te != 0) { te->emitText(QString("\t")); } } void Konsole::hitPaste() { TEWidget* te = getTe(); if (te != 0) { te->pasteClipboard(); } } void Konsole::hitUp() { TEWidget* te = getTe(); if (te != 0) { QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); QApplication::sendEvent( te, &ke ); } } void Konsole::hitDown() { TEWidget* te = getTe(); if (te != 0) { QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); QApplication::sendEvent( te, &ke ); } } /** This function calculates the size of the external widget needed for the internal widget to be */ QSize Konsole::calcSize(int columns, int lines) { TEWidget* te = getTe(); if (te != 0) { QSize size = te->calcSize(columns, lines); return size; } else { QSize size; return size; } } /** sets application window to a size based on columns X lines of the te guest widget. Call with (0,0) for setting default size. */ void Konsole::setColLin(int columns, int lines) { if ((columns==0) || (lines==0)) { if (defaultSize.isEmpty()) // not in config file : set default value { defaultSize = calcSize(80,24); // notifySize(24,80); // set menu items (strange arg order !) } resize(defaultSize); } else { resize(calcSize(columns, lines)); // notifySize(lines,columns); // set menu items (strange arg order !) } } |