summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2005-08-10 08:14:56 (UTC)
committer llornkcor <llornkcor>2005-08-10 08:14:56 (UTC)
commitae7eb0bd76bd93cee70f258f3c4aef1accee766c (patch) (unidiff)
tree08fa3a0118b258b51b8107608e9632bb51de763c
parentcfc9ff35215081a33adde29872553513d08f58bb (diff)
downloadopie-ae7eb0bd76bd93cee70f258f3c4aef1accee766c.zip
opie-ae7eb0bd76bd93cee70f258f3c4aef1accee766c.tar.gz
opie-ae7eb0bd76bd93cee70f258f3c4aef1accee766c.tar.bz2
add close session button
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp10
-rw-r--r--core/apps/embeddedkonsole/konsole.h1
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)
593 a = new QAction( tr("New"), Opie::Core::OResource::loadPixmap( "konsole/konsole", Opie::Core::OResource::SmallIcon ), 593 a = new QAction( tr("New"), Opie::Core::OResource::loadPixmap( "konsole/konsole", Opie::Core::OResource::SmallIcon ),
594 QString::null, 0, this, 0 ); 594 QString::null, 0, this, 0 );
595 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); 595 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) );
596 a->addTo( toolBar ); 596 a->addTo( toolBar );
597 597
598 a = new QAction( tr("Full Screen"), Opie::Core::OResource::loadPixmap( "fullscreen", Opie::Core::OResource::SmallIcon ), 598 a = new QAction( tr("Full Screen"), Opie::Core::OResource::loadPixmap( "fullscreen", Opie::Core::OResource::SmallIcon ),
599 QString::null, 0, this, 0 ); 599 QString::null, 0, this, 0 );
600 connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); 600 connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) );
601 a->addTo( toolBar ); 601 a->addTo( toolBar );
602 602
603 a = new QAction( tr("Zoom"), Opie::Core::OResource::loadPixmap( "zoom", Opie::Core::OResource::SmallIcon ), 603 a = new QAction( tr("Zoom"), Opie::Core::OResource::loadPixmap( "zoom", Opie::Core::OResource::SmallIcon ),
604 QString::null, 0, this, 0 ); 604 QString::null, 0, this, 0 );
605 connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); 605 connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) );
606 a->addTo( toolBar ); 606 a->addTo( toolBar );
607 607
608 608
609 a = new QAction( tr("Enter"), Opie::Core::OResource::loadPixmap( "konsole/enter", Opie::Core::OResource::SmallIcon ), 609 a = new QAction( tr("Enter"), Opie::Core::OResource::loadPixmap( "konsole/enter", Opie::Core::OResource::SmallIcon ),
610 QString::null, 0, this, 0 ); 610 QString::null, 0, this, 0 );
611 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); 611 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar );
612 a = new QAction( tr("Space"), Opie::Core::OResource::loadPixmap( "konsole/space", Opie::Core::OResource::SmallIcon ), 612 a = new QAction( tr("Space"), Opie::Core::OResource::loadPixmap( "konsole/space", Opie::Core::OResource::SmallIcon ),
613 QString::null, 0, this, 0 ); 613 QString::null, 0, this, 0 );
614 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); 614 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar );
615 a = new QAction( tr("Tab"), Opie::Core::OResource::loadPixmap( "konsole/tab", Opie::Core::OResource::SmallIcon ), 615 a = new QAction( tr("Tab"), Opie::Core::OResource::loadPixmap( "konsole/tab", Opie::Core::OResource::SmallIcon ),
616 QString::null, 0, this, 0 ); 616 QString::null, 0, this, 0 );
617 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); 617 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar );
618 a = new QAction( tr("Up"), Opie::Core::OResource::loadPixmap( "konsole/up", Opie::Core::OResource::SmallIcon ), 618 a = new QAction( tr("Up"), Opie::Core::OResource::loadPixmap( "konsole/up", Opie::Core::OResource::SmallIcon ),
619 QString::null, 0, this, 0 ); 619 QString::null, 0, this, 0 );
620 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); 620 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar );
621 a = new QAction( tr("Down"), Opie::Core::OResource::loadPixmap( "konsole/down", Opie::Core::OResource::SmallIcon ), 621 a = new QAction( tr("Down"), Opie::Core::OResource::loadPixmap( "konsole/down", Opie::Core::OResource::SmallIcon ),
622 QString::null, 0, this, 0 ); 622 QString::null, 0, this, 0 );
623 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); 623 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar );
624 624
625 a = new QAction( tr("Paste"), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ), 625 a = new QAction( tr("Paste"), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
626 QString::null, 0, this, 0 );
627 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); 626 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) );
627
628 a = new QAction( tr("Close"), Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ),QString::null, 0, this, 0 );
629 connect( a, SIGNAL( activated() ), this, SLOT( closeSession() ) );
630
628 a->addTo( toolBar ); 631 a->addTo( toolBar );
629 632
630 secondToolBar = new QToolBar( this ); 633 secondToolBar = new QToolBar( this );
631 secondToolBar->setHorizontalStretchable( TRUE ); 634 secondToolBar->setHorizontalStretchable( TRUE );
632 635
633 commonCombo = new QComboBox( secondToolBar ); 636 commonCombo = new QComboBox( secondToolBar );
634 // commonCombo->setMaximumWidth(236); 637 // commonCombo->setMaximumWidth(236);
635 638
636 ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); 639 ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) );
637 if( listHidden) 640 if( listHidden)
638 { 641 {
639 secondToolBar->hide(); 642 secondToolBar->hide();
640 editCommandListMenu->setItemEnabled(ec_quick ,FALSE); 643 editCommandListMenu->setItemEnabled(ec_quick ,FALSE);
641 } 644 }
642 ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); 645 ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) );
643 646
644 cfg.setGroup("Commands"); 647 cfg.setGroup("Commands");
645 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 648 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
646 649
647 initCommandList(); 650 initCommandList();
648 // for (int i = 0; commonCmds[i] != NULL; i++) { 651 // for (int i = 0; commonCmds[i] != NULL; i++) {
649 // commonCombo->insertItem( commonCmds[i], i ); 652 // commonCombo->insertItem( commonCmds[i], i );
650 // tmp = cfg.readEntry( QString::number(i),""); 653 // tmp = cfg.readEntry( QString::number(i),"");
651 // if(tmp != "") 654 // if(tmp != "")
652 // commonCombo->changeItem( tmp,i ); 655 // commonCombo->changeItem( tmp,i );
653 // } 656 // }
654 657
655 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 658 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
656 659
657 sm_none = scrollMenu->insertItem(tr( "None" )); 660 sm_none = scrollMenu->insertItem(tr( "None" ));
658 sm_left = scrollMenu->insertItem(tr( "Left" )); 661 sm_left = scrollMenu->insertItem(tr( "Left" ));
659 sm_right = scrollMenu->insertItem(tr( "Right" )); 662 sm_right = scrollMenu->insertItem(tr( "Right" ));
@@ -1887,32 +1890,35 @@ void Konsole::changeForegroundColor(const QColor &color)
1887 1890
1888void Konsole::changeBackgroundColor(const QColor &color) 1891void Konsole::changeBackgroundColor(const QColor &color)
1889{ 1892{
1890 1893
1891 odebug << "Change background" << oendl; 1894 odebug << "Change background" << oendl;
1892 Config cfg( "Konsole" ); 1895 Config cfg( "Konsole" );
1893 cfg.setGroup("Colors"); 1896 cfg.setGroup("Colors");
1894 int r, g, b; 1897 int r, g, b;
1895 color.rgb(&r,&g,&b); 1898 color.rgb(&r,&g,&b);
1896 background.setRgb(r,g,b); 1899 background.setRgb(r,g,b);
1897 cfg.writeEntry("background",color.name()); 1900 cfg.writeEntry("background",color.name());
1898 odebug << "background "+color.name() << oendl; 1901 odebug << "background "+color.name() << oendl;
1899 cfg.write(); 1902 cfg.write();
1900} 1903}
1901 1904
1902void Konsole::doWrap() 1905void Konsole::doWrap()
1903{ 1906{
1904 Config cfg( "Konsole" ); 1907 Config cfg( "Konsole" );
1905 cfg.setGroup("ScrollBar"); 1908 cfg.setGroup("ScrollBar");
1906 TEWidget* te = getTe(); 1909 TEWidget* te = getTe();
1907 if( !cfg.readBoolEntry("HorzScroll",0)) 1910 if( !cfg.readBoolEntry("HorzScroll",0))
1908 { 1911 {
1909 te->setWrapAt(0); 1912 te->setWrapAt(0);
1910 configMenu->setItemChecked( cm_wrap,TRUE); 1913 configMenu->setItemChecked( cm_wrap,TRUE);
1911 } 1914 }
1912 else 1915 else
1913 { 1916 {
1914 // te->setWrapAt(90); 1917 // te->setWrapAt(90);
1915 te->setWrapAt(120); 1918 te->setWrapAt(120);
1916 configMenu->setItemChecked( cm_wrap,FALSE); 1919 configMenu->setItemChecked( cm_wrap,FALSE);
1917 } 1920 }
1918} 1921}
1922void Konsole::closeSession() {
1923 doneSession(getTe(), 0);
1924}
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:
72 72
73private slots: 73private slots:
74 void setDocument(const QString &); 74 void setDocument(const QString &);
75 void doneSession(TEWidget*,int); 75 void doneSession(TEWidget*,int);
76 void changeTitle(TEWidget*, const QString&); 76 void changeTitle(TEWidget*, const QString&);
77 void changeColumns(int); 77 void changeColumns(int);
78 void setFont(int); 78 void setFont(int);
79 // void fontChanged(int); 79 // void fontChanged(int);
80 void configMenuSelected(int ); 80 void configMenuSelected(int );
81 void colorMenuSelected(int); 81 void colorMenuSelected(int);
82 void colorMenuIsSelected(int); 82 void colorMenuIsSelected(int);
83 void tabMenuSelected(int); 83 void tabMenuSelected(int);
84 void sessionListSelected(int); 84 void sessionListSelected(int);
85 85
86 void enterCommand(int); 86 void enterCommand(int);
87 void hitEnter(); 87 void hitEnter();
88 void hitSpace(); 88 void hitSpace();
89 void hitTab(); 89 void hitTab();
90 void hitPaste(); 90 void hitPaste();
91 void hitUp(); 91 void hitUp();
92 void hitDown(); 92 void hitDown();
93 void switchSession(QWidget *); 93 void switchSession(QWidget *);
94 void changeCommand(const QString &, int); 94 void changeCommand(const QString &, int);
95 void initCommandList(); 95 void initCommandList();
96 void scrollMenuSelected(int); 96 void scrollMenuSelected(int);
97 void editCommandListMenuSelected(int); 97 void editCommandListMenuSelected(int);
98 void parseCommandLine(); 98 void parseCommandLine();
99 void changeForegroundColor(const QColor &); 99 void changeForegroundColor(const QColor &);
100 void changeBackgroundColor(const QColor &); 100 void changeBackgroundColor(const QColor &);
101 101
102 void historyDialog(); 102 void historyDialog();
103 void fullscreenTimeout(); 103 void fullscreenTimeout();
104 void closeSession();
104 105
105private: 106private:
106 void doWrap(); 107 void doWrap();
107 void init(const char* _pgm, QStrList & _args); 108 void init(const char* _pgm, QStrList & _args);
108 void initSession(const char* _pgm, QStrList & _args); 109 void initSession(const char* _pgm, QStrList & _args);
109 void runSession(TESession* s); 110 void runSession(TESession* s);
110 void setColorPixmaps(); 111 void setColorPixmaps();
111 void setHistory(bool); 112 void setHistory(bool);
112 void setColors(QColor foreground, QColor background); 113 void setColors(QColor foreground, QColor background);
113 int findFont(const QString& name, int size, bool exact = false); 114 int findFont(const QString& name, int size, bool exact = false);
114 QSize calcSize(int columns, int lines); 115 QSize calcSize(int columns, int lines);
115 TEWidget* getTe(); 116 TEWidget* getTe();
116 QStringList commands; 117 QStringList commands;
117 QLabel * msgLabel; 118 QLabel * msgLabel;
118 QColor foreground, background; 119 QColor foreground, background;
119 bool fromMenu; 120 bool fromMenu;
120 121
121 bool fullscreen; 122 bool fullscreen;
122 123
123private: 124private:
124 class VTFont 125 class VTFont
125 { 126 {
126 public: 127 public:
127 VTFont(const QString& name, QFont& font, const QString& family, int familyNum, int size) 128 VTFont(const QString& name, QFont& font, const QString& family, int familyNum, int size)
128 { 129 {
129 this->name = name; 130 this->name = name;
130 this->font = font; 131 this->font = font;
131 this->family = family; 132 this->family = family;
132 this->size = size; 133 this->size = size;
133 this->familyNum = familyNum; 134 this->familyNum = familyNum;
134 } 135 }
135 136