summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/konsole.cpp
Side-by-side diff
Diffstat (limited to 'core/apps/embeddedkonsole/konsole.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp90
1 files changed, 62 insertions, 28 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 3c87ad4..16db0ea 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -349,28 +349,31 @@ void Konsole::init(const char* _pgm, QStrList & _args)
// 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" ));
- scrollMenu->insertSeparator(4);
- scrollMenu->insertItem(tr( "Horizontal" ));
+// scrollMenu->insertSeparator(4);
+// scrollMenu->insertItem(tr( "Horizontal" ));
configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
+
+ configMenu->insertItem(tr( "Wrap" ));
+
//scrollMenuSelected(-29);
// cfg.setGroup("ScrollBar");
// if(cfg.readBoolEntry("HorzScroll",0)) {
// if(cfg.readNumEntry("Position",2) == 0)
// te->setScrollbarLocation(1);
// else
// te->setScrollbarLocation(0);
// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
// te->setWrapAt(120);
// }
// create applications /////////////////////////////////////////////////////
setCentralWidget(tab);
@@ -390,24 +393,25 @@ parseCommandLine();
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);
}
@@ -589,35 +593,36 @@ void Konsole::doneSession(TESession*, int )
nsessions--;
}
if (nsessions == 0) {
close();
}
}
void Konsole::newSession() {
if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory?
TEWidget* te = new TEWidget(tab);
// te->setBackgroundMode(PaletteBase); //we want transparent!!
- te->setVTFont(fonts.at(cfont)->getFont());
- tab->addTab(te);
- TESession* se = new TESession(this, te, se_pgm, se_args, "xterm");
- te->currentSession = se;
- connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) );
- se->run();
- se->setConnect(TRUE);
- se->setHistory(b_scroll);
- tab->setCurrentPage(nsessions);
- nsessions++;
- setColor();
+ te->setVTFont(fonts.at(cfont)->getFont());
+ tab->addTab(te);
+ TESession* se = new TESession(this, te, se_pgm, se_args, "xterm");
+ te->currentSession = se;
+ connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) );
+ se->run();
+ se->setConnect(TRUE);
+ se->setHistory(b_scroll);
+ tab->setCurrentPage(nsessions);
+ nsessions++;
+ doWrap();
+ setColor();
}
}
TEWidget* Konsole::getTe() {
if (nsessions) {
return (TEWidget *) tab->currentPage();
} else {
return 0;
}
}
void Konsole::switchSession(QWidget* w) {
@@ -764,43 +769,57 @@ void Konsole::colorMenuSelected(int iD)
else
m_table[i].color = defaultCt[i].color;
}
}
lastSelectedMenu = iD;
te->setColorTable(m_table);
update();
}
void Konsole::configMenuSelected(int iD)
{
-// QString temp;
-// qDebug( temp.sprintf("configmenu %d",iD));
+ QString temp;
+ qDebug( temp.sprintf("configmenu %d",iD));
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Menubar");
if( iD == -4) {
cfg.setGroup("Tabs");
QString tmp=cfg.readEntry("Position","Bottom");
if(tmp=="Top") {
tab->setTabPosition(QTabWidget::Bottom);
configMenu->changeItem( iD,"Tabs on Top");
cfg.writeEntry("Position","Bottom");
} else {
tab->setTabPosition(QTabWidget::Top);
configMenu->changeItem( iD,"Tabs on Bottom");
cfg.writeEntry("Position","Top");
}
}
+ if( iD == -29) {
+ cfg.setGroup("ScrollBar");
+ bool b=cfg.readBoolEntry("HorzScroll",0);
+ b=!b;
+ cfg.writeEntry("HorzScroll", b );
+ cfg.write();
+ doWrap();
+ if(cfg.readNumEntry("Position",2) == 0) {
+ te->setScrollbarLocation(1);
+ } else {
+ te->setScrollbarLocation(0);
+ }
+ te->setScrollbarLocation( cfg.readNumEntry("Position",2));
+ }
}
void Konsole::changeCommand(const QString &text, int c)
{
Config cfg("Konsole");
cfg.setGroup("Commands");
if(commonCmds[c] != text) {
cfg.writeEntry(QString::number(c),text);
commonCombo->clearEdit();
commonCombo->setCurrentItem(c);
}
}
@@ -823,38 +842,39 @@ void Konsole::scrollMenuSelected(int index)
case -25:
te->setScrollbarLocation(0);
cfg.writeEntry("Position",0);
break;
case -26:
te->setScrollbarLocation(1);
cfg.writeEntry("Position",1);
break;
case -27:
te->setScrollbarLocation(2);
cfg.writeEntry("Position",2);
break;
- case -29: {
- bool b=cfg.readBoolEntry("HorzScroll",0);
- cfg.writeEntry("HorzScroll", !b );
- cfg.write();
- if(cfg.readNumEntry("Position",2) == 0)
- te->setScrollbarLocation(1);
- else
- te->setScrollbarLocation(0);
- te->setScrollbarLocation( cfg.readNumEntry("Position",2));
- te->setWrapAt(120);
- }
- break;
+// case -29: {
+// bool b=cfg.readBoolEntry("HorzScroll",0);
+// cfg.writeEntry("HorzScroll", !b );
+// cfg.write();
+// if(cfg.readNumEntry("Position",2) == 0) {
+// te->setScrollbarLocation(1);
+// te->setWrapAt(0);
+// } else {
+// te->setScrollbarLocation(0);
+// te->setWrapAt(120);
+// }
+// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
+// }
+// break;
};
-
}
void Konsole::editCommandListMenuSelected(int iD)
{
// QString temp;
// qDebug( temp.sprintf("edit command list %d",iD));
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Menubar");
if( iD == -3) {
if(!secondToolBar->isHidden()) {
secondToolBar->hide();
@@ -962,12 +982,26 @@ void Konsole::changeBackgroundColor(const QColor &color) {
qDebug("Change background");
Config cfg("Konsole");
cfg.setGroup("Colors");
int r, g, b;
color.rgb(&r,&g,&b);
background.setRgb(r,g,b);
// QString colors;
// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue);
cfg.writeEntry("background",color.name());
cfg.write();
}
+
+void Konsole::doWrap() {
+ Config cfg("Konsole");
+ cfg.setGroup("ScrollBar");
+ TEWidget* te = getTe();
+ if( !cfg.readBoolEntry("HorzScroll",0)) {
+ te->setWrapAt(0);
+ configMenu->setItemChecked(-29,FALSE);
+ } else {
+ te->setWrapAt(90);
+// te->setWrapAt(120);
+ configMenu->setItemChecked(-29,TRUE);
+ }
+}