summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-12-08 13:39:34 (UTC)
committer llornkcor <llornkcor>2002-12-08 13:39:34 (UTC)
commit76fda4ee71e83d46f31a77b6d433cefdf24b3e73 (patch) (side-by-side diff)
tree7f42eaa5b101bd1433ba39d926c41e9ff1fd1a97
parenta88b210e6895614027c821bb5cedabc9b06117d3 (diff)
downloadopie-76fda4ee71e83d46f31a77b6d433cefdf24b3e73.zip
opie-76fda4ee71e83d46f31a77b6d433cefdf24b3e73.tar.gz
opie-76fda4ee71e83d46f31a77b6d433cefdf24b3e73.tar.bz2
moved font menu to options due to wrapping of the toolbar when using languages other than english that tend to have many characters in words :)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 275a9a8..eda3135 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -255,104 +255,105 @@ void Konsole::init(const char* _pgm, QStrList & _args)
fontChanged(cfont);
configMenu = new QPopupMenu( this);
colorMenu = new QPopupMenu( this);
scrollMenu = new QPopupMenu( this);
editCommandListMenu = new QPopupMenu( this);
configMenu->insertItem(tr("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(tr("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"));
#ifdef QT_QWS_OPIE
colorMenu->insertItem(tr( "Custom"));
#endif
+ configMenu->insertItem( tr("Font"), fontList );
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( colorMenuIsSelected(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(-23 ,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),"");
@@ -621,99 +622,100 @@ void Konsole::newSession() {
te->useBeep=c.readBoolEntry("useBeep",0);
// 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++;
doWrap();
setColor();
}
}
TEWidget* Konsole::getTe() {
if (nsessions) {
return (TEWidget *) tab->currentPage();
} else {
return 0;
}
}
void Konsole::switchSession(QWidget* w) {
TEWidget* te = (TEWidget *) w;
QFont teFnt = te->getVTFont();
for(uint i = 0; i < fonts.count(); i++) {
VTFont *fnt = fonts.at(i);
bool cf = fnt->getFont() == teFnt;
fontList->setItemChecked(i, cf);
if (cf) {
cfont = i;
}
}
}
void Konsole::colorMenuIsSelected(int iD) {
fromMenu = TRUE;
colorMenuSelected(iD);
}
/// ------------------------------- some new stuff by L.J. Potter
void Konsole::colorMenuSelected(int iD)
{ // this is NOT pretty, elegant or anything else besides functional
-// QString temp;
-// qDebug( temp.sprintf("colormenu %d", iD));
- TEWidget* te = getTe();
+// QString temp;
+// qDebug( temp.sprintf("colormenu %d", iD));
+
+ TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Colors");
// QColor foreground;
// QColor background;
colorMenu->setItemChecked(lastSelectedMenu,FALSE);
ColorEntry m_table[TABLE_COLORS];
const ColorEntry * defaultCt=te->getdefaultColorTable();
/////////// fore back
int i;
if(iD==-9) { // default default
for (i = 0; i < TABLE_COLORS; i++) {
m_table[i].color = defaultCt[i].color;
if(i==1 || i == 11)
m_table[i].transparent=1;
cfg.writeEntry("Schema","9");
colorMenu->setItemChecked(-9,TRUE);
}
} else {
if(iD==-6) { // green black
foreground.setRgb(0x18,255,0x18);
background.setRgb(0x00,0x00,0x00);
cfg.writeEntry("Schema","6");
colorMenu->setItemChecked(-6,TRUE);
}
if(iD==-7) { // black white
foreground.setRgb(0x00,0x00,0x00);
background.setRgb(0xFF,0xFF,0xFF);
cfg.writeEntry("Schema","7");
colorMenu->setItemChecked(-7,TRUE);
}
if(iD==-8) { // white black
foreground.setRgb(0xFF,0xFF,0xFF);
background.setRgb(0x00,0x00,0x00);
cfg.writeEntry("Schema","8");
colorMenu->setItemChecked(-8,TRUE);
}
if(iD==-10) {// Black, Red
foreground.setRgb(0x00,0x00,0x00);
background.setRgb(0xB2,0x18,0x18);
cfg.writeEntry("Schema","10");
colorMenu->setItemChecked(-10,TRUE);
}
if(iD==-11) {// Red, Black
foreground.setRgb(230,31,31); //0xB2,0x18,0x18
background.setRgb(0x00,0x00,0x00);
cfg.writeEntry("Schema","11");
colorMenu->setItemChecked(-11,TRUE);
}
@@ -754,169 +756,171 @@ void Konsole::colorMenuSelected(int iD)
foreground.setRgb(0x18,0xB2,0xB2);
cfg.writeEntry("Schema","17");
colorMenu->setItemChecked(-17,TRUE);
}
if(iD==-18) {// Black, Gold
background.setRgb(0x00,0x00,0x00);
foreground.setRgb(255,215,0);
cfg.writeEntry("Schema","18");
colorMenu->setItemChecked(-18,TRUE);
}
#ifdef QT_QWS_OPIE
if(iD==-19) {
// Custom
qDebug("do custom");
if(fromMenu) {
ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color");
connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this,
SLOT(changeForegroundColor(const QColor&)));
penColorPopupMenu->exec();
}
cfg.writeEntry("Schema","19");
if(!fromMenu) {
foreground.setNamedColor(cfg.readEntry("foreground",""));
background.setNamedColor(cfg.readEntry("background",""));
}
fromMenu=FALSE;
colorMenu->setItemChecked(-19,TRUE);
}
#endif
for (i = 0; i < TABLE_COLORS; i++) {
if(i==0 || i == 10) {
m_table[i].color = foreground;
}
else if(i==1 || i == 11) {
m_table[i].color = background; m_table[i].transparent=0;
}
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));
- TEWidget* te = getTe();
+// QString temp;
+// qDebug( temp.sprintf("configmenu %d",iD));
+
+ TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("Menubar");
int i,j;
#ifdef QT_QWS_OPIE
i=-29;j=-30;
#else
i=-28;j=-29;
#endif
if(iD == -4) {
cfg.setGroup("Tabs");
QString tmp=cfg.readEntry("Position","Bottom");
if(tmp=="Top") {
tab->setTabPosition(QTabWidget::Bottom);
configMenu->changeItem( iD, tr("Tabs on Top"));
cfg.writeEntry("Position","Bottom");
} else {
tab->setTabPosition(QTabWidget::Top);
configMenu->changeItem( iD, tr("Tabs on Bottom"));
cfg.writeEntry("Position","Top");
}
}
if(iD == i) {
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));
}
if(iD == j) {
cfg.setGroup("Menubar");
bool b=cfg.readBoolEntry("useBeep",0);
b=!b;
cfg.writeEntry("useBeep", b );
cfg.write();
configMenu->setItemChecked(j,b);
te->useBeep=b;
}
}
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);
}
}
void Konsole::setColor()
{
Config cfg("Konsole");
cfg.setGroup("Colors");
int scheme = cfg.readNumEntry("Schema",1);
if(scheme != 1) colorMenuSelected( -scheme);
}
void Konsole::scrollMenuSelected(int index)
{
- qDebug( "scrollbar menu %d",index);
+// qDebug( "scrollbar menu %d",index);
+
TEWidget* te = getTe();
Config cfg("Konsole");
cfg.setGroup("ScrollBar");
int i,j,k;
#ifdef QT_QWS_OPIE
i=-25;j=-26;k=-27;
#else
i=-24;j=-25;k=-26;
#endif
if(index == i) {
te->setScrollbarLocation(0);
cfg.writeEntry("Position",0);
} else if(index == j) {
te->setScrollbarLocation(1);
cfg.writeEntry("Position",1);
} else if(index == k) {
te->setScrollbarLocation(2);
cfg.writeEntry("Position",2);
}
// 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()) {