-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 10 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 7f3ea65..f4ca0bf 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -593,67 +593,70 @@ void Konsole::init(const char* _pgm, QStrList & _args) a = new QAction( tr("New"), Opie::Core::OResource::loadPixmap( "konsole/konsole", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolBar ); a = new QAction( tr("Full Screen"), Opie::Core::OResource::loadPixmap( "fullscreen", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); a->addTo( toolBar ); a = new QAction( tr("Zoom"), Opie::Core::OResource::loadPixmap( "zoom", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); a->addTo( toolBar ); a = new QAction( tr("Enter"), Opie::Core::OResource::loadPixmap( "konsole/enter", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); a = new QAction( tr("Space"), Opie::Core::OResource::loadPixmap( "konsole/space", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); a = new QAction( tr("Tab"), Opie::Core::OResource::loadPixmap( "konsole/tab", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); a = new QAction( tr("Up"), Opie::Core::OResource::loadPixmap( "konsole/up", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); a = new QAction( tr("Down"), Opie::Core::OResource::loadPixmap( "konsole/down", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); - a = new QAction( tr("Paste"), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ), - QString::null, 0, this, 0 ); + a = new QAction( tr("Paste"), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); + + a = new QAction( tr("Close"), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),QString::null, 0, this, 0 ); + connect( a, SIGNAL( activated() ), this, SLOT( closeSession() ) ); + a->addTo( toolBar ); secondToolBar = new QToolBar( this ); secondToolBar->setHorizontalStretchable( TRUE ); commonCombo = new QComboBox( secondToolBar ); // commonCombo->setMaximumWidth(236); ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); if( listHidden) { secondToolBar->hide(); editCommandListMenu->setItemEnabled(ec_quick ,FALSE); } ec_edit = 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) )); sm_none = scrollMenu->insertItem(tr( "None" )); sm_left = scrollMenu->insertItem(tr( "Left" )); sm_right = scrollMenu->insertItem(tr( "Right" )); @@ -1887,32 +1890,35 @@ void Konsole::changeForegroundColor(const QColor &color) void Konsole::changeBackgroundColor(const QColor &color) { odebug << "Change background" << oendl; Config cfg( "Konsole" ); cfg.setGroup("Colors"); int r, g, b; color.rgb(&r,&g,&b); background.setRgb(r,g,b); cfg.writeEntry("background",color.name()); odebug << "background "+color.name() << oendl; cfg.write(); } void Konsole::doWrap() { Config cfg( "Konsole" ); cfg.setGroup("ScrollBar"); TEWidget* te = getTe(); if( !cfg.readBoolEntry("HorzScroll",0)) { te->setWrapAt(0); configMenu->setItemChecked( cm_wrap,TRUE); } else { // te->setWrapAt(90); te->setWrapAt(120); configMenu->setItemChecked( cm_wrap,FALSE); } } +void Konsole::closeSession() { + doneSession(getTe(), 0); +} diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index e163cb8..40f5284 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h @@ -72,64 +72,65 @@ public slots: private slots: void setDocument(const QString &); void doneSession(TEWidget*,int); void changeTitle(TEWidget*, const QString&); void changeColumns(int); void setFont(int); // void fontChanged(int); void configMenuSelected(int ); void colorMenuSelected(int); void colorMenuIsSelected(int); void tabMenuSelected(int); void sessionListSelected(int); void enterCommand(int); void hitEnter(); void hitSpace(); void hitTab(); void hitPaste(); void hitUp(); void hitDown(); void switchSession(QWidget *); void changeCommand(const QString &, int); void initCommandList(); void scrollMenuSelected(int); void editCommandListMenuSelected(int); void parseCommandLine(); void changeForegroundColor(const QColor &); void changeBackgroundColor(const QColor &); void historyDialog(); void fullscreenTimeout(); + void closeSession(); private: void doWrap(); void init(const char* _pgm, QStrList & _args); void initSession(const char* _pgm, QStrList & _args); void runSession(TESession* s); void setColorPixmaps(); void setHistory(bool); void setColors(QColor foreground, QColor background); int findFont(const QString& name, int size, bool exact = false); QSize calcSize(int columns, int lines); TEWidget* getTe(); QStringList commands; QLabel * msgLabel; QColor foreground, background; bool fromMenu; bool fullscreen; private: class VTFont { public: VTFont(const QString& name, QFont& font, const QString& family, int familyNum, int size) { this->name = name; this->font = font; this->family = family; this->size = size; this->familyNum = familyNum; } |