summaryrefslogtreecommitdiff
authorchicken <chicken>2004-03-01 19:15:57 (UTC)
committer chicken <chicken>2004-03-01 19:15:57 (UTC)
commitfb0981f47e529f9d1dd77fa005ffa3c3ecedff67 (patch) (side-by-side diff)
treec338eb54935bbbe8966d5a642303d4aae3c1f0c8
parentb5a544bf520ce6d0d8f7b314720e6a703079dc1d (diff)
downloadopie-fb0981f47e529f9d1dd77fa005ffa3c3ecedff67.zip
opie-fb0981f47e529f9d1dd77fa005ffa3c3ecedff67.tar.gz
opie-fb0981f47e529f9d1dd77fa005ffa3c3ecedff67.tar.bz2
fix includes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/atconfigdialog.cpp1
-rw-r--r--noncore/apps/opie-console/keytrans.cpp3
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp1
3 files changed, 1 insertions, 4 deletions
diff --git a/noncore/apps/opie-console/atconfigdialog.cpp b/noncore/apps/opie-console/atconfigdialog.cpp
index e683ab3..8e91b9e 100644
--- a/noncore/apps/opie-console/atconfigdialog.cpp
+++ b/noncore/apps/opie-console/atconfigdialog.cpp
@@ -1,200 +1,199 @@
#include <qlineedit.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qcombobox.h>
#include <qtabwidget.h>
#include <qlabel.h>
-#include <qcombobox.h>
#include <qscrollview.h>
#include "atconfigdialog.h"
#include "io_modem.h"
ATConfigDialog::ATConfigDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
: QDialog( parent, name, modal, fl ) {
setCaption( tr( "Dialing parameter setup" ) );
QVBoxLayout *layout = new QVBoxLayout( this );
QTabWidget *tabWidget = new QTabWidget( this );
tabWidget->addTab( tab0( this ), tr("Settings1") );
tabWidget->addTab( tab1( this ), tr("Settings2") );
layout->addWidget( tabWidget );
}
QWidget* ATConfigDialog::tab0( QWidget* parent) {
QScrollView* sv = new QScrollView( parent );
QWidget *returnWidget = new QWidget( sv->viewport() );
sv->setResizePolicy( QScrollView::AutoOneFit );
// sv->setHScrollBarMode( QScrollView::AlwaysOff );
// sv->setFrameShape( QFrame::NoFrame );
QGridLayout *layout = new QGridLayout( returnWidget, 10, 2 );
QLabel *initStringLabel = new QLabel( tr("Init string "), returnWidget );
initStringLine = new QLineEdit( returnWidget );
layout->addWidget( initStringLabel, 0, 0 );
layout->addWidget( initStringLine, 0, 1 );
QLabel *resetStringLabel = new QLabel( tr("Reset string "), returnWidget );
resetStringLine = new QLineEdit( returnWidget );
layout->addWidget( resetStringLabel, 1, 0 );
layout->addWidget( resetStringLine, 1, 1 );
QLabel *dialPref1Label = new QLabel( tr("Dialing prefix #1 " ), returnWidget );
dialPref1Line = new QLineEdit( returnWidget );
layout->addWidget( dialPref1Label, 2, 0 );
layout->addWidget( dialPref1Line, 2, 1 );
QLabel *dialSuf1Label = new QLabel( tr("Dialing suffix #1 " ), returnWidget );
dialSuf1Line = new QLineEdit( returnWidget );
layout->addWidget( dialSuf1Label, 3, 0 );
layout->addWidget( dialSuf1Line, 3, 1 );
QLabel *dialPref2Label = new QLabel( tr("Dialing prefix #2 " ), returnWidget );
dialPref2Line = new QLineEdit( returnWidget );
layout->addWidget( dialPref2Label, 4, 0 );
layout->addWidget( dialPref2Line, 4, 1 );
QLabel *dialSuf2Label = new QLabel( tr("Dialing suffix #2 " ), returnWidget );
dialSuf2Line = new QLineEdit( returnWidget );
layout->addWidget( dialSuf2Label, 5, 0 );
layout->addWidget( dialSuf2Line, 5, 1 );
QLabel *dialPref3Label = new QLabel( tr("Dialing prefix #3 " ), returnWidget );
dialPref3Line = new QLineEdit( returnWidget );
layout->addWidget( dialPref3Label, 6, 0 );
layout->addWidget( dialPref3Line, 6, 1 );
QLabel *dialSuf3Label = new QLabel( tr("Dialing suffix #3 " ), returnWidget );
dialSuf3Line = new QLineEdit( returnWidget );
layout->addWidget( dialSuf3Label, 7, 0 );
layout->addWidget( dialSuf3Line, 7, 1 );
QLabel *connectLabel = new QLabel( tr("Connect string " ), returnWidget );
connectLine = new QLineEdit( returnWidget );
layout->addWidget( connectLabel, 8, 0 );
layout->addWidget( connectLine, 8, 1 );
QLabel *hangupLabel = new QLabel( tr("Hang-up string " ), returnWidget );
hangupLine = new QLineEdit( returnWidget );
layout->addWidget( hangupLabel, 9, 0 );
layout->addWidget( hangupLine, 9, 1 );
sv->addChild( returnWidget );
return sv;
}
QWidget* ATConfigDialog::tab1( QWidget* parent ) {
QWidget *returnWidget = new QWidget( parent );
QGridLayout *layout = new QGridLayout( returnWidget, 8, 2 );
QLabel *dialTimeLabel = new QLabel( tr("Dial time " ), returnWidget );
dialTimeSpin = new QSpinBox( returnWidget );
layout->addWidget( dialTimeLabel, 0, 0 );
layout->addWidget( dialTimeSpin, 0, 1 );
QLabel *delayRedialLabel = new QLabel( tr("Delay before redial " ), returnWidget );
delayRedialSpin = new QSpinBox( returnWidget );
layout->addWidget( delayRedialLabel, 1, 0 );
layout->addWidget( delayRedialSpin, 1, 1 );
QLabel *numberTriesLabel = new QLabel( tr("Number of tries " ), returnWidget );
numberTriesSpin = new QSpinBox( returnWidget );
layout->addWidget( numberTriesLabel, 2, 0 );
layout->addWidget( numberTriesSpin, 2, 1 );
QLabel *dtrDropTimeLabel = new QLabel( tr("DTR drop time (0=no) " ), returnWidget );
dtrDropTimeSpin = new QSpinBox( returnWidget );
layout->addWidget( dtrDropTimeLabel, 3, 0 );
layout->addWidget( dtrDropTimeSpin, 3, 1 );
QLabel *bpsDetectLabel = new QLabel( tr("Auto bps detect " ), returnWidget );
bpsDetectBox = new QComboBox( returnWidget );
layout->addWidget( bpsDetectLabel, 4, 0 );
layout->addWidget( bpsDetectBox, 4, 1 );
bpsDetectBox->insertItem( tr("No") );
bpsDetectBox->insertItem( tr("Yes") );
QLabel *dcdLinesLabel = new QLabel( tr("Modem has DCD line " ), returnWidget );
dcdLinesBox = new QComboBox( returnWidget );
layout->addWidget( dcdLinesLabel, 5, 0 );
layout->addWidget( dcdLinesBox, 5, 1 );
dcdLinesBox->insertItem( tr("No") );
dcdLinesBox->insertItem( tr("Yes") );
QLabel *multiLineUntagLabel = new QLabel( tr("Multi-line untag " ), returnWidget );
multiLineUntagBox = new QComboBox( returnWidget );
layout->addWidget( multiLineUntagLabel, 6, 0 );
layout->addWidget( multiLineUntagBox, 6, 1 );
multiLineUntagBox->insertItem( tr("No") );
multiLineUntagBox->insertItem( tr("Yes") );
return returnWidget;
}
void ATConfigDialog::readConfig( const Profile& config ) {
qWarning("config in atconfigdialog");
initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) );
resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) );
dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) );
dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) );
dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) );
dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) );
connectLine->setText( config.readEntry("DefaultConnect", MODEM_DEFAULT_CONNECT_STRING ) );
hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) );
dialTimeSpin->setValue( config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ) );
delayRedialSpin->setValue( config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ) );
numberTriesSpin->setValue( config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ) );
dtrDropTimeSpin->setValue( config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ) );
bpsDetectBox->setCurrentItem( config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ) );
dcdLinesBox->setCurrentItem( config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ) );
multiLineUntagBox->setCurrentItem( config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ) );
// Not implemented yet
resetStringLine->setEnabled(false);
dialSuf1Line->setEnabled(false);
dialPref2Line->setEnabled(false);
dialSuf2Line->setEnabled(false);
dialPref3Line->setEnabled(false);
dialSuf3Line->setEnabled(false);
dialTimeSpin->setEnabled(false);
delayRedialSpin->setEnabled(false);
numberTriesSpin->setEnabled(false);
dtrDropTimeSpin->setEnabled(false);
bpsDetectBox->setEnabled(false);
dcdLinesBox->setEnabled(false);
multiLineUntagBox->setEnabled(false);
}
void ATConfigDialog::writeConfig( Profile& config ) {
config.writeEntry( "InitString", initStringLine->text() );
config.writeEntry( "ResetString", resetStringLine->text() );
config.writeEntry( "DialPrefix1", dialPref1Line->text() );
config.writeEntry( "DialSuffix1", dialSuf1Line->text() );
config.writeEntry( "DialPrefix2", dialPref2Line->text() );
config.writeEntry( "DialSuffix2", dialSuf2Line->text() );
config.writeEntry( "DialPrefix3", dialPref3Line->text() );
diff --git a/noncore/apps/opie-console/keytrans.cpp b/noncore/apps/opie-console/keytrans.cpp
index d569ae0..45a7960 100644
--- a/noncore/apps/opie-console/keytrans.cpp
+++ b/noncore/apps/opie-console/keytrans.cpp
@@ -224,483 +224,482 @@ void KeytabReader::getSymbol()
{
getCc();
switch (cc)
{
case 'E' : sc = 27; getCc(); break;
case 'b' : sc = 8; getCc(); break;
case 'f' : sc = 12; getCc(); break;
case 't' : sc = 9; getCc(); break;
case 'r' : sc = 13; getCc(); break;
case 'n' : sc = 10; getCc(); break;
case '\\' : // fall thru
case '"' : sc = cc; getCc(); break;
case 'x' : getCc();
sc = 0;
if (!isNibble(cc)) return; sc = 16*sc + convNibble(cc); getCc();
if (!isNibble(cc)) return; sc = 16*sc + convNibble(cc); getCc();
break;
default : return;
}
}
else
{
// regular char
sc = cc; getCc();
}
res = res + (char)sc;
len = len + 1;
}
if (cc != '"') return;
getCc();
sym = SYMString; return;
}
}
void KeytabReader::ReportToken() // diagnostic
{
printf("sym(%d): ",slinno);
switch(sym)
{
case SYMEol : printf("End of line"); break;
case SYMEof : printf("End of file"); break;
case SYMName : printf("Name: %s",res.latin1()); break;
case SYMOpr : printf("Opr : %s",res.latin1()); break;
case SYMString : printf("String len %d,%d ",res.length(),len);
for (unsigned i = 0; i < res.length(); i++)
printf(" %02x(%c)",res.latin1()[i],res.latin1()[i]>=' '?res.latin1()[i]:'?');
break;
}
printf("\n");
}
void KeytabReader::ReportError(const char* msg) // diagnostic
{
fprintf(stderr,"%s(%d,%d):error: %s.\n",path.ascii(),slinno,scolno,msg);
}
// local symbol tables ---------------------------------------------------------------------
class KeyTransSymbols
{
public:
KeyTransSymbols();
protected:
void defOprSyms();
void defModSyms();
void defKeySyms();
void defKeySym(const char* key, int val);
void defOprSym(const char* key, int val);
void defModSym(const char* key, int val);
public:
QDict<QObject> keysyms;
QDict<QObject> modsyms;
QDict<QObject> oprsyms;
};
static KeyTransSymbols * syms = 0L;
// parser ----------------------------------------------------------------------------------
/* Syntax
- Line :: [KeyName { ("+" | "-") ModeName } ":" (String|CommandName)] "\n"
- Comment :: '#' (any but \n)*
*/
KeyTrans* KeyTrans::fromDevice(QString path, QIODevice &buf)
{
KeyTrans* kt = new KeyTrans;
kt->path = path;
KeytabReader ktr(path,buf); ktr.parseTo(kt);
return kt;
}
#define assertSyntax(Cond,Message) if (!(Cond)) { ReportError(Message); goto ERROR; }
void KeytabReader::parseTo(KeyTrans* kt)
{
// Opening sequence
buf->open(IO_ReadOnly);
getCc();
linno = 1;
colno = 1;
getSymbol();
Loop:
// syntax: ["key" KeyName { ("+" | "-") ModeName } ":" String/CommandName] ["#" Comment]
if (sym == SYMName && !strcmp(res.latin1(),"keyboard"))
{
getSymbol(); assertSyntax(sym == SYMString, "Header expected")
kt->hdr = res.latin1();
getSymbol(); assertSyntax(sym == SYMEol, "Text unexpected")
getSymbol(); // eoln
goto Loop;
}
if (sym == SYMName && !strcmp(res.latin1(),"key"))
{
//printf("line %3d: ",startofsym);
getSymbol(); assertSyntax(sym == SYMName, "Name expected")
assertSyntax(syms->keysyms[res], "Unknown key name")
int key = (int)syms->keysyms[res]-1;
//printf(" key %s (%04x)",res.latin1(),(int)syms->keysyms[res]-1);
getSymbol(); // + - :
int mode = 0;
int mask = 0;
while (sym == SYMOpr && (!strcmp(res.latin1(),"+") || !strcmp(res.latin1(),"-")))
{
bool on = !strcmp(res.latin1(),"+");
getSymbol();
// mode name
assertSyntax(sym == SYMName, "Name expected")
assertSyntax(syms->modsyms[res], "Unknown mode name")
int bits = (int)syms->modsyms[res]-1;
if (mask & (1 << bits))
{
fprintf(stderr,"%s(%d,%d): mode name used multible times.\n",path.ascii(),slinno,scolno);
}
else
{
mode |= (on << bits);
mask |= (1 << bits);
}
//printf(", mode %s(%d) %s",res.latin1(),(int)syms->modsyms[res]-1,on?"on":"off");
getSymbol();
}
assertSyntax(sym == SYMOpr && !strcmp(res.latin1(),":"), "':' expected")
getSymbol();
// string or command
assertSyntax(sym == SYMName || sym == SYMString,"Command or string expected")
int cmd = 0;
if (sym == SYMName)
{
assertSyntax(syms->oprsyms[res], "Unknown operator name")
cmd = (int)syms->oprsyms[res]-1;
//printf(": do %s(%d)",res.latin1(),(int)syms->oprsyms[res]-1);
}
if (sym == SYMString)
{
cmd = CMD_send;
//printf(": send");
//for (unsigned i = 0; i < res.length(); i++)
//printf(" %02x(%c)",res.latin1()[i],res.latin1()[i]>=' '?res.latin1()[i]:'?');
}
//printf(". summary %04x,%02x,%02x,%d\n",key,mode,mask,cmd);
KeyTrans::KeyEntry* ke = kt->addEntry(slinno,key,mode,mask,cmd,res);
if (ke)
{
fprintf(stderr,"%s(%d): keystroke already assigned in line %d.\n",path.ascii(),slinno,ke->ref);
}
getSymbol();
assertSyntax(sym == SYMEol, "Unexpected text")
goto Loop;
}
if (sym == SYMEol)
{
getSymbol();
goto Loop;
}
assertSyntax(sym == SYMEof, "Undecodable Line")
buf->close();
return;
ERROR:
while (sym != SYMEol && sym != SYMEof) getSymbol(); // eoln
goto Loop;
}
KeyTrans* KeyTrans::defaultKeyTrans()
{
QCString txt =
-#include "default.keytab.h"
+ #include "default.keytab.h"
;
QBuffer buf(txt);
return fromDevice("[buildin]",buf);
}
KeyTrans* KeyTrans::fromFile(const char* path)
{
QFile file(path);
return fromDevice(path,file);
}
// local symbol tables ---------------------------------------------------------------------
// material needed for parsing the config file.
// This is incomplete work.
void KeyTransSymbols::defKeySym(const char* key, int val)
{
keysyms.insert(key,(QObject*)(val+1));
}
void KeyTransSymbols::defOprSym(const char* key, int val)
{
oprsyms.insert(key,(QObject*)(val+1));
}
void KeyTransSymbols::defModSym(const char* key, int val)
{
modsyms.insert(key,(QObject*)(val+1));
}
void KeyTransSymbols::defOprSyms()
{
// Modifier
defOprSym("scrollLineUp", CMD_scrollLineUp );
defOprSym("scrollLineDown",CMD_scrollLineDown);
defOprSym("scrollPageUp", CMD_scrollPageUp );
defOprSym("scrollPageDown",CMD_scrollPageDown);
defOprSym("emitSelection", CMD_emitSelection );
defOprSym("prevSession", CMD_prevSession );
defOprSym("nextSession", CMD_nextSession );
}
void KeyTransSymbols::defModSyms()
{
// Modifier
defModSym("Shift", BITS_Shift );
defModSym("Control", BITS_Control );
defModSym("Alt", BITS_Alt );
// Modes
defModSym("BsHack", BITS_BsHack ); // deprecated
defModSym("Ansi", BITS_Ansi );
defModSym("NewLine", BITS_NewLine );
defModSym("AppCuKeys", BITS_AppCuKeys );
}
void KeyTransSymbols::defKeySyms()
{
// Grey keys
defKeySym("Escape", Qt::Key_Escape );
defKeySym("Tab", Qt::Key_Tab );
defKeySym("Backtab", Qt::Key_Backtab );
defKeySym("Backspace", Qt::Key_Backspace );
defKeySym("Return", Qt::Key_Return );
defKeySym("Enter", Qt::Key_Enter );
defKeySym("Insert", Qt::Key_Insert );
defKeySym("Delete", Qt::Key_Delete );
defKeySym("Pause", Qt::Key_Pause );
defKeySym("Print", Qt::Key_Print );
defKeySym("SysReq", Qt::Key_SysReq );
defKeySym("Home", Qt::Key_Home );
defKeySym("End", Qt::Key_End );
defKeySym("Left", Qt::Key_Left );
defKeySym("Up", Qt::Key_Up );
defKeySym("Right", Qt::Key_Right );
defKeySym("Down", Qt::Key_Down );
defKeySym("Prior", Qt::Key_Prior );
defKeySym("Next", Qt::Key_Next );
defKeySym("Shift", Qt::Key_Shift );
defKeySym("Control", Qt::Key_Control );
defKeySym("Meta", Qt::Key_Meta );
defKeySym("Alt", Qt::Key_Alt );
defKeySym("CapsLock", Qt::Key_CapsLock );
defKeySym("NumLock", Qt::Key_NumLock );
defKeySym("ScrollLock", Qt::Key_ScrollLock );
defKeySym("F1", Qt::Key_F1 );
defKeySym("F2", Qt::Key_F2 );
defKeySym("F3", Qt::Key_F3 );
defKeySym("F4", Qt::Key_F4 );
defKeySym("F5", Qt::Key_F5 );
defKeySym("F6", Qt::Key_F6 );
defKeySym("F7", Qt::Key_F7 );
defKeySym("F8", Qt::Key_F8 );
defKeySym("F9", Qt::Key_F9 );
defKeySym("F10", Qt::Key_F10 );
defKeySym("F11", Qt::Key_F11 );
defKeySym("F12", Qt::Key_F12 );
defKeySym("F13", Qt::Key_F13 );
defKeySym("F14", Qt::Key_F14 );
defKeySym("F15", Qt::Key_F15 );
defKeySym("F16", Qt::Key_F16 );
defKeySym("F17", Qt::Key_F17 );
defKeySym("F18", Qt::Key_F18 );
defKeySym("F19", Qt::Key_F19 );
defKeySym("F20", Qt::Key_F20 );
defKeySym("F21", Qt::Key_F21 );
defKeySym("F22", Qt::Key_F22 );
defKeySym("F23", Qt::Key_F23 );
defKeySym("F24", Qt::Key_F24 );
defKeySym("F25", Qt::Key_F25 );
defKeySym("F26", Qt::Key_F26 );
defKeySym("F27", Qt::Key_F27 );
defKeySym("F28", Qt::Key_F28 );
defKeySym("F29", Qt::Key_F29 );
defKeySym("F30", Qt::Key_F30 );
defKeySym("F31", Qt::Key_F31 );
defKeySym("F32", Qt::Key_F32 );
defKeySym("F33", Qt::Key_F33 );
defKeySym("F34", Qt::Key_F34 );
defKeySym("F35", Qt::Key_F35 );
defKeySym("Super_L", Qt::Key_Super_L );
defKeySym("Super_R", Qt::Key_Super_R );
defKeySym("Menu", Qt::Key_Menu );
defKeySym("Hyper_L", Qt::Key_Hyper_L );
defKeySym("Hyper_R", Qt::Key_Hyper_R );
// Regular keys
defKeySym("Space", Qt::Key_Space );
defKeySym("Exclam", Qt::Key_Exclam );
defKeySym("QuoteDbl", Qt::Key_QuoteDbl );
defKeySym("NumberSign", Qt::Key_NumberSign );
defKeySym("Dollar", Qt::Key_Dollar );
defKeySym("Percent", Qt::Key_Percent );
defKeySym("Ampersand", Qt::Key_Ampersand );
defKeySym("Apostrophe", Qt::Key_Apostrophe );
defKeySym("ParenLeft", Qt::Key_ParenLeft );
defKeySym("ParenRight", Qt::Key_ParenRight );
defKeySym("Asterisk", Qt::Key_Asterisk );
defKeySym("Plus", Qt::Key_Plus );
defKeySym("Comma", Qt::Key_Comma );
defKeySym("Minus", Qt::Key_Minus );
defKeySym("Period", Qt::Key_Period );
defKeySym("Slash", Qt::Key_Slash );
defKeySym("0", Qt::Key_0 );
defKeySym("1", Qt::Key_1 );
defKeySym("2", Qt::Key_2 );
defKeySym("3", Qt::Key_3 );
defKeySym("4", Qt::Key_4 );
defKeySym("5", Qt::Key_5 );
defKeySym("6", Qt::Key_6 );
defKeySym("7", Qt::Key_7 );
defKeySym("8", Qt::Key_8 );
defKeySym("9", Qt::Key_9 );
defKeySym("Colon", Qt::Key_Colon );
defKeySym("Semicolon", Qt::Key_Semicolon );
defKeySym("Less", Qt::Key_Less );
defKeySym("Equal", Qt::Key_Equal );
defKeySym("Greater", Qt::Key_Greater );
defKeySym("Question", Qt::Key_Question );
defKeySym("At", Qt::Key_At );
defKeySym("A", Qt::Key_A );
defKeySym("B", Qt::Key_B );
defKeySym("C", Qt::Key_C );
defKeySym("D", Qt::Key_D );
defKeySym("E", Qt::Key_E );
defKeySym("F", Qt::Key_F );
defKeySym("G", Qt::Key_G );
defKeySym("H", Qt::Key_H );
defKeySym("I", Qt::Key_I );
defKeySym("J", Qt::Key_J );
defKeySym("K", Qt::Key_K );
defKeySym("L", Qt::Key_L );
defKeySym("M", Qt::Key_M );
defKeySym("N", Qt::Key_N );
defKeySym("O", Qt::Key_O );
defKeySym("P", Qt::Key_P );
defKeySym("Q", Qt::Key_Q );
defKeySym("R", Qt::Key_R );
defKeySym("S", Qt::Key_S );
defKeySym("T", Qt::Key_T );
defKeySym("U", Qt::Key_U );
defKeySym("V", Qt::Key_V );
defKeySym("W", Qt::Key_W );
defKeySym("X", Qt::Key_X );
defKeySym("Y", Qt::Key_Y );
defKeySym("Z", Qt::Key_Z );
defKeySym("BracketLeft", Qt::Key_BracketLeft );
defKeySym("Backslash", Qt::Key_Backslash );
defKeySym("BracketRight", Qt::Key_BracketRight);
defKeySym("AsciiCircum", Qt::Key_AsciiCircum );
defKeySym("Underscore", Qt::Key_Underscore );
defKeySym("QuoteLeft", Qt::Key_QuoteLeft );
defKeySym("BraceLeft", Qt::Key_BraceLeft );
defKeySym("Bar", Qt::Key_Bar );
defKeySym("BraceRight", Qt::Key_BraceRight );
defKeySym("AsciiTilde", Qt::Key_AsciiTilde );
}
KeyTransSymbols::KeyTransSymbols()
{
defModSyms();
defOprSyms();
defKeySyms();
}
// Global material -----------------------------------------------------------
static int keytab_serial = 0; //FIXME: remove,localize
static QIntDict<KeyTrans> * numb2keymap = 0L;
static QDict<KeyTrans> * path2keymap = 0L;
KeyTrans* KeyTrans::find(int numb)
{
KeyTrans* res = numb2keymap->find(numb);
return res ? res : numb2keymap->find(0);
}
KeyTrans* KeyTrans::find(const char* path)
{
KeyTrans* res = path2keymap->find(path);
return res ? res : numb2keymap->find(0);
}
int KeyTrans::count()
{
return numb2keymap->count();
}
void KeyTrans::addKeyTrans()
{
this->numb = keytab_serial ++;
numb2keymap->insert(numb,this);
path2keymap->insert(path,this);
}
void KeyTrans::loadAll()
{
if (!numb2keymap)
numb2keymap = new QIntDict<KeyTrans>;
if (!path2keymap)
path2keymap = new QDict<KeyTrans>;
if (!syms)
syms = new KeyTransSymbols;
defaultKeyTrans()->addKeyTrans();
QString path = QPEApplication::qpeDir() + "etc/keytabs";
QDir dir(path);
QStringList lst = dir.entryList("*.keytab");
for(QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
QFile file(path + "/" + *it);
KeyTrans* sc = KeyTrans::fromDevice(*it, file);
if (sc) {
sc->addKeyTrans();
}
}
}
// Debugging material -----------------------------------------------------------
/*
void TestTokenizer(QBuffer &buf)
{
// opening sequence
buf.open(IO_ReadOnly);
cc = buf.getch();
lineno = 1;
// Test tokenizer
while (getSymbol(buf)) ReportToken();
buf.close();
}
void test()
{
// Opening sequence
QCString txt =
-#include "default.keytab.h"
;
QBuffer buf(txt);
if (0) TestTokenizer(buf);
if (1) { KeyTrans kt; kt.scanTable(buf); }
}
*/
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 0a475d8..1d2385f 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,203 +1,202 @@
#include <assert.h>
#include <qaction.h>
#include <qmenubar.h>
#include <qtoolbar.h>
#include <qmessagebox.h>
#include <qwhatsthis.h>
#include <qfileinfo.h>
#include <qpe/filemanager.h>
-#include <qpe/qpeapplication.h>
#include <opie2/ofiledialog.h>
#include "TEmulation.h"
#include "profileeditordialog.h"
#include "configdialog.h"
#include "default.h"
#include "profilemanager.h"
#include "mainwindow.h"
#include "tabwidget.h"
#include "transferdialog.h"
#include "function_keyboard.h"
#include "emulation_handler.h"
#include "script.h"
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
KeyTrans::loadAll();
for (int i = 0; i < KeyTrans::count(); i++ ) {
KeyTrans* s = KeyTrans::find(i );
assert( s );
}
m_factory = new MetaFactory();
Default def(m_factory);
m_sessions.setAutoDelete( TRUE );
m_curSession = 0;
m_manager = new ProfileManager( m_factory );
m_manager->load();
m_scriptsData.setAutoDelete(TRUE);
initUI();
populateProfiles();
populateScripts();
}
void MainWindow::initUI() {
setToolBarsMovable( FALSE );
/* tool bar for the menu */
m_tool = new QToolBar( this );
m_tool->setHorizontalStretchable( TRUE );
m_bar = new QMenuBar( m_tool );
m_console = new QPopupMenu( this );
m_scripts = new QPopupMenu( this );
m_sessionsPop= new QPopupMenu( this );
m_scriptsPop = new QPopupMenu( this );
/* add a toolbar for icons */
m_icons = new QToolBar(this);
/*
* the settings action
*/
m_setProfiles = new QAction(tr("Configure Profiles"),
Resource::loadPixmap( "SettingsIcon" ),
QString::null, 0, this, 0);
m_setProfiles->addTo( m_console );
connect( m_setProfiles, SIGNAL(activated() ),
this, SLOT(slotConfigure() ) );
m_console->insertSeparator();
/*
* new Action for new sessions
*/
QAction* newCon = new QAction(tr("New Profile"),
Resource::loadPixmap( "new" ),
QString::null, 0, this, 0);
newCon->addTo( m_console );
connect( newCon, SIGNAL(activated() ),
this, SLOT(slotNew() ) );
m_console->insertSeparator();
QAction *saveCon = new QAction( tr("Save Profile" ),
Resource::loadPixmap( "save" ), QString::null,
0, this, 0 );
saveCon->addTo( m_console );
connect( saveCon, SIGNAL(activated() ),
this, SLOT(slotSaveSession() ) );
m_console->insertSeparator();
/*
* connect action
*/
m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"),
QString::null, 0, this, 0 );
m_connect->addTo( m_console );
connect(m_connect, SIGNAL(activated() ),
this, SLOT(slotConnect() ) );
/*
* disconnect action
*/
m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"),
QString::null, 0, this, 0 );
m_disconnect->addTo( m_console );
connect(m_disconnect, SIGNAL(activated() ),
this, SLOT(slotDisconnect() ) );
m_console->insertSeparator();
m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 );
m_quickLaunch->addTo( m_icons );
connect( m_quickLaunch, SIGNAL( activated() ),
this, SLOT( slotQuickLaunch() ) );
QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) );
m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null,
0, this, 0 );
m_transfer->addTo( m_console );
connect(m_transfer, SIGNAL(activated() ),
this, SLOT(slotTransfer() ) );
/*
* immediate change of line wrap policy
*/
m_isWrapped = false;
m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 );
m_wrap->addTo( m_console );
connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) );
/*
* fullscreen
*/
m_isFullscreen = false;
m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
, QString::null, 0, this, 0);
m_fullscreen->addTo( m_console );
connect( m_fullscreen, SIGNAL( activated() ),
this, SLOT( slotFullscreen() ) );
m_console->insertSeparator();
QAction *a = new QAction();
a->setText( tr("Save history") );
a->addTo( m_console );
connect(a, SIGNAL(activated() ),
this, SLOT(slotSaveHistory() ) );
/*
* terminate action
*/
m_terminate = new QAction();
m_terminate->setText( tr("Terminate") );
m_terminate->addTo( m_console );
connect(m_terminate, SIGNAL(activated() ),
this, SLOT(slotTerminate() ) );
m_closewindow = new QAction();
m_closewindow->setText( tr("Close Window") );
m_closewindow->addTo( m_console );
connect( m_closewindow, SIGNAL(activated() ),
this, SLOT(slotClose() ) );
/*
* script actions
*/
m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0);
connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int)));
m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
m_recordScript->addTo(m_scripts);
connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
m_saveScript->addTo(m_scripts);
connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
/*
* action that open/closes the keyboard
*/
m_openKeys = new QAction (tr("Open Keyboard..."),
Resource::loadPixmap( "console/keys/keyboard_icon" ),
QString::null, 0, this, 0);
m_openKeys->setToggleAction(true);
connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool)));
/* insert the submenu */
m_console->insertItem(tr("New from Profile"), m_sessionsPop,
-1, 0);
/* insert the connection menu */
m_bar->insertItem( tr("Connection"), m_console );