summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp7
-rw-r--r--core/apps/embeddedkonsole/TEWidget.h11
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp68
3 files changed, 47 insertions, 39 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index 4c6ea2a..c220e11 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -311,49 +311,50 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
scrollLoc = SCRLEFT;
break;
case 2:
scrollLoc = SCRRIGHT;
break;
};
useHorzScroll=cfg.readBoolEntry("HorzScroll",0);
blinkT = new QTimer(this);
connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent()));
// blinking = FALSE;
blinking = TRUE;
resizing = FALSE;
actSel = 0;
image = 0;
lines = 1;
columns = 1;
font_w = 1;
font_h = 1;
font_a = 1;
word_selection_mode = FALSE;
hposition = 0;
-vcolumns = 0;
+ vcolumns = 0;
+ useBeep = true;
setMouseMarks(TRUE);
setVTFont( QFont("fixed") );
setColorTable(base_color_table); // init color table
qApp->installEventFilter( this ); //FIXME: see below
// KCursor::setAutoHideCursor( this, true );
// Init DnD ////////////////////////////////////////////////////////////////
currentSession = NULL;
// setAcceptDrops(true); // attempt
// m_drop = new QPopupMenu(this);
// m_drop->insertItem( QString("Paste"), 0);
// m_drop->insertItem( QString("cd"), 1);
// connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int)));
// we need focus so that the auto-hide cursor feature works
setFocus();
setFocusPolicy( WheelFocus );
}
//FIXME: make proper destructor
// Here's a start (David)
TEWidget::~TEWidget()
@@ -1086,49 +1087,51 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e )
}
/* ------------------------------------------------------------------------- */
/* */
/* Frame */
/* */
/* ------------------------------------------------------------------------- */
void TEWidget::frameChanged()
{
propagateSize();
update();
}
/* ------------------------------------------------------------------------- */
/* */
/* Sound */
/* */
/* ------------------------------------------------------------------------- */
void TEWidget::Bell()
{
//#ifdef QT_QWS_SHARP
//# ifndef QT_NO_COP
- QCopEnvelope( "QPE/TaskBar", "soundAlarm()" );
+ if(useBeep)
+ QCopEnvelope( "QPE/TaskBar", "soundAlarm()" );
+
//# endif
//#else
//# ifndef QT_NO_SOUND
// QSound::play(Resource::findSound("alarm"));
//# endif
//#endif
// QApplication::beep();
}
/* ------------------------------------------------------------------------- */
/* */
/* Auxiluary */
/* */
/* ------------------------------------------------------------------------- */
void TEWidget::clearImage()
// initialize the image
// for internal use only
{
for (int y = 0; y < lines; y++)
for (int x = 0; x < columns; x++)
{
image[loc(x,y)].c = 0xff; //' ';
diff --git a/core/apps/embeddedkonsole/TEWidget.h b/core/apps/embeddedkonsole/TEWidget.h
index a480d45..5597f27 100644
--- a/core/apps/embeddedkonsole/TEWidget.h
+++ b/core/apps/embeddedkonsole/TEWidget.h
@@ -32,76 +32,69 @@
extern unsigned short vt100_graphics[32];
class TESession;
// class Konsole;
class TEWidget : public QFrame
// a widget representing attributed text
{ Q_OBJECT
// friend class Konsole;
public:
TEWidget(QWidget *parent=0, const char *name=0);
virtual ~TEWidget();
public:
QColor getDefaultBackColor();
const ColorEntry* getColorTable() const;
const ColorEntry* getdefaultColorTable() const;
void setColorTable(const ColorEntry table[]);
-
void setScrollbarLocation(int loc);
enum { SCRNONE=0, SCRLEFT=1, SCRRIGHT=2 };
-
void setScroll(int cursor, int lines);
void doScroll(int lines);
-
void doHScroll(int lines);
-
-
void emitSelection();
- void setWrapAt(int columns);
-
-public:
+ void setWrapAt(int columns);
void setImage(const ca* const newimg, int lines, int columns);
int Lines() { return lines; }
int Columns() { return columns; }
void calcGeometry();
void propagateSize();
QSize calcSize(int cols, int lins) const;
QSize sizeHint() const;
-public:
bool useHorzScroll;
+ bool useBeep;
void Bell();
void emitText(QString text);
void pasteClipboard();
signals:
void keyPressedSignal(QKeyEvent *e);
void mouseSignal(int cb, int cx, int cy);
void changedImageSizeSignal(int lines, int columns);
void changedHistoryCursor(int value);
void changedHorzCursor(int value);
void configureRequest( TEWidget*, int state, int x, int y );
void clearSelectionSignal();
void beginSelectionSignal( const int x, const int y );
void extendSelectionSignal( const int x, const int y );
void endSelectionSignal(const BOOL preserve_line_breaks);
protected:
virtual void styleChange( QStyle& );
bool eventFilter( QObject *, QEvent * );
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 5a68c81..ebff05e 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -350,48 +350,52 @@ void Konsole::init(const char* _pgm, QStrList & _args)
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" ));
// scrollMenu->insertSeparator(4);
// scrollMenu->insertItem(tr( "Horizontal" ));
configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
configMenu->insertItem(tr( "Wrap" ));
+ int jut = configMenu->insertItem(tr( "Use Beep" ));
+ cfg.setGroup("Menubar");
+ configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0));
+
//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);
// 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;
se_args.prepend("--login");
@@ -766,88 +770,97 @@ void Konsole::colorMenuSelected(int iD)
}
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));
+// 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");
- }
- }
- int i;
+ int i,j;
#ifdef QWS_QT_OPIE
-i=-29;
+ i=-29;j=-30;
#else
-i=-28;
+ i=-28;j=-29;
#endif
- if( iD == i) {
- cfg.setGroup("ScrollBar");
+ 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 == 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);
@@ -960,73 +973,72 @@ void Konsole::setDocument( const QString &cmd) {
void Konsole::parseCommandLine() {
QString cmd;
// newSession();
for (int i=1;i< qApp->argc();i++) {
if( QString(qApp->argv()[i]) == "-e") {
i++;
for ( int j=i;j< qApp->argc();j++) {
cmd+=QString(qApp->argv()[j])+" ";
}
cmd.stripWhiteSpace();
system(cmd.latin1());
exit(0);//close();
} // end -e switch
}
startUp++;
}
void Konsole::changeForegroundColor(const QColor &color) {
Config cfg("Konsole");
cfg.setGroup("Colors");
int r, g, b;
color.rgb(&r,&g,&b);
foreground.setRgb(r,g,b);
-// QString colors;
-// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue);
+
cfg.writeEntry("foreground",color.name());
+ qDebug("foreground "+color.name());
cfg.write();
qDebug("do other dialog");
#ifdef QWS_QT_OPIE
ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color");
connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this,
SLOT(changeBackgroundColor(const QColor&)));
penColorPopupMenu2->exec();
#endif
}
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());
+ qDebug("background "+color.name());
cfg.write();
}
void Konsole::doWrap() {
int i;
#ifdef QWS_QT_OPIE
i=-29;
#else
i=-28;
#endif
Config cfg("Konsole");
cfg.setGroup("ScrollBar");
TEWidget* te = getTe();
if( !cfg.readBoolEntry("HorzScroll",0)) {
te->setWrapAt(0);
configMenu->setItemChecked( i,TRUE);
} else {
- te->setWrapAt(90);
-// te->setWrapAt(120);
+// te->setWrapAt(90);
+ te->setWrapAt(120);
configMenu->setItemChecked( i,FALSE);
}
}