46 files changed, 336 insertions, 367 deletions
diff --git a/noncore/apps/advancedfm/filePermissions.cpp b/noncore/apps/advancedfm/filePermissions.cpp index c06f14f..4de6d12 100644 --- a/noncore/apps/advancedfm/filePermissions.cpp +++ b/noncore/apps/advancedfm/filePermissions.cpp @@ -1,274 +1,270 @@ /**************************************************************************** ** copyright 2002 ljp ljp@llornkcor.com ** Created: Sat Feb 23 19:44:40 2002 L.J. Potter ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #include "filePermissions.h" -#include <qfile.h> #include <qfileinfo.h> #include <qcheckbox.h> #include <qlabel.h> #include <qlineedit.h> -#include <qlayout.h> -#include <qvariant.h> -#include <qtooltip.h> #include <qmessagebox.h> #include <unistd.h> #include <sys/stat.h> -#include <stdlib.h> +#include <stdlib.h> #include <sys/types.h> #include <pwd.h> #include <grp.h> filePermissions::filePermissions( QWidget* parent, const char* name, bool modal, WFlags fl, const QString &fileName ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "filePermissions" ); // qDebug("FilePermissions "+fileName); /* resize( 236, 210 ); setMaximumSize( QSize( 236, 210 ) ); */ setCaption( tr( "Set File Permissions" ) ); TextLabel1 = new QLabel( this, "TextLabel1" ); TextLabel1->setGeometry( QRect( 25, 5, 175, 20 ) ); TextLabel1->setText( tr( "Set file permissions for:" ) ); LineEdit1 = new QLineEdit( this, "LineEdit1" ); LineEdit1->setGeometry( QRect( 10, 25, 218, 22 ) ); LineEdit1->setReadOnly(true); TextLabel4 = new QLabel( this, "TextLabel4" ); TextLabel4->setGeometry( QRect( 5, 85, 50, 15 ) ); TextLabel4->setText( tr( "owner" ) ); TextLabel4_2 = new QLabel( this, "TextLabel4_2" ); TextLabel4_2->setGeometry( QRect( 5, 105, 50, 15 ) ); TextLabel4_2->setText( tr( "group" ) ); TextLabel4_3 = new QLabel( this, "TextLabel4_3" ); TextLabel4_3->setGeometry( QRect( 5, 125, 50, 15 ) ); TextLabel4_3->setText( tr( "others" ) ); CheckBox1 = new QCheckBox( this, "CheckBox1" ); CheckBox1->setGeometry( QRect( 75, 85, 20, 16 ) ); connect(CheckBox1, SIGNAL(released()),this,SLOT(ownReadCheck())); CheckBox1_2 = new QCheckBox( this, "CheckBox1_2" ); CheckBox1_2->setGeometry( QRect( 135, 85, 20, 16 ) ); connect(CheckBox1_2, SIGNAL(released()),this,SLOT(ownWriteCheck())); CheckBox1_3 = new QCheckBox( this, "CheckBox1_3" ); - CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) ); + CheckBox1_3->setGeometry( QRect( 195, 85, 20, 16 ) ); connect(CheckBox1_3, SIGNAL(released()),this,SLOT(ownExeCheck())); CheckBox1_4 = new QCheckBox( this, "CheckBox1_4" ); - CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) ); + CheckBox1_4->setGeometry( QRect( 75, 105, 20, 16 ) ); connect(CheckBox1_4, SIGNAL(released()),this,SLOT(grpReadCheck())); CheckBox1_5 = new QCheckBox( this, "CheckBox1_5" ); - CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) ); + CheckBox1_5->setGeometry( QRect( 135, 105, 20, 16 ) ); connect(CheckBox1_5, SIGNAL(released()),this,SLOT(grpWriteCheck())); CheckBox1_6 = new QCheckBox( this, "CheckBox1_6" ); - CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) ); + CheckBox1_6->setGeometry( QRect( 195, 105, 20, 16 ) ); connect(CheckBox1_6, SIGNAL(released()),this,SLOT(grpExeCheck())); CheckBox1_7 = new QCheckBox( this, "CheckBox1_7" ); - CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) ); + CheckBox1_7->setGeometry( QRect( 75, 125, 16, 16 ) ); connect(CheckBox1_7, SIGNAL(released()),this,SLOT(wrldReadCheck())); CheckBox1_8 = new QCheckBox( this, "CheckBox1_8" ); CheckBox1_8->setGeometry( QRect( 135, 125, 20, 16 ) ); connect(CheckBox1_8, SIGNAL(released()),this,SLOT(wrldWriteCheck())); CheckBox1_8_2 = new QCheckBox( this, "CheckBox1_8_2" ); - CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) ); + CheckBox1_8_2->setGeometry( QRect( 195, 125, 20, 16 ) ); connect(CheckBox1_8_2, SIGNAL(released()),this,SLOT(wrldExeCheck())); GroupLineEdit = new QLineEdit( this, "GroupLineEdit" ); - GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) ); + GroupLineEdit->setGeometry( QRect( 125, 155, 106, 22 ) ); OwnerLineEdit = new QLineEdit( this, "OwnerLineEdit" ); - OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) ); + OwnerLineEdit->setGeometry( QRect( 10, 155, 106, 22 ) ); TextLabel5 = new QLabel( this, "TextLabel5" ); - TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) ); + TextLabel5->setGeometry( QRect( 45, 180, 40, 16 ) ); TextLabel5->setText( tr( "Owner" ) ); TextLabel5_2 = new QLabel( this, "TextLabel5_2" ); - TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) ); + TextLabel5_2->setGeometry( QRect( 155, 180, 40, 16 ) ); TextLabel5_2->setText( tr( "Group" ) ); ModeLine = new QLineEdit( this, "TextLabelMode" ); - ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) ); + ModeLine->setGeometry( QRect( 10, 60, 40, 15 ) ); TextLabel3_2 = new QLabel( this, "TextLabel3_2" ); - TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) ); + TextLabel3_2->setGeometry( QRect( 60, 55, 50, 20 ) ); TextLabel3_2->setText( tr( "read" ) ); TextLabel3_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); TextLabel3_2_2 = new QLabel( this, "TextLabel3_2_2" ); - TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) ); + TextLabel3_2_2->setGeometry( QRect( 120, 55, 50, 20 ) ); TextLabel3_2_2->setText( tr( "write" ) ); TextLabel3_2_2->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); TextLabel3 = new QLabel( this, "TextLabel3" ); - TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) ); + TextLabel3->setGeometry( QRect( 180, 55, 50, 20 ) ); TextLabel3->setText( tr( "execute" ) ); TextLabel3->setAlignment( int( QLabel::AlignBottom | QLabel::AlignHCenter ) ); struct stat buf; mode_t mode; file = fileName; QFileInfo fi(file); LineEdit1->setText( file); OwnerLineEdit->setText( fi.owner()); GroupLineEdit->setText( fi.group()); if( fi.permission( QFileInfo::ReadUser)) { CheckBox1->setChecked(true); } if( fi.permission( QFileInfo::WriteUser)) { CheckBox1_2->setChecked(true); } if( fi.permission( QFileInfo::ExeUser)) { CheckBox1_3->setChecked(true); } if( fi.permission( QFileInfo::ReadGroup)) { CheckBox1_4->setChecked(true); } if( fi.permission( QFileInfo::WriteGroup)) { CheckBox1_5->setChecked(true); } if( fi.permission( QFileInfo::ExeGroup)) { CheckBox1_6->setChecked(true); } if( fi.permission( QFileInfo::ReadOther)) { CheckBox1_7->setChecked(true); } if( fi.permission( QFileInfo::WriteOther)) { CheckBox1_8->setChecked(true); } if( fi.permission( QFileInfo::ExeOther)) { CheckBox1_8_2->setChecked(true); } - + stat(file.latin1(), &buf); mode = buf.st_mode; modeStr.sprintf("%#o", buf.st_mode & ~(S_IFMT) ); ModeLine->setText(modeStr); bool ok; i_mode = modeStr.toInt(&ok,10); - + } -/* +/* * Destroys the object and frees any allocated resources */ filePermissions::~filePermissions() { } // might this be better as a callback routine??? void filePermissions::ownReadCheck() { if(CheckBox1->isChecked()) { i_mode +=400; } else i_mode -=400; modeStr.sprintf("0%d",i_mode); ModeLine->setText( modeStr); // 0400 } void filePermissions::ownWriteCheck() { if(CheckBox1_2->isChecked()) { i_mode +=200; } else i_mode -=200; modeStr.sprintf("0%d",i_mode); ModeLine->setText(modeStr); // 0200 } void filePermissions::ownExeCheck() { if(CheckBox1_3->isChecked()) { i_mode +=100; } else i_mode -=100; modeStr.sprintf("0%d",i_mode); ModeLine->setText(modeStr); // 0100 } void filePermissions::grpReadCheck() { if(CheckBox1_4->isChecked()) { i_mode +=40; } else i_mode -=40; modeStr.sprintf("0%d",i_mode); ModeLine->setText(modeStr); // 0040 } void filePermissions::grpWriteCheck() { if(CheckBox1_5->isChecked()) { i_mode +=20; } else i_mode -=20; modeStr.sprintf("0%d",i_mode); ModeLine->setText(modeStr); // 0020 } void filePermissions::grpExeCheck() { if(CheckBox1_6->isChecked()) { i_mode +=10; } else i_mode -=10; modeStr.sprintf("0%d",i_mode); ModeLine->setText(modeStr); // 0010 } void filePermissions::wrldReadCheck() { if(CheckBox1_7->isChecked()) { i_mode +=4; } else i_mode -=4; modeStr.sprintf("0%d",i_mode); ModeLine->setText(modeStr); // 0004 } void filePermissions::wrldWriteCheck() { if(CheckBox1_8->isChecked()) { i_mode +=2; } else i_mode -=2; modeStr.sprintf("0%d",i_mode); ModeLine->setText(modeStr); // 0002 } void filePermissions::wrldExeCheck() { if(CheckBox1_8_2->isChecked()) { i_mode +=1; } else i_mode -=1; modeStr.sprintf("0%d",i_mode); ModeLine->setText(modeStr); // 0001 } void filePermissions::accept() { QFileInfo fi(file); struct passwd *pwd=0; struct group *grp=0; pwd = getpwnam(OwnerLineEdit->text().latin1() ); if(pwd == NULL) { perror("getpwnam"); - QMessageBox::warning(this,"Warning","Error- no user"); + QMessageBox::warning(this,tr("Warning"),tr("Error- no user") ); return; } else { grp = getgrnam(GroupLineEdit->text().latin1()); if(grp==NULL) { perror("getgrnam"); - QMessageBox::warning(this,"Warning","Error- no group"); + QMessageBox::warning(this,tr("Warning"),tr("Error- no group")); return; } if( chown( file.latin1(), pwd->pw_uid, grp->gr_gid) <0) { perror("chown"); - QMessageBox::warning(this,"Warning","Error setting ownership or group"); + QMessageBox::warning(this,tr("Warning"),tr("Error setting ownership or group") ); return; } bool ok; uint moder = modeStr.toUInt(&ok,8); if( chmod( file.latin1(), moder) < 0) { perror("chmod"); - QMessageBox::warning(this,"Warning","Error setting mode"); + QMessageBox::warning(this,tr("Warning"),tr("Error setting mode") ); return; } } close(); } diff --git a/noncore/apps/advancedfm/main.cpp b/noncore/apps/advancedfm/main.cpp index a0401e8..8cacc4a 100644 --- a/noncore/apps/advancedfm/main.cpp +++ b/noncore/apps/advancedfm/main.cpp @@ -1,31 +1,27 @@ /*************************************************************************** main.cpp - description ------------------- begin : March 10, 2002 copyright : (C) 2002 by llornkcor email : ljp@llornkcor.com * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * ***************************************************************************/ #include <qpe/qpeapplication.h> -#include <qpe/qcopenvelope_qws.h> -#include <qpe/config.h> -#include <qstring.h> -#include <qstringlist.h> #include "advancedfm.h" int main(int argc, char *argv[]) { QPEApplication a(argc, argv); AdvancedFm advencedFm; a.showMainWidget( &advencedFm); return a.exec(); } diff --git a/noncore/apps/advancedfm/opie-advancedfm.control b/noncore/apps/advancedfm/opie-advancedfm.control index f17c590..1e0f9ec 100644 --- a/noncore/apps/advancedfm/opie-advancedfm.control +++ b/noncore/apps/advancedfm/opie-advancedfm.control @@ -1,10 +1,10 @@ Package: opie-advancedfm Files: bin/advancedfm apps/Applications/advancedfm.desktop pics/advancedfm Priority: optional Section: opie/applications Maintainer: L.J. Potter <ljp@llornkcor.com> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal Description: Advanced File Manager The advanced file manager for the Opie environment. +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/advancedfm/output.cpp b/noncore/apps/advancedfm/output.cpp index a60cea6..33abdfc 100644 --- a/noncore/apps/advancedfm/output.cpp +++ b/noncore/apps/advancedfm/output.cpp @@ -1,284 +1,278 @@ /**************************************************************************** ** outputEdit.cpp ** ** Copyright: Fri Apr 12 15:12:58 2002 L.J. Potter <ljp@llornkcor.com> ****************************************************************************/ #include "output.h" #include <opie/oprocess.h> -#include <qpe/filemanager.h> #include <qpe/qpeapplication.h> #include <qpe/applnk.h> -#include <qmessagebox.h> -#include <qstringlist.h> #include <qfile.h> -#include <qcstring.h> -#include <qlineedit.h> #include <qmultilineedit.h> #include <qpushbutton.h> #include <qlayout.h> -#include <qvariant.h> #include <errno.h> /* XPM */ static char * filesave_xpm[] = { "16 16 78 1", " c None", ". c #343434", "+ c #A0A0A0", "@ c #565656", "# c #9E9E9E", "$ c #525252", "% c #929292", "& c #676767", "* c #848484", "= c #666666", "- c #D8D8D8", "; c #FFFFFF", "> c #DBDBDB", ", c #636363", "' c #989898", ") c #2D2D2D", "! c #909090", "~ c #AEAEAE", "{ c #EAEAEA", "] c #575757", "^ c #585858", "/ c #8A8A8A", "( c #828282", "_ c #6F6F6F", ": c #C9C9C9", "< c #050505", "[ c #292929", "} c #777777", "| c #616161", "1 c #3A3A3A", "2 c #BEBEBE", "3 c #2C2C2C", "4 c #7C7C7C", "5 c #F6F6F6", "6 c #FCFCFC", "7 c #6B6B6B", "8 c #959595", "9 c #4F4F4F", "0 c #808080", "a c #767676", "b c #818181", "c c #B8B8B8", "d c #FBFBFB", "e c #F9F9F9", "f c #CCCCCC", "g c #030303", "h c #737373", "i c #7A7A7A", "j c #7E7E7E", "k c #6A6A6A", "l c #FAFAFA", "m c #505050", "n c #9D9D9D", "o c #333333", "p c #7B7B7B", "q c #787878", "r c #696969", "s c #494949", "t c #555555", "u c #949494", "v c #E6E6E6", "w c #424242", "x c #515151", "y c #535353", "z c #3E3E3E", "A c #D4D4D4", "B c #0C0C0C", "C c #353535", "D c #474747", "E c #ECECEC", "F c #919191", "G c #7D7D7D", "H c #000000", "I c #404040", "J c #858585", "K c #323232", "L c #D0D0D0", "M c #1C1C1C", " ...+ ", " @#$%&..+ ", " .*=-;;>,..+ ", " ')!~;;;;;;{]..", " ^/(-;;;;;;;_:<", " [}|;;;;;;;{12$", " #34-55;;;;678$+", " 90ab=c;dd;e1fg ", " [ahij((kbl0mn$ ", " op^q^^7r&]s/$+ ", "@btu;vbwxy]zAB ", "CzDEvEv;;DssF$ ", "G.H{E{E{IxsJ$+ ", " +...vEKxzLM ", " +...z]n$ ", " +... "}; Output::Output( const QStringList commands, QWidget* parent, const char* name, bool modal, WFlags fl) : QDialog( parent, name, modal, fl ) { QStringList cmmds; // cmmds=QStringList::split( " ", commands, false); cmmds=commands; -// qDebug("count %d", cmmds.count()); +// qDebug("count %d", cmmds.count()); if ( !name ) setName( tr("Output")); - resize( 196, 269 ); + resize( 196, 269 ); setCaption( name ); - OutputLayout = new QGridLayout( this ); + OutputLayout = new QGridLayout( this ); OutputLayout->setSpacing( 2); OutputLayout->setMargin( 2); QPushButton *docButton; docButton = new QPushButton( QPixmap(( const char** ) filesave_xpm ) ,"",this,"saveButton"); docButton->setFixedSize( QSize( 20, 20 ) ); connect( docButton,SIGNAL(released()),this,SLOT( saveOutput() )); // docButton->setFlat(TRUE); OutputLayout->addMultiCellWidget( docButton, 0,0,3,3 ); OutputEdit = new QMultiLineEdit( this, "OutputEdit" ); OutputLayout->addMultiCellWidget( OutputEdit, 1,1,0,3 ); proc = new OProcess(); connect(proc, SIGNAL(processExited(OProcess *)), this, SLOT( processFinished())); connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), this, SLOT(commandStdout(OProcess *, char *, int))); connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), this, SLOT(commandStderr(OProcess *, char *, int))); // connect( , SIGNAL(received(const QByteArray &)), // this, SLOT(commandStdin(const QByteArray &))); -// * proc << commands.latin1(); +// * proc << commands.latin1(); for ( QStringList::Iterator it = cmmds.begin(); it != cmmds.end(); ++it ) { qDebug( "%s", (*it).latin1() ); * proc << (*it).latin1(); } if(!proc->start(OProcess::NotifyOnExit, OProcess::All)) { - OutputEdit->append("Process could not start"); + OutputEdit->append(tr("Process could not start") ); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); perror("Error: "); - QString errorMsg="Error\n"+(QString)strerror(errno); + QString errorMsg=tr("Error\n")+(QString)strerror(errno); OutputEdit->append( errorMsg); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); } } Output::~Output() { } void Output::saveOutput() { InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Save output to file (name only)"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { - QString filename = QPEApplication::documentDir(); + QString filename = QPEApplication::documentDir(); if(filename.right(1).find('/') == -1) filename+="/"; QString name = fileDlg->LineEdit1->text(); filename+="text/plain/"+name; qDebug(filename); QFile f(filename); f.open( IO_WriteOnly); if( f.writeBlock( OutputEdit->text(), qstrlen( OutputEdit->text()) ) != -1) { DocLnk lnk; lnk.setName(name); //sets file name lnk.setFile(filename); //sets File property lnk.setType("text/plain"); if(!lnk.writeLink()) { qDebug("Writing doclink did not work"); } } else qWarning("Could not write file"); f.close(); } } void Output::commandStdout(OProcess*, char *buffer, int buflen) { qWarning("received stdout %d bytes", buflen); // QByteArray data(buflen); // data.fill(*buffer, buflen); // for (uint i = 0; i < data.count(); i++ ) { // printf("%c", buffer[i] ); // } // printf("\n"); QString lineStr = buffer; lineStr=lineStr.left(lineStr.length()-1); OutputEdit->append(lineStr); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); } void Output::commandStdin( const QByteArray &data) { qWarning("received stdin %d bytes", data.size()); // recieved data from the io layer goes to sz proc->writeStdin(data.data(), data.size()); } void Output::commandStderr(OProcess*, char *buffer, int buflen) { qWarning("received stderrt %d bytes", buflen); QString lineStr = buffer; // lineStr=lineStr.left(lineStr.length()-1); OutputEdit->append(lineStr); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); } void Output::processFinished() { delete proc; - OutputEdit->append( "\nFinished\n"); + OutputEdit->append( tr("\nFinished\n") ); OutputEdit->setCursorPosition( OutputEdit->numLines() + 1,0,FALSE); // close(); // disconnect( layer(), SIGNAL(received(const QByteArray &)), // this, SLOT(commandStdin(const QByteArray &))); } //============================== InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "InputDialog" ); - resize( 234, 50 ); + resize( 234, 50 ); setMaximumSize( QSize( 240, 50 ) ); setCaption( tr(name ) ); LineEdit1 = new QLineEdit( this, "LineEdit1" ); LineEdit1->setGeometry( QRect( 10, 10, 216, 22 ) ); LineEdit1->setFocus(); LineEdit1->setFocus(); connect(LineEdit1,SIGNAL(returnPressed()),this,SLOT(returned() )); } InputDialog::~InputDialog() { inputText = LineEdit1->text(); } void InputDialog::setInputText(const QString &string) { LineEdit1->setText( string); } void InputDialog::returned() { inputText = LineEdit1->text(); this->accept(); } diff --git a/noncore/apps/checkbook/opie-checkbook.control b/noncore/apps/checkbook/opie-checkbook.control index c0061e5..78f303c 100644 --- a/noncore/apps/checkbook/opie-checkbook.control +++ b/noncore/apps/checkbook/opie-checkbook.control @@ -1,10 +1,10 @@ Package: opie-checkbook Files: bin/checkbook apps/Applications/checkbook.desktop pics/checkbook Priority: optional Section: applications Maintainer: Dan Williams <drw@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal, libopie1 Description: Checkbook keeping program. The checkbook accounting program for the Opie environment. +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp index 0bc6588..53b3853 100644 --- a/noncore/apps/opie-console/configdialog.cpp +++ b/noncore/apps/opie-console/configdialog.cpp @@ -14,101 +14,101 @@ public: Profile profile()const; private: Profile m_prof; }; ConfigListItem::ConfigListItem( QListView* item, const Profile& prof ) : QListViewItem( item ), m_prof( prof ) { setText(0, prof.name() ); } ConfigListItem::~ConfigListItem() { } Profile ConfigListItem::profile()const { return m_prof; } /* Dialog */ ConfigDialog::ConfigDialog( const Profile::ValueList& lis, MetaFactory* fa, QWidget* parent ) : ConfigureBase( parent, 0, TRUE ), m_fact( fa ) { //init(); { Profile::ValueList::ConstIterator it; for (it = lis.begin(); it != lis.end(); ++it ) { new ConfigListItem( lstView, (*it) ); } } } ConfigDialog::~ConfigDialog() { } Profile::ValueList ConfigDialog::list()const { /* iterate over the list */ Profile::ValueList lst; QListViewItemIterator it(lstView); for ( ; it.current(); ++it ) { ConfigListItem* item = (ConfigListItem*)it.current(); lst.append( item->profile() ); } return lst; } /* our slots */ void ConfigDialog::slotRemove() { ConfigListItem* item = (ConfigListItem*)lstView->currentItem(); if (!item ) return; lstView->takeItem( item ); delete item; } void ConfigDialog::slotEdit() { Profile p; if(!lstView->currentItem()) return; // Load profile p = ((ConfigListItem*)lstView->currentItem())->profile(); ProfileEditorDialog dlg(m_fact, p); - dlg.setCaption("Edit Connection Profile"); + dlg.setCaption(tr("Edit Connection Profile")); dlg.showMaximized(); int ret = dlg.exec(); if(ret == QDialog::Accepted) { if(lstView->currentItem()) delete lstView->currentItem(); // use dlg.terminal()! Profile p = dlg.profile(); new ConfigListItem(lstView, p); } } void ConfigDialog::slotAdd() { ProfileEditorDialog dlg(m_fact); - dlg.setCaption("New Connection"); + dlg.setCaption(tr("New Connection")); dlg.showMaximized(); int ret = dlg.exec(); if(ret == QDialog::Accepted) { // TODO: Move into general profile save part // assignments //QString type = dlg.term_type(); //if(type == "VT102") profile = Profile::VT102; // get profile from editor Profile p = dlg.profile(); new ConfigListItem(lstView, p); } } diff --git a/noncore/apps/opie-console/consoleconfigwidget.cpp b/noncore/apps/opie-console/consoleconfigwidget.cpp index 3f2d154..faedc58 100644 --- a/noncore/apps/opie-console/consoleconfigwidget.cpp +++ b/noncore/apps/opie-console/consoleconfigwidget.cpp @@ -1,100 +1,111 @@ #include <qlabel.h> #include <qlayout.h> #include <qcombobox.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qlistview.h> #include <qhbox.h> #include <qregexp.h> #include <stdio.h> +#include <pwd.h> +#include <sys/types.h> + + #include "consoleconfigwidget.h" ConsoleConfigWidget::ConsoleConfigWidget( const QString& name, QWidget* parent, const char* na ) : ProfileDialogConnectionWidget( name, parent, na ) { m_lay = new QVBoxLayout( this ); QLabel *label = new QLabel(tr("Command to execute"), this); m_lay->addWidget(label); m_cmd = new QLineEdit(this); m_lay->addWidget(m_cmd); label = new QLabel(tr("Environment Variables"), this); m_lay->addWidget(label); m_env = new QListView(this); m_env->addColumn(tr("Name")); m_env->addColumn(tr("Value")); m_lay->addWidget(m_env); QHBox *hbox = new QHBox(this); label = new QLabel(tr("Name :"), hbox); m_name = new QLineEdit(hbox); m_lay->addWidget(hbox); hbox = new QHBox(this); label = new QLabel(tr("Value :"), hbox); m_value = new QLineEdit(hbox); m_lay->addWidget(hbox); hbox = new QHBox(this); hbox->setSpacing(10); m_remove = new QPushButton(tr("Remove"), hbox); connect(m_remove, SIGNAL(clicked()), this, SLOT(slotRemove())); m_add = new QPushButton(tr("Add"), hbox); connect(m_add, SIGNAL(clicked()), this, SLOT(slotAdd())); m_lay->addWidget(hbox); } void ConsoleConfigWidget::slotAdd() { if (!(m_name->text().isEmpty() || m_value->text().isEmpty())) { QListViewItem *item = new QListViewItem(m_env); item->setText(0, m_name->text()); item->setText(1, m_value->text()); m_env->insertItem(item); } } void ConsoleConfigWidget::slotRemove() { QListViewItem *item = m_env->currentItem(); if (item) { m_env->takeItem(item); } } ConsoleConfigWidget::~ConsoleConfigWidget() { } void ConsoleConfigWidget::load( const Profile& prof ) { /* - * we will use /bin/bash as default - * but will fallback in MyPty to /bin/sh - * if necessary + * default to the users default shell */ - m_cmd->setText(prof.readEntry("Command", "/bin/bash")); + struct passwd *ent = 0; + char *shell = "/bin/sh"; + + while ( (ent = getpwent()) != 0 ) { + if (ent->pw_shell != "") { + shell = ent->pw_shell; + } + } + + m_cmd->setText(prof.readEntry("Command", shell )); int envcount = prof.readNumEntry("EnvVars", 0); for (int i=0; i<envcount; i++) { QString name = prof.readEntry("Env_Name_" + QString::number(i), ""); QString value = prof.readEntry("Env_Value_" + QString::number(i), ""); if (!(name.isEmpty() || value.isEmpty())) { QListViewItem *item = new QListViewItem(m_env); item->setText(0, name); item->setText(1, value); m_env->insertItem(item); } } } void ConsoleConfigWidget::save( Profile& prof ) { prof.writeEntry( "Command", m_cmd->text()); QListViewItem *item = m_env->firstChild(); int counter = 0; while (item) { QString name = item->text(0); QString value = item->text(1); prof.writeEntry("Env_Name_" + QString::number(counter), name); prof.writeEntry("Env_Value_" + QString::number(counter), value); item = item->nextSibling(); counter++; } prof.writeEntry("EnvVars", QString::number(counter)); } diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp index b17f8e8..228db57 100644 --- a/noncore/apps/opie-console/main.cpp +++ b/noncore/apps/opie-console/main.cpp @@ -1,114 +1,111 @@ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <qfile.h> #include <qpe/qpeapplication.h> #include "mainwindow.h" //#define FSCKED_DISTRIBUTION 1 #ifdef FSCKED_DISTRIBUTION /* * The Zaurus rom */ class FixIt { public: FixIt(); ~FixIt(); void fixIt(); /* no real interested in implementing it */ void breakIt() { }; char* m_file; }; FixIt::FixIt() { /* the new inittab */ - m_file = "#\n# /etc/inittab -# - -# 0 - halt (Do NOT set initdefault to this) -# 1 - Single user mode -# 2 - Multiuser, without NFS (The same as 3, if you do not have networking) -# 3 - Full multiuser mode -# 4 - JavaVM(Intent) developer mode -# 5 - JavaVM(Intent) -# 6 - reboot (Do NOT set initdefault to this) -# -id:5:initdefault: - -# Specify things to do when starting -si::sysinit:/etc/rc.d/rc.sysinit - -l0:0:wait:/root/etc/rc.d/rc 0 -l1:1:wait:/etc/rc.d/rc 1 -l2:2:wait:/etc/rc.d/rc 2 -l3:3:wait:/etc/rc.d/rc 3 -l4:4:wait:/etc/rc.d/rc 4 -l5:5:wait:/etc/rc.d/rc 5 -l6:6:wait:/root/etc/rc.d/rc 6 - -# Specify things to do before rebooting -um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1 -sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1 - -# Specify program to run on ttyS0 -s0:24:respawn:/sbin/getty 9600 ttyS0 -#pd:5:respawn:/etc/sync/serialctl - -# Specify program to run on tty1 -1:2:respawn:/sbin/getty 9600 tty1 -ln:345:respawn:survive -l 6 /sbin/launch -#qt:5:respawn:/sbin/qt - -# collie sp. -sy::respawn:/sbin/shsync\n"; - - + m_file = "#\n# /etc/inittab" +"#" +"" +"# 0 - halt (Do NOT set initdefault to this)" +"# 1 - Single user mode" +"# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)" +"# 3 - Full multiuser mode" +"# 4 - JavaVM(Intent) developer mode" +"# 5 - JavaVM(Intent)" +"# 6 - reboot (Do NOT set initdefault to this)" +"#" +"id:5:initdefault:" +"" +"# Specify things to do when starting" +"si::sysinit:/etc/rc.d/rc.sysinit" +"" +"l0:0:wait:/root/etc/rc.d/rc 0" +"l1:1:wait:/etc/rc.d/rc 1" +"l2:2:wait:/etc/rc.d/rc 2" +"l3:3:wait:/etc/rc.d/rc 3" +"l4:4:wait:/etc/rc.d/rc 4" +"l5:5:wait:/etc/rc.d/rc 5" +"l6:6:wait:/root/etc/rc.d/rc 6" +"" +"# Specify things to do before rebooting" +"um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1" +"sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1" +"" +"# Specify program to run on ttyS0" +"s0:24:respawn:/sbin/getty 9600 ttyS0" +"#pd:5:respawn:/etc/sync/serialctl" +"" +"# Specify program to run on tty1" +"1:2:respawn:/sbin/getty 9600 tty1" +"ln:345:respawn:survive -l 6 /sbin/launch" +"#qt:5:respawn:/sbin/qt" +"" +"# collie sp." +"sy::respawn:/sbin/shsync\n"; } FixIt::~FixIt() { } /* * the retail Zaurus is broken in many ways * one is that pppd is listening on our port... * we've to stop it from that and then do kill(SIGHUP,1); */ void FixIt::fixIt() { ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); QFile file( "/etc/inittab" ); if ( file.open(IO_WriteOnly | IO_Raw ) ) { file.writeBlock(m_file,strlen(m_file) ); } file.close(); ::kill( SIGHUP, 1 ); } #endif - int main(int argc, char **argv) { // too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; QPEApplication app( argc, argv ); #ifdef FSCKED_DISTRIBUTION qWarning("fscked"); FixIt it; it.fixIt(); #endif MainWindow mw; mw.setCaption(QObject::tr("Opie Console") ); app.showMainWidget( &mw ); int ap = app.exec(); #ifdef FSCKED_DISTRIBUTION /* should add a signal handler too */ it.breakIt(); #endif return ap; } diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index c48116d..3c9603c 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -23,138 +23,138 @@ #include "profileeditordialog.h" #include "configdialog.h" #include "default.h" #include "metafactory.h" #include "profile.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 Connection"), + 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 Connection"), + 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(); @@ -367,128 +367,129 @@ void MainWindow::slotRunScript(int id) { int index = m_scriptsPop->indexOf(id); DocLnk *lnk = m_scriptsData.at(index); QString filePath = lnk->file(); Script script(filePath); currentSession()->emulationHandler()->runScript(&script); } } void MainWindow::slotConnect() { if ( currentSession() ) { bool ret = currentSession()->layer()->open(); if(!ret) QMessageBox::warning(currentSession()->widgetStack(), QObject::tr("Failed"), QObject::tr("Connecting failed for this session.")); else { m_connect->setEnabled( false ); m_disconnect->setEnabled( true ); // if it does not support file transfer, disable the menu entry if ( ( m_curSession->layer() )->supports()[1] == 0 ) { m_transfer->setEnabled( false ); } else { m_transfer->setEnabled( true ); } m_recordScript->setEnabled( true ); m_scripts->setItemEnabled(m_runScript_id, true); } } } void MainWindow::slotDisconnect() { if ( currentSession() ) { currentSession()->layer()->close(); m_connect->setEnabled( true ); m_disconnect->setEnabled( false ); m_transfer->setEnabled( false ); m_recordScript->setEnabled( false); m_saveScript->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); } } void MainWindow::slotTerminate() { if ( currentSession() ) currentSession()->layer()->close(); slotClose(); /* FIXME move to the next session */ } void MainWindow::slotQuickLaunch() { Profile prof = manager()->profile( "default" ); if ( prof.name() == "default" ) { create( prof ); } else { Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); newProf.setAutoConnect( true ); create( newProf ); + slotSaveSession(); } } void MainWindow::slotConfigure() { ConfigDialog conf( manager()->all(), factory() ); conf.showMaximized(); int ret = conf.exec(); if ( QDialog::Accepted == ret ) { manager()->setProfiles( conf.list() ); manager()->save(); populateProfiles(); } } /* * we will remove * this window from the tabwidget * remove it from the list * delete it * and set the currentSession() */ void MainWindow::slotClose() { if (!currentSession() ) return; Session* ses = currentSession(); qWarning("removing! currentSession %s", currentSession()->name().latin1() ); /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ m_curSession = NULL; tabWidget()->remove( /*currentSession()*/ses ); /*it's autodelete */ m_sessions.remove( ses ); qWarning("after remove!!"); if (!currentSession() ) { m_connect->setEnabled( false ); m_disconnect->setEnabled( false ); m_terminate->setEnabled( false ); m_transfer->setEnabled( false ); m_recordScript->setEnabled( false ); m_saveScript->setEnabled( false ); m_scripts->setItemEnabled(m_runScript_id, false); m_fullscreen->setEnabled( false ); m_wrap->setEnabled( false ); m_closewindow->setEnabled( false ); } m_kb->loadDefaults(); } /* * We will get the name * Then the profile * and then we will make a profile */ void MainWindow::slotProfile( int id) { Profile prof = manager()->profile( m_sessionsPop->text( id) ); create( prof ); } diff --git a/noncore/apps/opie-console/opie-console.control b/noncore/apps/opie-console/opie-console.control index 693c72c..852451d 100644 --- a/noncore/apps/opie-console/opie-console.control +++ b/noncore/apps/opie-console/opie-console.control @@ -1,11 +1,11 @@ Package: opie-console Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* Priority: optional Section: opie/applications Maintainer: Opie team <opie@handhelds.org> Architecture: arm Version: 0.6-$SUB_VERSION -Depends: qpe-base, libopie1, lrzsz, opie-keytabs +Depends: qpe-base, libopie1, opie-console-help-en, lrzsz, opie-keytabs License: GPL Description: Opie terminal app diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index 58b29ca..ccf2e08 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro @@ -1,77 +1,76 @@ TEMPLATE = app TMAKE_CXXFLAGS += -DHAVE_OPENPTY CONFIG += qt warn_on release #CONFIG = qt debug DESTDIR = $(OPIEDIR)/bin HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ file_layer.h filetransfer.h \ metafactory.h \ session.h \ mainwindow.h \ profile.h \ profileconfig.h \ profilemanager.h \ - configwidget.h \ tabwidget.h \ configdialog.h \ keytrans.h \ transferdialog.h \ profiledialogwidget.h \ profileeditordialog.h \ default.h \ iolayerbase.h \ serialconfigwidget.h irdaconfigwidget.h \ btconfigwidget.h modemconfigwidget.h \ atconfigdialog.h dialdialog.h \ procctl.h \ function_keyboard.h \ receive_layer.h filereceive.h \ script.h \ dialer.h \ terminalwidget.h \ emulation_handler.h TECommon.h \ TEHistory.h TEScreen.h TEWidget.h \ TEmuVt102.h TEmulation.h MyPty.h \ consoleconfigwidget.h SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ file_layer.cpp filetransfer.cpp \ main.cpp \ metafactory.cpp \ session.cpp \ mainwindow.cpp \ profile.cpp \ profileconfig.cpp \ profilemanager.cpp \ tabwidget.cpp \ configdialog.cpp \ keytrans.cpp \ transferdialog.cpp \ profiledialogwidget.cpp \ profileeditordialog.cpp \ iolayerbase.cpp \ serialconfigwidget.cpp irdaconfigwidget.cpp \ btconfigwidget.cpp modemconfigwidget.cpp \ atconfigdialog.cpp dialdialog.cpp \ default.cpp procctl.cpp \ function_keyboard.cpp \ receive_layer.cpp filereceive.cpp \ script.cpp \ dialer.cpp \ terminalwidget.cpp \ emulation_handler.cpp TEHistory.cpp \ TEScreen.cpp TEWidget.cpp \ TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ consoleconfigwidget.cpp INTERFACES = configurebase.ui editbase.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -lutil TARGET = opie-console include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp index 6b607df..e2501a6 100644 --- a/noncore/apps/opie-console/profileeditordialog.cpp +++ b/noncore/apps/opie-console/profileeditordialog.cpp @@ -1,239 +1,242 @@ #include <qlayout.h> #include <qlineedit.h> #include <qlabel.h> #include <qmessagebox.h> #include <qstringlist.h> #include <qcombobox.h> #include <qcheckbox.h> #include <qscrollview.h> #include "metafactory.h" #include "profileeditordialog.h" namespace { void setCurrent( const QString& str, QComboBox* bo ) { for (int i = 0; i < bo->count(); i++ ) { if ( bo->text(i) == str ) { bo->setCurrentItem( i ); } } }; } ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact, const Profile& prof ) : QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof ) { initUI(); // Apply current profile // plugin_plugin->load(profile); // ... (reset profile name line edit etc.) } ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact ) : QDialog(0, 0, TRUE), m_fact( fact ) { - // Default profile - m_prof = Profile("New Profile", "serial", "default", Profile::Black, Profile::White, Profile::VT102); + // Default profile + m_prof = Profile(tr("New Profile"), "serial", "default", Profile::Black, Profile::White, Profile::VT102); - initUI(); + initUI(); - // Apply current profile - // plugin_plugin->load(profile); + // Apply current profile + // plugin_plugin->load(profile); } Profile ProfileEditorDialog::profile() const { return m_prof; } void ProfileEditorDialog::initUI() { m_con = m_term = m_key = 0l; QVBoxLayout *mainLayout = new QVBoxLayout( this ); tabWidget = new OTabWidget( this ); tabWidget->setTabStyle(OTabWidget::TextTab); mainLayout->add(tabWidget); /* base tabs */ tabprof = new QWidget(this); m_tabTerm = new QWidget(this); m_tabCon = new QWidget(this); m_tabKey = new QWidget(this); m_svCon = new QScrollView( m_tabCon ); m_svCon->setResizePolicy( QScrollView::AutoOneFit ); //m_svCon->setHScrollBarMode( QScrollView::AlwaysOff ); m_svCon->setFrameShape( QFrame::NoFrame ); m_svTerm = new QScrollView( m_tabTerm ); m_svTerm->setResizePolicy( QScrollView::AutoOneFit ); //m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff ); m_svTerm->setFrameShape( QFrame::NoFrame ); /* base layout for tabs */ m_layCon = new QHBoxLayout( m_tabCon , 2 ); m_layTerm = new QHBoxLayout( m_tabTerm, 2 ); m_layKey = new QHBoxLayout( m_tabKey, 2 ); m_layCon->addWidget( m_svCon ); m_layTerm->addWidget( m_svTerm ); // profile tab QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof); m_name = new QLineEdit(tabprof); QLabel *con = new QLabel(tr("Connection"), tabprof ); QLabel *term = new QLabel(tr("Terminal"), tabprof ); m_conCmb = new QComboBox( tabprof ); m_termCmb = new QComboBox( tabprof ); m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof); // layouting QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2); vbox3->add(name); vbox3->add(m_name); vbox3->add(con ); vbox3->add(m_conCmb ); vbox3->add(term ); vbox3->add(m_termCmb ); vbox3->add(m_autoConnect); vbox3->addStretch(1); m_showconntab = 0; tabWidget->addTab(tabprof, "", QObject::tr("Profile")); tabWidget->addTab(m_tabCon, "", QObject::tr("Connection")); tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal")); tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys")); tabWidget->setCurrentTab( tabprof ); // fill the comboboxes QStringList list = m_fact->connectionWidgets(); QStringList::Iterator it; for (it =list.begin(); it != list.end(); ++it ) { m_conCmb->insertItem( (*it) ); } list = m_fact->terminalWidgets(); for (it =list.begin(); it != list.end(); ++it ) { m_termCmb->insertItem( (*it) ); } // load profile values m_name->setText(m_prof.name()); - slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); - slotTermActivated( m_fact->external(m_prof.terminalName() ) ); slotKeyActivated( "Default Keyboard" ); setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb ); setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb ); + slotConActivated( m_fact->external(m_prof.ioLayerName() ) ); + slotTermActivated( m_fact->external(m_prof.terminalName() ) ); m_autoConnect->setChecked(m_prof.autoConnect()); // signal and slots connect(m_conCmb, SIGNAL(activated(const QString& ) ), this, SLOT(slotConActivated(const QString&) ) ); connect(m_termCmb, SIGNAL(activated(const QString& ) ), this, SLOT(slotTermActivated(const QString& ) ) ); } ProfileEditorDialog::~ProfileEditorDialog() { } void ProfileEditorDialog::accept() { if(profName().isEmpty()) { QMessageBox::information(this, QObject::tr("Invalid profile"), QObject::tr("Please enter a profile name.")); return; } // Save profile and plugin profile //if(plugin_plugin) plugin_plugin->save(); // Save general values m_prof.setName( profName() ); m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) ); m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) ); m_prof.setAutoConnect( m_autoConnect->isChecked() ); if (m_con ) m_con->save( m_prof ); if (m_term ) m_term->save( m_prof ); if (m_key) m_key->save( m_prof ); QDialog::accept(); } QString ProfileEditorDialog::profName()const { return m_name->text(); } QCString ProfileEditorDialog::profType()const { /*QStringList w = m_fact->configWidgets(); for(QStringList::Iterator it = w.begin(); it != w.end(); it++) if(device_box->currentText() == m_fact->name((*it))) return (*it); */ return QCString(); } /* * we need to switch the widget */ void ProfileEditorDialog::slotConActivated( const QString& str ) { delete m_con; m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() ); if ( !m_con ) { m_con = new NoOptions( str, m_svCon->viewport(), "name"); } // FIXME ugly hack right. Right solution would be to look into the layer and see if it // supports auto connect and then set it as prefered - //if ( ( )->layer()->supports()[0] == 1 ) { if ( m_conCmb ->currentText() == tr("Local Console") ) { m_autoConnect->setChecked( true ); + m_prof.writeEntry("Terminal", Profile::Linux ); + slotTermActivated( m_fact->external (m_prof.terminalName() ) ); } else { + m_prof.writeEntry("Terminal", Profile::VT102 ); + slotTermActivated( m_fact->external (m_prof.terminalName() ) ); m_autoConnect->setChecked( false ); } m_con->load( m_prof ); m_svCon->addChild( m_con ); } /* * we need to switch the widget */ void ProfileEditorDialog::slotTermActivated( const QString& str ) { delete m_term; m_term = m_fact->newTerminalPlugin( str, m_svTerm->viewport() ); - if (m_term) { + if ( m_term ) { m_term->load( m_prof ); m_svTerm->addChild( m_term ); } } void ProfileEditorDialog::slotKeyActivated(const QString &str) { delete m_key; m_key = m_fact->newKeyboardPlugin( str, m_tabKey ); if (m_key) { m_key->load(m_prof); m_layKey->addWidget(m_key); } } diff --git a/noncore/apps/opie-reader/Prefs.cpp b/noncore/apps/opie-reader/Prefs.cpp index 825608e..e5320d9 100644 --- a/noncore/apps/opie-reader/Prefs.cpp +++ b/noncore/apps/opie-reader/Prefs.cpp @@ -1,98 +1,98 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'Prefs.ui' ** ** Created: Tue Feb 11 23:53:35 2003 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #include "useqpe.h" #include "Prefs.h" #include <qcheckbox.h> #include <qlabel.h> #include <qpushbutton.h> #include <qspinbox.h> #include <qlayout.h> #include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qcombobox.h> #include <qbuttongroup.h> #include <qlineedit.h> #ifdef USEQPE #include <qpe/menubutton.h> #include <qpe/fontdatabase.h> #else #include <qfontdatabase.h> #endif CLayoutPrefs::CLayoutPrefs( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QHBoxLayout* hb = new QHBoxLayout(this); - QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, "Text", this); + QButtonGroup* bg = new QButtonGroup(2, Qt::Horizontal, tr("Text"), this); hb->addWidget(bg); StripCR = new QCheckBox( bg ); StripCR->setText( tr( "Strip CR" ) ); Dehyphen = new QCheckBox( bg ); Dehyphen->setText( tr( "Dehyphen" ) ); SingleSpace = new QCheckBox( bg ); SingleSpace->setText( tr( "Single Space" ) ); Unindent = new QCheckBox( bg ); Unindent->setText( tr( "Unindent" ) ); Reparagraph = new QCheckBox( bg ); Reparagraph->setText( tr( "Reparagraph" ) ); DoubleSpace = new QCheckBox( bg ); DoubleSpace->setText( tr( "Double Space" ) ); Remap = new QCheckBox( bg ); Remap->setText( tr( "Remap" ) ); Embolden = new QCheckBox( bg ); Embolden->setText( tr( "Embolden" ) ); FullJustify = new QCheckBox( bg ); FullJustify->setText( tr( "Full Justify" ) ); } /* * Destroys the object and frees any allocated resources */ CLayoutPrefs::~CLayoutPrefs() { // no need to delete child widgets, Qt does it all for us } CLayoutPrefs2::CLayoutPrefs2( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QVBoxLayout* vb = new QVBoxLayout(this); QGridLayout* gl = new QGridLayout(vb, 4, 3); QLabel *TextLabel; TextLabel = new QLabel( this, "TextLabel1" ); TextLabel->setText( tr( "Indent" ) ); gl->addWidget(TextLabel, 0, 0); TextLabel = new QLabel( this ); TextLabel->setText( tr( "Page\nOverlap" ) ); gl->addWidget(TextLabel, 0, 1); TextLabel = new QLabel( this ); TextLabel->setText( tr( "Graphics\nZoom" ) ); gl->addWidget(TextLabel, 0, 2); Indent = new QSpinBox( this, "Indent" ); @@ -304,333 +304,333 @@ CPluckerPrefs::~CPluckerPrefs() /* CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QVBoxLayout* Layout11 = new QVBoxLayout(this); Layout11->setMargin( 0 ); QHBoxLayout* hl = new QHBoxLayout; QLabel* TextLabel = new QLabel( this ); TextLabel->setText( tr( "Action for\nSelect Button" ) ); hl->addWidget(TextLabel); action = new QComboBox( this ); action->insertItem("Open file"); action->insertItem("Autoscroll"); action->insertItem("Mark"); action->insertItem("Annotate"); action->insertItem("Fullscreen"); hl->addWidget( action ); Layout11->addLayout(hl); hl = new QHBoxLayout; TextLabel = new QLabel( this ); TextLabel->setText( tr( "Dictionary\nApplication" ) ); hl->addWidget(TextLabel); target = new QLineEdit(this); hl->addWidget( target ); Layout11->addLayout(hl); QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, "Selection Target", this); Layout11->addWidget( bg ); annotation = new QCheckBox( bg ); annotation->setText( tr( "Annotation" ) ); dictionary = new QCheckBox( bg ); dictionary->setText( tr( "Dictionary" ) ); clipboard = new QCheckBox( bg ); clipboard->setText( tr( "Clipboard" ) ); } CMiscPrefs::~CMiscPrefs() { // no need to delete child widgets, Qt does it all for us } */ CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QGridLayout* hl = new QGridLayout(this,1,2); hl->setMargin( 0 ); - QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Select Action", this); + QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, tr("Select Action"), this); hl->addWidget( gb, 0, 0 ); annotation = new QCheckBox( gb ); annotation->setText( tr( "Annotation" ) ); dictionary = new QCheckBox( gb ); dictionary->setText( tr( "Dictionary" ) ); clipboard = new QCheckBox( gb ); clipboard->setText( tr( "Clipboard" ) ); - QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, "Plucker", this); + QButtonGroup* bg = new QButtonGroup(1, Qt::Horizontal, tr("Plucker"), this); hl->addWidget( bg, 0 , 1 ); Depluck = new QCheckBox( bg ); Depluck->setText( tr( "Depluck" ) ); Dejpluck = new QCheckBox( bg ); Dejpluck->setText( tr( "Dejpluck" ) ); Continuous = new QCheckBox( bg ); Continuous->setText( tr( "Continuous" ) ); /* QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Navigation", this); TextLabel = new QLabel( gb ); TextLabel->setText( tr( "Overlap" ) ); QSpinBox* sb = new QSpinBox( gb ); Internationalisation Ideogram/Word Set Width Set Encoding Set Font */ } CMiscPrefs::~CMiscPrefs() { // no need to delete child widgets, Qt does it all for us } CPrefs::CPrefs(bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) { setCaption(tr( "OpieReader Settings" ) ); QTabWidget* td = new QTabWidget(this); layout = new CLayoutPrefs(this); layout2 = new CLayoutPrefs2(this); misc = new CMiscPrefs(this); button = new CButtonPrefs(this); inter = new CInterPrefs(this); td->addTab(layout, tr("Layout")); td->addTab(layout2, tr("Layout(2)")); td->addTab(inter, tr("Locale")); td->addTab(misc, tr("Misc")); td->addTab(button, tr("Buttons")); QVBoxLayout* v = new QVBoxLayout(this); v->addWidget(td); if (fs) showMaximized(); } /* Unicode Ideo/Word Width Encoding */ #include "CEncoding_tables.h" CInterPrefs::CInterPrefs( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QHBoxLayout* hb = new QHBoxLayout(this); QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, tr("International"), this); hb->addWidget(gb); QLabel *TextLabel; ideogram = new QCheckBox( gb ); ideogram->setText( tr( "Ideograms" ) ); TextLabel = new QLabel( gb ); TextLabel->setText( tr( "Ideogram Width" ) ); ideogramwidth = new QSpinBox( gb ); ideogramwidth->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); ideogramwidth->setRange(1,200); propfontchange = new QCheckBox( gb ); propfontchange->setText( tr( "Apply font\nto dialogs" ) ); TextLabel = new QLabel( gb ); TextLabel->setText( tr( "Encoding" ) ); #ifdef USECOMBO encoding = new QComboBox(gb); #else encoding = new MenuButton(gb); #endif encoding->insertItem("Ascii"); encoding->insertItem("UTF-8"); encoding->insertItem("UCS-2(BE)"); encoding->insertItem("USC-2(LE)"); encoding->insertItem("Palm"); for (unicodetable::iterator iter = unicodetable::begin(); iter != unicodetable::end(); iter++) { encoding->insertItem(iter->mime); } QVBoxLayout* vb = new QVBoxLayout; - gb = new QGroupBox(1, Qt::Horizontal, "Dictionary", this); + gb = new QGroupBox(1, Qt::Horizontal, tr("Dictionary"), this); TextLabel = new QLabel( gb ); TextLabel->setText( tr( "Application" ) ); application = new QLineEdit(gb); application->setFixedWidth(80); TextLabel = new QLabel( gb ); TextLabel->setText( tr( "Message" ) ); message = new QLineEdit(gb); message->setFixedWidth(80); // message->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); twotouch = new QCheckBox( gb ); twotouch->setText( tr( "Two/One\nTouch" ) ); SwapMouse = new QCheckBox( gb ); - SwapMouse->setText("Swap Tap\nActions"); + SwapMouse->setText(tr("Swap Tap\nActions") ); vb->addWidget(gb); // vb->addStretch(); hb->addLayout(vb); } CInterPrefs::~CInterPrefs() { // no need to delete child widgets, Qt does it all for us } #ifdef USECOMBO void CButtonPrefs::populate(QComboBox *mb) #else void CButtonPrefs::populate(MenuButton *mb) #endif { mb->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - mb->insertItem("<Nothing>"); - mb->insertItem("Open file"); - mb->insertItem("Autoscroll"); - mb->insertItem("Bookmark"); - mb->insertItem("Annotate"); - mb->insertItem("Fullscreen"); - - mb->insertItem("Zoom in"); - mb->insertItem("Zoom out"); - mb->insertItem("Back"); - mb->insertItem("Forward"); - mb->insertItem("Home"); - mb->insertItem("Page up"); - mb->insertItem("Page down"); - mb->insertItem("Line up"); - mb->insertItem("Line down"); - mb->insertItem("Beginning"); - mb->insertItem("End"); + mb->insertItem(tr("<Nothing>") ); + mb->insertItem(tr("Open file") ); + mb->insertItem(tr("Autoscroll") ); + mb->insertItem(tr("Bookmark") ); + mb->insertItem(tr("Annotate") ); + mb->insertItem(tr("Fullscreen") ); + + mb->insertItem(tr("Zoom in") ); + mb->insertItem(tr("Zoom out") ); + mb->insertItem(tr("Back") ); + mb->insertItem(tr("Forward") ); + mb->insertItem(tr("Home") ); + mb->insertItem(tr("Page up") ); + mb->insertItem(tr("Page down") ); + mb->insertItem(tr("Line up") ); + mb->insertItem(tr("Line down") ); + mb->insertItem(tr("Beginning") ); + mb->insertItem(tr("End") ); } CButtonPrefs::CButtonPrefs( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QGridLayout* hl = new QGridLayout(this,10,2); hl->setMargin( 0 ); - QLabel* ql = new QLabel("Escape Button", this); + QLabel* ql = new QLabel(tr("Escape Button"), this); hl->addWidget(ql, 0, 0, Qt::AlignBottom); #ifdef USECOMBO escapeAction = new QComboBox( this ); #else escapeAction = new MenuButton( this ); #endif populate(escapeAction); hl->addWidget(escapeAction, 1, 0, Qt::AlignTop | Qt::AlignLeft); - ql = new QLabel("Space Button", this); + ql = new QLabel(tr("Space Button"), this); hl->addWidget(ql, 2, 0, Qt::AlignBottom); #ifdef USECOMBO spaceAction = new QComboBox( this ); #else spaceAction = new MenuButton( this ); #endif populate(spaceAction); hl->addWidget(spaceAction, 3, 0, Qt::AlignTop | Qt::AlignLeft); - ql = new QLabel("Return Button", this); + ql = new QLabel(tr("Return Button"), this); hl->addWidget(ql, 2, 1, Qt::AlignBottom); #ifdef USECOMBO returnAction = new QComboBox( this ); #else returnAction = new MenuButton( this ); #endif populate(returnAction); hl->addWidget(returnAction, 3, 1, Qt::AlignTop | Qt::AlignLeft); - ql = new QLabel("Left Arrow", this); + ql = new QLabel(tr("Left Arrow"), this); hl->addWidget(ql, 4, 0, Qt::AlignBottom); #ifdef USECOMBO leftAction = new QComboBox( this ); #else leftAction = new MenuButton( this ); #endif populate(leftAction); hl->addWidget(leftAction, 5, 0, Qt::AlignTop | Qt::AlignLeft); leftScroll = new QCheckBox( tr("Scroll Speed"), this ); hl->addWidget(leftScroll, 6, 0, Qt::AlignTop | Qt::AlignLeft); - ql = new QLabel("Right Arrow", this); + ql = new QLabel(tr("Right Arrow"), this); hl->addWidget(ql, 4, 1, Qt::AlignBottom); #ifdef USECOMBO rightAction = new QComboBox( this ); #else rightAction = new MenuButton( this ); #endif populate(rightAction); hl->addWidget(rightAction, 5, 1, Qt::AlignTop | Qt::AlignLeft); rightScroll = new QCheckBox( tr("Scroll Speed"), this ); hl->addWidget(rightScroll, 6, 1, Qt::AlignTop | Qt::AlignLeft); - ql = new QLabel("Down Arrow", this); + ql = new QLabel(tr("Down Arrow"), this); hl->addWidget(ql, 7, 0, Qt::AlignBottom); #ifdef USECOMBO downAction = new QComboBox( this ); #else downAction = new MenuButton( this ); #endif populate(downAction); hl->addWidget(downAction, 8, 0, Qt::AlignTop | Qt::AlignLeft); downScroll = new QCheckBox( tr("Scroll Speed"), this ); hl->addWidget(downScroll, 9, 0, Qt::AlignTop | Qt::AlignLeft); - ql = new QLabel("Up Arrow", this); + ql = new QLabel(tr("Up Arrow"), this); hl->addWidget(ql, 7, 1, Qt::AlignBottom); #ifdef USECOMBO upAction = new QComboBox( this ); #else upAction = new MenuButton( this ); #endif populate(upAction); hl->addWidget(upAction, 8, 1, Qt::AlignTop | Qt::AlignLeft); upScroll = new QCheckBox( tr("Scroll Speed"), this ); hl->addWidget(upScroll, 9, 1, Qt::AlignTop | Qt::AlignLeft); } CButtonPrefs::~CButtonPrefs() { // no need to delete child widgets, Qt does it all for us } diff --git a/noncore/apps/opie-reader/Prefs.h b/noncore/apps/opie-reader/Prefs.h index 37d8c9e..8fef2f5 100644 --- a/noncore/apps/opie-reader/Prefs.h +++ b/noncore/apps/opie-reader/Prefs.h @@ -1,202 +1,203 @@ /**************************************************************************** ** Form interface generated from reading ui file 'Prefs.ui' ** ** Created: Tue Feb 11 23:53:32 2003 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ #ifndef CPREFS_H #define CPREFS_H #include "useqpe.h" #include <qvariant.h> #include <qwidget.h> #include <qtabdialog.h> #include <qtabwidget.h> #include <qspinbox.h> #include <qcheckbox.h> #include <qcombobox.h> #include <qlineedit.h> #ifdef USEQPE
#include <qpe/menubutton.h>
#endif //#include "opie.h" //#ifdef OPIE #define USECOMBO //#endif class QVBoxLayout; class QHBoxLayout; class QGridLayout; //class QCheckBox; class QLabel; //class QSpinBox; class CLayoutPrefs : public QWidget { - + Q_OBJECT public: friend class CPrefs; CLayoutPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~CLayoutPrefs(); QCheckBox* StripCR; QCheckBox* Dehyphen; QCheckBox* SingleSpace; QCheckBox* Unindent; QCheckBox* Reparagraph; QCheckBox* DoubleSpace; QCheckBox* Remap; QCheckBox* Embolden; QCheckBox* FullJustify; }; class CLayoutPrefs2 : public QWidget { - + Q_OBJECT public: friend class CPrefs; CLayoutPrefs2( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~CLayoutPrefs2(); QSpinBox* ParaLead; QSpinBox* LineLead; QSpinBox* Indent; QSpinBox* Margin, *gfxzoom, *pageoverlap; #ifdef USECOMBO QComboBox *Markup, *fontselector; #else MenuButton *Markup, *fontselector; #endif }; /* class CPluckerPrefs : public QWidget { public: friend class CPrefs; CPluckerPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~CPluckerPrefs(); QCheckBox* Depluck; QCheckBox* Dejpluck; QCheckBox* Continuous; protected: QHBoxLayout* Layout5; QVBoxLayout* Layout11; QGridLayout* Layout4; }; */ class CMiscPrefs : public QWidget { - + Q_OBJECT public: friend class CPrefs; CMiscPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~CMiscPrefs(); QCheckBox *annotation, *dictionary, *clipboard; QCheckBox *Depluck, *Dejpluck, *Continuous; }; class CButtonPrefs : public QWidget { + Q_OBJECT #ifdef USECOMBO void populate(QComboBox*); #else void populate(MenuButton*); #endif public: friend class CPrefs; CButtonPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~CButtonPrefs(); #ifdef USECOMBO QComboBox *returnAction, *spaceAction, *escapeAction, *leftAction, *rightAction, *upAction, *downAction; #else MenuButton *returnAction, *spaceAction, *escapeAction, *leftAction, *rightAction, *upAction, *downAction; #endif QCheckBox *leftScroll, *rightScroll, *upScroll, *downScroll; }; class CInterPrefs : public QWidget { - + Q_OBJECT public: friend class CPrefs; CInterPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~CInterPrefs(); QCheckBox *ideogram, *propfontchange, *SwapMouse, *twotouch; #ifdef USECOMBO QComboBox* encoding; #else MenuButton* encoding; #endif QSpinBox* ideogramwidth; QLineEdit *application, *message; }; class CPrefs : public QDialog { Q_OBJECT CLayoutPrefs* layout; CLayoutPrefs2* layout2; CMiscPrefs* misc; CButtonPrefs* button; CInterPrefs* inter; void keyPressEvent(QKeyEvent* e) { switch (e->key()) { case Key_Escape: e->accept(); reject(); break; case Key_Space: case Key_Return: e->accept(); accept(); break; default: QWidget::keyPressEvent(e); } } public: CPrefs(bool fs = true, QWidget* parent = 0, const char* name = 0); ~CPrefs() { } bool StripCR() { return layout->StripCR->isChecked(); } bool Dehyphen() { return layout->Dehyphen->isChecked(); } bool SingleSpace() { return layout->SingleSpace->isChecked(); } bool Unindent() { return layout->Unindent->isChecked(); } bool Reparagraph() { return layout->Reparagraph->isChecked(); } bool DoubleSpace() { return layout->DoubleSpace->isChecked(); } bool Remap() { return layout->Remap->isChecked(); } bool Embolden() { return layout->Embolden->isChecked(); } bool FullJustify() { return layout->FullJustify->isChecked(); } int ParaLead() { return layout2->ParaLead->value(); } int LineLead() { return layout2->LineLead->value(); } int Margin() { return layout2->Margin->value(); } int Indent() { return layout2->Indent->value(); } int Markup() { return layout2->Markup->currentItem(); } QString Font() { return layout2->fontselector->currentText(); } diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index af1da27..087ce00 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp @@ -2540,129 +2540,129 @@ void QTReaderApp::showEditTools() showMaximized(); #endif // setCentralWidget(reader); } // qDebug("uc"); updateCaption(); // qDebug("rw"); editorStack->raiseWidget( reader ); // qDebug("sf"); reader->setFocus(); reader->refresh(); } /* void QTReaderApp::save() { if ( !doc ) return; if ( !editor->edited() ) return; QString rt = editor->text(); QString pt = rt; if ( doc->name().isEmpty() ) { unsigned ispace = pt.find( ' ' ); unsigned ienter = pt.find( '\n' ); int i = (ispace < ienter) ? ispace : ienter; QString docname; if ( i == -1 ) { if ( pt.isEmpty() ) docname = "Empty Text"; else docname = pt; } else { docname = pt.left( i ); } doc->setName(docname); } FileManager fm; fm.saveFile( *doc, rt ); } */ void QTReaderApp::clear() { // if (doc != 0) // { // QMessageBox::information(this, PROGNAME, "Deleting doc", 1); // delete doc; // QMessageBox::information(this, PROGNAME, "Deleted doc", 1); // doc = 0; // } reader->clear(); } void QTReaderApp::updateCaption() { // if ( !doc ) // setCaption( tr("QTReader") ); // else { // QString s = doc->name(); // if ( s.isEmpty() ) // s = tr( "Unnamed" ); - setCaption( reader->m_string + " - " + tr(SHORTPROGNAME) ); + setCaption( reader->m_string + " - " + tr("Reader") ); // } } void QTReaderApp::setDocument(const QString& fileref) { bFromDocView = TRUE; //QMessageBox::information(0, "setDocument", fileref); openFile(fileref); // showEditTools(); } void QTReaderApp::closeEvent( QCloseEvent *e ) { // qDebug("Close event"); if (m_fullscreen) { m_fullscreen = false; showEditTools(); e->accept(); } else if (m_dontSave) { e->accept(); } else { if (editorStack->visibleWidget() == reader) { if ((m_escapeTarget != cesNone) && m_bcloseDisabled) { // qDebug("Close disabled"); m_bcloseDisabled = false; e->ignore(); } else { if (m_fontVisible) { m_fontBar->hide(); m_fontVisible = false; } if (regVisible) { regBar->hide(); #ifdef USEQPE Global::hideInputMethod(); #endif regVisible = false; return; } if (searchVisible) { searchBar->hide(); #ifdef USEQPE Global::hideInputMethod(); #endif searchVisible = false; return; } if (m_fBkmksChanged && pBkmklist != NULL) { if (QMessageBox::warning(this, PROGNAME, "Save bookmarks?", "Save", "Don't bother") == 0) savebkmks(); delete pBkmklist; diff --git a/noncore/apps/opie-reader/ToolbarPrefs.h b/noncore/apps/opie-reader/ToolbarPrefs.h index 297d63a..9571c28 100644 --- a/noncore/apps/opie-reader/ToolbarPrefs.h +++ b/noncore/apps/opie-reader/ToolbarPrefs.h @@ -110,129 +110,129 @@ class CBarPrefs2 : public QWidget void saveall(); bool isChanged() { return m_isChanged; } }; */ class CViewBarPrefs : public QWidget { Q_OBJECT Config& config; QCheckBox *fullscreen, *zoomin, *zoomout, *setfont, *encoding, *ideogram; bool m_isChanged; private slots: void isChanged(int _v) { m_isChanged = true; } public: CViewBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~CViewBarPrefs(); void saveall(); bool isChanged() { return m_isChanged; } }; class CMarkBarPrefs : public QWidget { Q_OBJECT Config& config; QCheckBox *mark, *annotate, *go_to, *Delete, *autogen, *clear, *save, *tidy, *startblock, *copyblock; bool m_isChanged; private slots: void isChanged(int _v) { m_isChanged = true; } public: CMarkBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~CMarkBarPrefs(); void saveall(); bool isChanged() { return m_isChanged; } }; class CIndBarPrefs : public QWidget { Q_OBJECT Config& config; QCheckBox *indannotate; bool m_isChanged; private slots: void isChanged(int _v) { m_isChanged = true; } public: CIndBarPrefs( Config&, QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~CIndBarPrefs(); void saveall(); bool isChanged() { return m_isChanged; } }; class CMiscBarPrefs : public QWidget { - + Q_OBJECT public: CMiscBarPrefs( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~CMiscBarPrefs(); #ifdef USECOMBO QComboBox *tbpolicy, *tbposition; #else MenuButton *tbpolicy, *tbposition; #endif QCheckBox *tbmovable, *floating; }; class CBarPrefs : public QDialog { Q_OBJECT ; CMiscBarPrefs* misc; CFileBarPrefs* filebar; CNavBarPrefs* navbar; CViewBarPrefs* viewbar; CMarkBarPrefs* markbar; CIndBarPrefs* indbar; Config config; void keyPressEvent(QKeyEvent* e) { switch (e->key()) { case Key_Escape: e->accept(); reject(); break; case Key_Space: case Key_Return: e->accept(); accept(); break; default: QWidget::keyPressEvent(e); } } public: CBarPrefs(const QString& appdir, bool fs = true, QWidget* parent = 0, const char* name = 0); ~CBarPrefs() { if (result()) { if (navbar->isChanged()) navbar->saveall(); if (filebar->isChanged()) filebar->saveall(); if (viewbar->isChanged()) viewbar->saveall(); if (markbar->isChanged()) markbar->saveall(); if (indbar->isChanged()) indbar->saveall(); } } bool isChanged() { return ( filebar->isChanged() || navbar->isChanged() || viewbar->isChanged() diff --git a/noncore/apps/opie-reader/opie-reader.control b/noncore/apps/opie-reader/opie-reader.control index 9996297..b7b0e8f 100644 --- a/noncore/apps/opie-reader/opie-reader.control +++ b/noncore/apps/opie-reader/opie-reader.control @@ -1,10 +1,10 @@ Package: opie-reader Files: bin/reader apps/Applications/opie-reader.desktop pics/opie-reader/* Priority: optional Section: applications Maintainer: Tim Wentford <timwentford@hotmail.com> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal License: GPL Description: E-Book reader +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/opie-write/opie-write.control b/noncore/apps/opie-write/opie-write.control index 52b518a..7b37671 100644 --- a/noncore/apps/opie-write/opie-write.control +++ b/noncore/apps/opie-write/opie-write.control @@ -1,10 +1,10 @@ Package: opie-write Files: bin/opie-write apps/Applications/opie-write.desktop pics/opie-write Priority: optional Section: opie/applications Maintainer: L.J. Potter <ljp@llornkcor.com> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal Description: Rich Text Editor The rich text editor for the Opie environment. +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/oxygen/opie-oxygen.control b/noncore/apps/oxygen/opie-oxygen.control index 1eff80b..6d40d1b 100644 --- a/noncore/apps/oxygen/opie-oxygen.control +++ b/noncore/apps/oxygen/opie-oxygen.control @@ -1,10 +1,10 @@ Package: opie-oxygen Files: bin/oxygen apps/Applications/oxygen.desktop pics/oxygen/oxygen.png share/oxygen/* Priority: optional Section: applications Maintainer: Carsten Niehaus <cniehaus@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal Description: Periodic System of the Elements The chemistry application for the Opie-environment +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tableviewer/opie-tableviewer.control b/noncore/apps/tableviewer/opie-tableviewer.control index b5495e1..aba9b8d 100644 --- a/noncore/apps/tableviewer/opie-tableviewer.control +++ b/noncore/apps/tableviewer/opie-tableviewer.control @@ -1,11 +1,11 @@ Package: opie-tableviewer Files: bin/tableviewer apps/Applications/tableviewer.desktop Priority: optional Section: opie/applications Maintainer: Warwick Allison <warwick@trolltech.com> Architecture: arm Arch: iPAQ -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal Description: XML database browsers A table/database viewer for the Opie environment. +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tinykate/libkate/document/katebuffer.cpp b/noncore/apps/tinykate/libkate/document/katebuffer.cpp index 38ba55d..22a4917 100644 --- a/noncore/apps/tinykate/libkate/document/katebuffer.cpp +++ b/noncore/apps/tinykate/libkate/document/katebuffer.cpp @@ -60,120 +60,120 @@ KWBuffer::clear() } /** * Insert a file at line @p line in the buffer. */ void KWBuffer::insertFile(int line, const QString &file, QTextCodec *codec) { if (line) { qDebug("insert File only supports insertion at line 0 == file opening"); return; } clear(); QFile iofile(file); iofile.open(IO_ReadOnly); QTextStream stream(&iofile); stream.setCodec(codec); QString qsl; int count=0; for (count=0;((qsl=stream.readLine())!=QString::null); count++) { if (count==0) { (*m_stringListIt)->append(qsl.unicode(),qsl.length()); } else { TextLine::Ptr tl=new TextLine(); tl ->append(qsl.unicode(),qsl.length()); m_stringListIt=m_stringList.append(tl); } } if (count!=0) { m_stringListCurrent=count-1; m_lineCount=count; } } void KWBuffer::loadFilePart() { } void KWBuffer::insertData(int line, const QByteArray &data, QTextCodec *codec) { } void KWBuffer::slotLoadFile() { loadFilePart(); // emit linesChanged(m_totalLines); emit linesChanged(20); } /** * Return the total number of lines in the buffer. */ int KWBuffer::count() { -// qDebug("m_stringList.count %d",m_stringList.count()); + qDebug("m_stringList.count %d",m_stringList.count()); return m_lineCount; // return m_stringList.count(); // return m_totalLines; } void KWBuffer::seek(int i) { if (m_stringListCurrent == i) return; while(m_stringListCurrent < i) { ++m_stringListCurrent; ++m_stringListIt; } while(m_stringListCurrent > i) { --m_stringListCurrent; --m_stringListIt; } } TextLine::Ptr KWBuffer::line(int i) { if (i>=m_stringList.count()) return 0; seek(i); return *m_stringListIt; } void KWBuffer::insertLine(int i, TextLine::Ptr line) { seek(i); m_stringListIt = m_stringList.insert(m_stringListIt, line); m_stringListCurrent = i; m_lineCount++; } void KWBuffer::removeLine(int i) { seek(i); m_stringListIt = m_stringList.remove(m_stringListIt); m_stringListCurrent = i; m_lineCount--; } void KWBuffer::changeLine(int i) { } diff --git a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp index 844f27d..f90a5f8 100644 --- a/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp +++ b/noncore/apps/tinykate/libkate/document/katesyntaxdocument.cpp @@ -10,162 +10,163 @@ * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "katesyntaxdocument.h" #include <kateconfig.h> #include <qfile.h> #include <kdebug.h> #include <kstddirs.h> #include <klocale.h> #include <kmessagebox.h> #include <qstringlist.h> #include <kglobal.h> #include <qpe/qpeapplication.h> #include <qdir.h> SyntaxDocument::SyntaxDocument() { m_root=0; currentFile=""; setupModeList(); } void SyntaxDocument::setIdentifier(const QString& identifier) { #warning FIXME delete m_root; m_root=Opie::XMLElement::load(identifier); if (!m_root) KMessageBox::error( 0L, i18n("Can't open %1").arg(identifier) ); } SyntaxDocument::~SyntaxDocument() { } void SyntaxDocument::setupModeList(bool force) { if (myModeList.count() > 0) return; KateConfig *config=KGlobal::config(); KStandardDirs *dirs = KGlobal::dirs(); // QStringList list=dirs->findAllResources("data","kate/syntax/*.xml",false,true); QString path=QPEApplication::qpeDir() +"share/tinykate/syntax/"; QDir dir(path); QStringList list=dir.entryList("*.xml"); for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { QString Group="Highlighting_Cache"+path+*it; if ((config->hasGroup(Group)) && (!force)) { config->setGroup(Group); syntaxModeListItem *mli=new syntaxModeListItem; mli->name = config->readEntry("name",""); mli->section = config->readEntry("section",""); mli->mimetype = config->readEntry("mimetype",""); mli->extension = config->readEntry("extension",""); - mli->identifier = *it; + mli->identifier = path+*it; myModeList.append(mli); } else { qDebug("Found a description file:"+path+(*it)); setIdentifier(path+(*it)); Opie::XMLElement *e=m_root; if (e) { e=e->firstChild(); qDebug(e->tagName()); if (e->tagName()=="language") { syntaxModeListItem *mli=new syntaxModeListItem; mli->name = e->attribute("name"); mli->section = e->attribute("section"); mli->mimetype = e->attribute("mimetype"); mli->extension = e->attribute("extensions"); qDebug(QString("valid description for: %1/%2").arg(mli->section).arg(mli->name)); if (mli->section.isEmpty()) mli->section=i18n("Other"); mli->identifier = path+(*it); config->setGroup(Group); config->writeEntry("name",mli->name); config->writeEntry("section",mli->section); config->writeEntry("mimetype",mli->mimetype); config->writeEntry("extension",mli->extension); myModeList.append(mli); } } } } + config->write(); // config->sync(); } SyntaxModeList SyntaxDocument::modeList() { return myModeList; } bool SyntaxDocument::nextGroup( syntaxContextData* data) { if(!data) return false; if (!data->currentGroup) data->currentGroup=data->parent->firstChild(); else data->currentGroup=data->currentGroup->nextChild(); data->item=0; if (!data->currentGroup) return false; else return true; } bool SyntaxDocument::nextItem( syntaxContextData* data) { if(!data) return false; if (!data->item) data->item=data->currentGroup->firstChild(); else data->item=data->item->nextChild(); if (!data->item) return false; else return true; } QString SyntaxDocument::groupItemData( syntaxContextData* data,QString name) { if(!data) return QString::null; if ( (data->item) && (name.isEmpty())) return data->item->tagName(); if (data->item) return data->item->attribute(name); else return QString(); } QString SyntaxDocument::groupData( syntaxContextData* data,QString name) { if(!data) return QString::null; if (data->currentGroup) return data->currentGroup->attribute(name); else return QString(); } diff --git a/noncore/apps/tinykate/libkate/libkate.pro b/noncore/apps/tinykate/libkate/libkate.pro index 5cb0b14..b282059 100644 --- a/noncore/apps/tinykate/libkate/libkate.pro +++ b/noncore/apps/tinykate/libkate/libkate.pro @@ -1,86 +1,91 @@ -TEMPLATE = lib -CONFIG = qt warn_on release -HEADERS = microkde/kapplication.h \ - kateconfig.h \ +TEMPLATE = lib +CONFIG = qt warn_on release +HEADERS = microkde/kapplication.h \ + kateconfig.h \ microkde/kdebug.h \ microkde/kdialog.h \ microkde/kdialogbase.h \ microkde/kfiledialog.h \ microkde/kglobal.h \ microkde/kiconloader.h \ microkde/klineedit.h \ microkde/klocale.h \ microkde/kmessagebox.h \ microkde/kprinter.h \ microkde/krestrictedline.h \ microkde/kseparator.h \ microkde/kstandarddirs.h \ microkde/ktempfile.h \ microkde/kunload.h \ microkde/kurlrequester.h \ microkde/kfontdialog.h \ microkde/krun.h \ microkde/knumvalidator.h \ microkde/kstaticdeleter.h \ microkde/klistview.h \ microkde/kglobalsettings.h \ - microkde/kcolorbtn.h \ - qt3back/qregexp3.h \ - microkde/ksharedptr.h \ - document/katebuffer.h document/katedialogs.h \ - document/katetextline.h \ - document/katecmd.h \ - document/katehighlight.h \ - document/katecmds.h document/katedocument.h \ - document/katesyntaxdocument.h \ - view/kateundohistory.h \ - view/kateview.h \ - view/kateviewdialog.h \ - interfaces/view.h \ - interfaces/document.h \ - ktexteditor/ktexteditor.h + microkde/kcolorbtn.h \ + \ + \ + qt3back/qregexp3.h \ + microkde/ksharedptr.h \ + document/katebuffer.h document/katedialogs.h \ + document/katetextline.h \ + document/katecmd.h \ + document/katehighlight.h \ + document/katecmds.h document/katedocument.h \ + document/katesyntaxdocument.h \ + view/kateundohistory.h \ + view/kateview.h \ + view/kateviewdialog.h \ + interfaces/view.h \ + interfaces/document.h \ + ktexteditor/ktexteditor.h -SOURCES = microkde/kapplication.cpp \ +SOURCES = microkde/kapplication.cpp \ microkde/kdialogbase.cpp \ - kateconfig.cpp \ + kateconfig.cpp \ microkde/klocale.cpp \ microkde/kmessagebox.cpp \ microkde/kprocess.cpp \ microkde/kstandarddirs.cpp \ microkde/ktempfile.cpp \ microkde/kurlrequester.cpp \ + microkde/kcolordialog.cpp \ microkde/kfontdialog.cpp \ microkde/krun.cpp \ microkde/knumvalidator.cpp \ microkde/kglobal.cpp \ microkde/kglobalsettings.cpp \ - microkde/kcolorbtn.cpp \ - qt3back/qregexp3.cpp \ - ktexteditor/ktexteditor.cpp \ - document/katebuffer.cpp document/katedialogs.cpp \ - document/katehighlight.cpp \ - document/katecmd.cpp \ - document/katesyntaxdocument.cpp document/katecmds.cpp \ - document/katedocument.cpp document/katetextline.cpp \ - view/kateundohistory.cpp \ - view/kateview.cpp \ - view/kateviewdialog.cpp \ - interfaces/interfaces.cpp + microkde/kcolorbtn.cpp \ + \ + \ + qt3back/qregexp3.cpp \ + ktexteditor/ktexteditor.cpp \ + document/katebuffer.cpp document/katedialogs.cpp \ + document/katehighlight.cpp \ + document/katecmd.cpp \ + document/katesyntaxdocument.cpp document/katecmds.cpp \ + document/katedocument.cpp document/katetextline.cpp \ + view/kateundohistory.cpp \ + view/kateview.cpp \ + view/kateviewdialog.cpp \ + interfaces/interfaces.cpp -INTERFACES = -INCLUDEPATH += $(OPIEDIR)/include \ - $(OPIEDIR)/noncore/apps/tinykate/libkate \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back -DEPENDPATH += $(OPIEDIR)/include +INTERFACES = +INCLUDEPATH += $(OPIEDIR)/include \ + $(OPIEDIR)/noncore/apps/tinykate/libkate \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back +DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -lopie -TARGET = tinykate +TARGET = tinykate INCLUDEPATH += $(OPIEDIR)/include DESTDIR = $(OPIEDIR)/lib$(PROJMAK) include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp b/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp index 976f1db..5d21f15 100644 --- a/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp +++ b/noncore/apps/tinykate/libkate/microkde/kcolorbtn.cpp @@ -1,86 +1,84 @@ /* This file is part of the KDE libraries Copyright (C) 1997 Martin Jones (mjones@kde.org) Copyright (C) 1999 Cristian Tibirna (ctibirna@kde.org) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <qdialog.h> #include <qpainter.h> #include <qdrawutil.h> #include <qapplication.h> #include <kglobalsettings.h> -//#include "kcolordialog.h" +#include "kcolordialog.h" #include "kcolorbtn.h" -#include <opie/colordialog.h> - KColorButton::KColorButton( QWidget *parent, const char *name ) : QPushButton( parent, name ), dragFlag(false) { // 2000-10-15 (putzer): fixes broken keyboard usage connect (this, SIGNAL(clicked()), this, SLOT(chooseColor())); } KColorButton::KColorButton( const QColor &c, QWidget *parent, - const char *name ) + const char *name ) : QPushButton( parent, name ), col(c), dragFlag(false) { // 2000-10-15 (putzer): fixes broken keyboard usage connect (this, SIGNAL(clicked()), this, SLOT(chooseColor())); } void KColorButton::setColor( const QColor &c ) { col = c; repaint( false ); } void KColorButton::drawButtonLabel( QPainter *painter ) { QRect r = QApplication::style().buttonRect( 0, 0, width(), height() ); int l = r.x(); int t = r.y(); int w = r.width(); int h = r.height(); int b = 5; QColor lnCol = colorGroup().text(); QColor fillCol = isEnabled() ? col : backgroundColor(); if ( isDown() ) { qDrawPlainRect( painter, l+b+1, t+b+1, w-b*2, h-b*2, lnCol, 1, 0 ); b++; painter->fillRect( l+b+1, t+b+1, w-b*2, h-b*2, fillCol ); } else { qDrawPlainRect( painter, l+b, t+b, w-b*2, h-b*2, lnCol, 1, 0 ); b++; painter->fillRect( l+b, t+b, w-b*2, h-b*2, fillCol ); } } void KColorButton::chooseColor() { - QColor newCol=OColorDialog::getColor( col); - if( newCol != QDialog::Rejected ) + if( KColorDialog::getColor( col) == QDialog::Rejected ) { - col=newCol; + return; + } + repaint( false ); emit changed( col ); - } } diff --git a/noncore/apps/tinykate/libkate/microkde/kcolordialog.h b/noncore/apps/tinykate/libkate/microkde/kcolordialog.h index 1d5c27e..0f831cd 100644 --- a/noncore/apps/tinykate/libkate/microkde/kcolordialog.h +++ b/noncore/apps/tinykate/libkate/microkde/kcolordialog.h @@ -1,16 +1,14 @@ #ifndef MINIKDE_KCOLORDIALOG_H #define MINIKDE_KCOLORDIALOG_H #include <qcolor.h> -#include <opie/colordialog.h> -class KColorDialog : OColorDialog +class KColorDialog { - Q_OBJECT public: enum { Accepted }; static int getColor( const QColor & ); }; #endif diff --git a/noncore/apps/tinykate/libkate/view/kateview.cpp b/noncore/apps/tinykate/libkate/view/kateview.cpp index de81d0f..af3b30d 100644 --- a/noncore/apps/tinykate/libkate/view/kateview.cpp +++ b/noncore/apps/tinykate/libkate/view/kateview.cpp @@ -2135,262 +2135,260 @@ void KateView::doReplaceAction(int result, bool found) { myDoc->setPseudoModal(replacePrompt);//disable(); connect(replacePrompt,SIGNAL(clicked()),this,SLOT(replaceSlot())); replacePrompt->show(); //this is not modal } return; //exit if text found } //nothing found: repeat until user cancels "repeat from beginning" dialog } while (!askReplaceEnd()); deleteReplacePrompt(); } void KateView::exposeFound(PointStruc &cursor, int slen, int flags, bool replace) { int x1, x2, y1, y2, xPos, yPos; VConfig c; myViewInternal->getVConfig(c); myDoc->selectLength(cursor,slen,c.flags); TextLine::Ptr textLine = myDoc->getTextLine(cursor.y); x1 = myDoc->textWidth(textLine,cursor.x) -10; x2 = myDoc->textWidth(textLine,cursor.x + slen) +20; y1 = myDoc->fontHeight*cursor.y -10; y2 = y1 + myDoc->fontHeight +30; xPos = myViewInternal->xPos; yPos = myViewInternal->yPos; if (x1 < 0) x1 = 0; if (replace) y2 += 90; if (x1 < xPos || x2 > xPos + myViewInternal->width()) { xPos = x2 - myViewInternal->width(); } if (y1 < yPos || y2 > yPos + myViewInternal->height()) { xPos = x2 - myViewInternal->width(); yPos = myDoc->fontHeight*cursor.y - height()/3; } myViewInternal->setPos(xPos, yPos); myViewInternal->updateView(flags);// | ufPos,xPos,yPos); myDoc->updateViews(this); } void KateView::deleteReplacePrompt() { myDoc->setPseudoModal(0L); } bool KateView::askReplaceEnd() { QString str; int query; myDoc->updateViews(); if (s.flags & KateView::sfFinished) { // replace finished str = i18n("%1 replacement(s) made").arg(replaces); KMessageBox::information(this, str, i18n("Replace")); return true; } // ask for continue if (!(s.flags & KateView::sfBackward)) { // forward search str = i18n("%1 replacement(s) made.\n" "End of document reached.\n" "Continue from the beginning?").arg(replaces); - query = KMessageBox::questionYesNo(this, str, i18n("Continue"), i18n("Stop")); + query = KMessageBox::questionYesNo(this, str, i18n("Replace"), + i18n("Continue"), i18n("Stop")); } else { // backward search str = i18n("%1 replacement(s) made.\n" "Beginning of document reached.\n" "Continue from the end?").arg(replaces); - query = KMessageBox::questionYesNo(this, str, i18n("Continue"), i18n("Stop")); + query = KMessageBox::questionYesNo(this, str, i18n("Replace"), + i18n("Continue"), i18n("Stop")); } replaces = 0; continueSearch(s); return (query == KMessageBox::No); } void KateView::replaceSlot() { doReplaceAction(replacePrompt->result(),true); } void KateView::installPopup(QPopupMenu *rmb_Menu) { rmbMenu = rmb_Menu; } void KateView::readConfig() { KateConfig *config = KGlobal::config(); config->setGroup("Kate View"); searchFlags = config->readNumEntry("SearchFlags", KateView::sfPrompt); configFlags = config->readNumEntry("ConfigFlags", configFlags) & ~KateView::cfMark; // config->sync(); } void KateView::writeConfig() { KateConfig *config = KGlobal::config(); config->setGroup("Kate View"); config->writeEntry("SearchFlags",searchFlags); config->writeEntry("ConfigFlags",configFlags); // config->sync(); } void KateView::readSessionConfig(KateConfig *config) { PointStruc cursor; myViewInternal->xPos = config->readNumEntry("XPos"); myViewInternal->yPos = config->readNumEntry("YPos"); cursor.x = config->readNumEntry("CursorX"); cursor.y = config->readNumEntry("CursorY"); myViewInternal->updateCursor(cursor); myIconBorder = config->readBoolEntry("IconBorder on"); setIconBorder(myIconBorder); } void KateView::writeSessionConfig(KateConfig *config) { config->writeEntry("XPos",myViewInternal->xPos); config->writeEntry("YPos",myViewInternal->yPos); config->writeEntry("CursorX",myViewInternal->cursor.x); config->writeEntry("CursorY",myViewInternal->cursor.y); config->writeEntry("IconBorder on", myIconBorder); } void KateView::configDialog() { #warning fixme - QScrollView *pScroll; #if 1 KDialogBase *kd = new KDialogBase(KDialogBase::IconList, i18n("Configure Editor"), KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::Help , KDialogBase::Ok, this, "tabdialog"); // color options QFrame *page=kd->addPage(i18n("Colors")); (new QVBoxLayout(page))->setAutoAdd(true); ColorConfig *colorConfig = new ColorConfig(page); QColor* colors = getColors(); colorConfig->setColors(colors); page = kd->addPage(i18n("Fonts")); (new QVBoxLayout(page))->setAutoAdd(true); FontConfig *fontConfig = new FontConfig(page); fontConfig->setFont (myDoc->getFont()); // indent options page=kd->addPage(i18n("Indent")); (new QVBoxLayout(page))->setAutoAdd(true); IndentConfigTab *indentConfig = new IndentConfigTab(page, this); // select options page=kd->addPage(i18n("Select")); (new QVBoxLayout(page))->setAutoAdd(true); SelectConfigTab *selectConfig = new SelectConfigTab(page, this); // edit options page=kd->addPage(i18n("Edit")); (new QVBoxLayout(page))->setAutoAdd(true); - pScroll=new QScrollView(page); + EditConfigTab *editConfig = new EditConfigTab(page, this); - pScroll->addChild(editConfig); HighlightDialogPage *hlPage; HlManager *hlManager; HlDataList hlDataList; ItemStyleList defaultStyleList; hlManager = HlManager::self(); defaultStyleList.setAutoDelete(true); hlManager->getDefaults(defaultStyleList); hlDataList.setAutoDelete(true); //this gets the data from the KateConfig object hlManager->getHlDataList(hlDataList); page=kd->addPage(i18n("Highlighting")); (new QVBoxLayout(page))->setAutoAdd(true); - pScroll=new QScrollView(page); - hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, pScroll->viewport()); - pScroll->addChild(hlPage); - kd->showMaximized(); + hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page); + kd->showMaximized(); if (kd->exec()) { // color options colorConfig->getColors(colors); myDoc->setFont (fontConfig->getFont()); applyColors(); // indent options indentConfig->getData(this); // select options selectConfig->getData(this); // edit options editConfig->getData(this); // spell checker hlManager->setHlDataList(hlDataList); hlManager->setDefaults(defaultStyleList); hlPage->saveData(); } // delete kd; #endif } int KateView::getHl() { return myDoc->highlightNum(); } void KateView::setDontChangeHlOnSave() { myDoc->setDontChangeHlOnSave(); } void KateView::setHl(int n) { myDoc->setHighlight(n); myDoc->setDontChangeHlOnSave(); myDoc->updateViews(); } int KateView::getEol() { return myDoc->eolMode; } void KateView::setEol(int eol) { if (isReadOnly()) return; myDoc->eolMode = eol; myDoc->setModified(true); } void KateView::paintEvent(QPaintEvent *e) { int x, y; QRect updateR = e->rect(); // update rectangle // debug("Update rect = ( %i, %i, %i, %i )", // updateR.x(),updateR.y(), updateR.width(), updateR.height() ); int ux1 = updateR.x(); int uy1 = updateR.y(); int ux2 = ux1 + updateR.width(); int uy2 = uy1 + updateR.height(); diff --git a/noncore/apps/tinykate/main.cpp b/noncore/apps/tinykate/main.cpp index e92df69..e06668a 100644 --- a/noncore/apps/tinykate/main.cpp +++ b/noncore/apps/tinykate/main.cpp @@ -1,29 +1,28 @@ /*************************************************************************** main.cpp ------------------- begin : November 2002 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation. * * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * * * ***************************************************************************/ #include <qpe/qpeapplication.h> #include <qmainwindow.h> #include "tinykate.h" int main( int argc, char ** argv ) { QPEApplication a( argc, argv ); - TinyKate *m = new TinyKate(); - a.setMainWidget( m ); - m->showMaximized(); + TinyKate m; + a.showMainWidget(&m ); return a.exec(); } diff --git a/noncore/apps/tinykate/opie-tinykate-syntax-commondev.control b/noncore/apps/tinykate/opie-tinykate-syntax-commondev.control index 76704c1..dd5e24b 100644 --- a/noncore/apps/tinykate/opie-tinykate-syntax-commondev.control +++ b/noncore/apps/tinykate/opie-tinykate-syntax-commondev.control @@ -1,9 +1,9 @@ Package: opie-tinykate-syntax-commondev Files: share/tinykate/syntax/c.xml share/tinykate/syntax/cpp.xml share/tinykate/syntax/gnuassembler.xml share/tinykate/syntax/kbasic.xml share/tinykate/syntax/pascal.xml share/tinykate/syntax/perl.xml share/tinykate/syntax/php.xml share/tinykate/syntax/python.xml share/tinykate/syntax/ruby.xml share/tinykate/syntax/sql.xml share/tinykate/syntax/tcl.xml share/tinykate/syntax/xml.xml share/tinykate/syntax/xmldebug.xml share/tinykate/syntax/java.xml Priority: optional Section: opie/applications Maintainer: Opie Team <opie@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal, opie-tinykate Description: Syntax Highlighting Patterns for for common programming languages for TinyKate +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tinykate/opie-tinykate-syntax-documentation.control b/noncore/apps/tinykate/opie-tinykate-syntax-documentation.control index 9f60156..c47acc0 100644 --- a/noncore/apps/tinykate/opie-tinykate-syntax-documentation.control +++ b/noncore/apps/tinykate/opie-tinykate-syntax-documentation.control @@ -1,9 +1,9 @@ Package: opie-tinykate-syntax-documentation Files: share/tinykate/syntax/latex.xml share/tinykate/syntax/postscript.xml share/tinykate/syntax/sgml.xml Priority: optional Section: opie/applications Maintainer: Opie Team <opie@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal, opie-tinykate Description: Syntax Highlighting Patterns for document oriented languages for TinyKate +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tinykate/opie-tinykate-syntax-misc.control b/noncore/apps/tinykate/opie-tinykate-syntax-misc.control index 4e0f529..0e80518 100644 --- a/noncore/apps/tinykate/opie-tinykate-syntax-misc.control +++ b/noncore/apps/tinykate/opie-tinykate-syntax-misc.control @@ -1,9 +1,9 @@ Package: opie-tinykate-syntax-misc Files: share/tinykate/syntax/idconsole.xml share/tinykate/syntax/matlab.xml share/tinykate/syntax/verilog.xml share/tinykate/syntax/vhdl.xml Priority: optional Section: opie/applications Maintainer: Opie Team <opie@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal, opie-tinykate Description: Syntax Highlighting Patterns for misc languages for TinyKate +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tinykate/opie-tinykate-syntax-miscdev.control b/noncore/apps/tinykate/opie-tinykate-syntax-miscdev.control index 3c8f61a..3f7ea0d 100644 --- a/noncore/apps/tinykate/opie-tinykate-syntax-miscdev.control +++ b/noncore/apps/tinykate/opie-tinykate-syntax-miscdev.control @@ -1,9 +1,9 @@ Package: opie-tinykate-syntax-miscdev Files: share/tinykate/syntax/ada.xml share/tinykate/syntax/eiffel.xml share/tinykate/syntax/ferite.xml share/tinykate/syntax/fortran.xml share/tinykate/syntax/haskell.xml share/tinykate/syntax/literate-haskell.xml share/tinykate/syntax/objectivec.xml share/tinykate/syntax/sather.xml share/tinykate/syntax/scheme.xml Priority: optional Section: opie/applications Maintainer: Opie Team <opie@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal, opie-tinykate Description: Syntax Highlighting Patterns for for uncommon programming languages for TinyKate +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tinykate/opie-tinykate-syntax-unix.control b/noncore/apps/tinykate/opie-tinykate-syntax-unix.control index 36e88b5..ea4e026 100644 --- a/noncore/apps/tinykate/opie-tinykate-syntax-unix.control +++ b/noncore/apps/tinykate/opie-tinykate-syntax-unix.control @@ -1,9 +1,9 @@ Package: opie-tinykate-syntax-unix Files: share/tinykate/syntax/cs.xml share/tinykate/syntax/bash.xml share/tinykate/syntax/changelog.xml share/tinykate/syntax/desktop.xml share/tinykate/syntax/diff.xml share/tinykate/syntax/mab.xml share/tinykate/syntax/makefile.xml share/tinykate/syntax/rpmspec.xml share/tinykate/syntax/sml.xml share/tinykate/syntax/winehq.xml Priority: optional Section: opie/applications Maintainer: Opie Team <opie@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal, opie-tinykate Description: Syntax Highlighting Patterns for UNIX/Linux specific files for TinyKate +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tinykate/opie-tinykate-syntax-web.control b/noncore/apps/tinykate/opie-tinykate-syntax-web.control index 46fe64a..8f9c71a 100644 --- a/noncore/apps/tinykate/opie-tinykate-syntax-web.control +++ b/noncore/apps/tinykate/opie-tinykate-syntax-web.control @@ -1,9 +1,9 @@ Package: opie-tinykate-syntax-web Files: share/tinykate/syntax/css.xml share/tinykate/syntax/html.xml share/tinykate/syntax/javascript.xml Priority: optional Section: opie/applications Maintainer: Opie Team <opie@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal, opie-tinykate Description: Syntax Highlighting Patterns for for common programming languages for TinyKate +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tinykate/opie-tinykate-syntax.control b/noncore/apps/tinykate/opie-tinykate-syntax.control index c4156fc..712933c 100644 --- a/noncore/apps/tinykate/opie-tinykate-syntax.control +++ b/noncore/apps/tinykate/opie-tinykate-syntax.control @@ -1,9 +1,9 @@ Package: opie-tinykate-syntax Priority: optional Section: opie/applications Maintainer: Opie Team <opie@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal, opie-tinykate, opie-tinykate-syntax-commondev, opie-tinykate-syntax-documentation, opie-tinykate-syntax-misc, opie-tinykate-syntax-miscdev, opie-tinykate-syntax-unix, opie-tinykate-syntax-web Description: Syntax Highlighting Patterns virtual package, which installs all available syntax patterns. Files: +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tinykate/opie-tinykate.control b/noncore/apps/tinykate/opie-tinykate.control index 95dd7e0..731375c 100644 --- a/noncore/apps/tinykate/opie-tinykate.control +++ b/noncore/apps/tinykate/opie-tinykate.control @@ -1,9 +1,9 @@ Package: opie-tinykate Files: bin/tinykate apps/Applications/tinykate.desktop pics/tinykate $OPIEDIR/lib/libtinykate.so.1.0.0 $OPIEDIR/lib/libtinykate.so.1.0 $OPIEDIR/lib/libtinykate.so.1 Priority: optional Section: opie/applications Maintainer: Opie Team <opie@handhelds.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal Description: Kate for opie +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/apps/tinykate/tinykate.cpp b/noncore/apps/tinykate/tinykate.cpp index dda8405..f470645 100644 --- a/noncore/apps/tinykate/tinykate.cpp +++ b/noncore/apps/tinykate/tinykate.cpp @@ -1,321 +1,283 @@ /*************************************************************************** tinykate.cpp Tiny KATE mainwindow ------------------- begin : November 2002 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> ***************************************************************************/ /*************************************************************************** * * - * This program is free software; you can redistribute it and/or modify * + * This program is free softwaSre; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation. * * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * * * ***************************************************************************/ #include <qwidget.h> #include <qaction.h> #include <qlayout.h> -#include <qpe/qpetoolbar.h> -#include <qpe/qpemenubar.h> +#include <qtoolbutton.h> +#include <qmenubar.h> #include <qpe/resource.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> #include <opie/ofiledialog.h> -#include "cgotoline.h" - #include "tinykate.h" #include <katedocument.h> #include <katehighlight.h> #include <kateview.h> #include <kglobal.h> TinyKate::TinyKate( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f ) -{ +{ + shutDown=false; nextUnnamed=0; currentView=0; viewCount=0; - setCaption("TinyKATE : line 1 col 1"); + setCaption(tr("TinyKATE")); KGlobal::setAppName("TinyKATE"); - curLine=curCol=1; - - setToolBarsMovable(FALSE); - - QPEToolBar *bar = new QPEToolBar( this ); - bar->setHorizontalStretchable( TRUE ); - QPEMenuBar *mb = new QPEMenuBar( bar ); - mb->setMargin( 0 ); + QMenuBar *mb = new QMenuBar( this ); + mb->setMargin( 0 ); tabwidget=new OTabWidget(this); setCentralWidget(tabwidget); connect(tabwidget,SIGNAL(currentChanged( QWidget *)),this,SLOT(slotCurrentChanged(QWidget *))); //FILE ACTIONS QPopupMenu *popup = new QPopupMenu( this ); // Action for creating a new document - QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, CTRL+Key_N, this, 0 ); + QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); a->addTo( popup ); connect(a, SIGNAL(activated()), this, SLOT(slotNew())); // Action for opening an exisiting document - a = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, CTRL+Key_O, this, 0 ); + a = new QAction( tr( "Open" ),Resource::loadPixmap( "fileopen" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotOpen())); // Action for saving document - a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ), QString::null, CTRL+Key_S, this, 0 ); + a = new QAction( tr( "Save" ), Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSave())); // Action for saving document to a new name - a = new QAction( tr( "Save As" ), Resource::loadPixmap( "save" ), QString::null, 0, this, 0 ); + a = new QAction( tr( "Save As" ),Resource::loadPixmap( "save" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotSaveAs())); // Action for closing the currently active document - a = new QAction( tr( "Close" ), Resource::loadPixmap( "close" ), QString::null, CTRL+Key_W, this, 0 ); + a = new QAction( tr( "Close" ), Resource::loadPixmap( "quit_icon" ) , QString::null, 0, this, 0 ); a->addTo(popup); connect(a, SIGNAL(activated()), this, SLOT(slotClose())); - + mb->insertItem(tr("File"),popup); //EDIT ACTIONS // Action for cutting text - editCut = new QAction( tr( "Cut" ), Resource::loadPixmap( "cut" ), QString::null, CTRL+Key_X, this, 0 ); - editCut->addTo( bar ); + editCut = new QToolButton( 0 ); + editCut->setAutoRaise( true ); + editCut->setIconSet( Resource::loadPixmap( "cut" ) ); // Action for Copying text - editCopy = new QAction( tr( "Copy" ), Resource::loadPixmap( "copy" ), QString::null, CTRL+Key_C, this, 0 ); - editCopy->addTo( bar ); + editCopy = new QToolButton( 0 ); + editCopy->setAutoRaise( true ); + editCopy->setIconSet( Resource::loadPixmap( "copy" ) ); // Action for pasting text - editPaste = new QAction( tr( "Paste" ), Resource::loadPixmap( "paste" ), QString::null, CTRL+Key_V, this, 0 ); - editPaste->addTo( bar ); - + editPaste = new QToolButton( 0 ); + editPaste->setAutoRaise( true ); + editPaste->setIconSet( Resource::loadPixmap( "paste" ) ); // Action for finding / replacing text - editFindReplace = new QAction( tr( "Replace" ), Resource::loadPixmap("find"), QString::null, CTRL+Key_R, this, 0 ); - editFind = new QAction( tr( "Find" ), Resource::loadPixmap("find"), QString::null, CTRL+Key_F, this, 0 ); - editFind->addTo( bar ); + editFindReplace = new QToolButton( 0 ); + editFindReplace->setAutoRaise( true ); + editFindReplace->setIconSet( Resource::loadPixmap("find") ); - // Action for undo - editUndo = new QAction( tr( "Undo" ), Resource::loadPixmap( "undo" ), QString::null, CTRL+Key_Z, this, 0 ); - editUndo->addTo( bar ); + // Action for undo + editUndo = new QToolButton( 0 ); + editUndo->setAutoRaise( true ); + editUndo->setIconSet( Resource::loadPixmap( "undo" ) ); // Action for redo - editRedo = new QAction( tr( "Redo" ), Resource::loadPixmap( "redo" ), QString::null, CTRL+SHIFT+Key_Z, this, 0 ); - editRedo->addTo( bar ); - + editRedo = new QToolButton( 0 ); + editRedo->setAutoRaise( true ); + editRedo->setIconSet( Resource::loadPixmap( "redo" ) ); //VIEW ACITONS popup = new QPopupMenu( this ); - - a = new QAction( tr( "Goto" ), QString::null, CTRL+Key_G, this, 0 ); - a->addTo( popup ); - connect(a, SIGNAL(activated()), this, SLOT(slotGoTo())); - + viewIncFontSizes = new QAction( tr( "Font +" ), QString::null, 0, this, 0 ); viewIncFontSizes->addTo( popup ); viewDecFontSizes = new QAction( tr( "Font -" ), QString::null, 0, this, 0 ); viewDecFontSizes->addTo( popup ); - mb->insertItem(tr("View"),popup); + mb->insertItem(tr("View"),popup); + popup = new QPopupMenu( this ); + mb->insertItem(tr("Utils"),popup); - popup = new QPopupMenu( this ); - mb->insertItem(tr("Utils"),popup); + mb->insertItem( editCut ); + mb->insertItem( editCopy ); + mb->insertItem( editPaste ); + mb->insertItem( editFindReplace ); + mb->insertItem( editUndo ); + mb->insertItem( editRedo ); + //Highlight management hlmenu=new QPopupMenu(this); HlManager *hlm=HlManager::self(); for (int i=0;i<hlm->highlights();i++) { hlmenu->insertItem(hlm->hlName(i),i); } popup->insertItem(tr("Highlighting"),hlmenu); utilSettings = new QAction( tr( "Settings" ), QString::null, 0, this, 0 ); utilSettings->addTo( popup); - popup->insertSeparator(); - editFind->addTo(popup); - editFindReplace->addTo(popup); - if( qApp->argc() > 1) open(qApp->argv()[1]); else slotNew(); } TinyKate::~TinyKate( ) { qWarning("TinyKate destructor\n"); - printf("~TinyKate()\n"); + + shutDown=true; + while (currentView!=0) { + slotClose(); + } + if( KGlobal::config() != 0 ) { - printf("~TinyKate(): delete configs...\n"); qWarning("deleting KateConfig object..\n"); delete KGlobal::config(); } } void TinyKate::slotOpen( ) { QString filename = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, QString::null); if (!filename.isEmpty()) { open(filename); } } void TinyKate::open(const QString & filename) { KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; QFileInfo fi(filename); QString filenamed = fi.fileName(); tabwidget->addTab(kv=kd->createView(tabwidget,"bLAH"),"tinykate/tinykate", filenamed ); qDebug(filename); kd->setDocName( filenamed); kd->open( filename ); viewCount++; } -void TinyKate::setDocument(const QString &doc) +void TinyKate::setDocument(const QString& fileref) { - printf("tinykate: setDocument(\"%s\")\n",(const char*)doc); - open(doc); + open( fileref ); } void TinyKate::slotCurrentChanged( QWidget * view) { if (currentView) { disconnect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); disconnect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); disconnect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); disconnect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); disconnect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); - disconnect(editFindReplace,SIGNAL(activated()),currentView,SLOT(replace())); - disconnect(editFind,SIGNAL(activated()),currentView,SLOT(find())); - disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); - disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); + disconnect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); + disconnect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); disconnect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); disconnect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); - disconnect(currentView,SIGNAL(newCurPos()),this,SLOT(slotCursorMoved())); } currentView=(KTextEditor::View*)view; - - connect(editCopy,SIGNAL(activated()),currentView,SLOT(copy())); - connect(editCut,SIGNAL(activated()),currentView,SLOT(cut())); - connect(editPaste,SIGNAL(activated()),currentView,SLOT(paste())); - connect(editUndo,SIGNAL(activated()),currentView,SLOT(undo())); - connect(editRedo,SIGNAL(activated()),currentView,SLOT(redo())); - connect(editFindReplace,SIGNAL(activated()),currentView,SLOT(replace())); - connect(editFind,SIGNAL(activated()),currentView,SLOT(find())); + + connect(editCopy,SIGNAL(clicked()),currentView,SLOT(copy())); + connect(editCut,SIGNAL(clicked()),currentView,SLOT(cut())); + connect(editPaste,SIGNAL(clicked()),currentView,SLOT(paste())); + connect(editUndo,SIGNAL(clicked()),currentView,SLOT(undo())); + connect(editRedo,SIGNAL(clicked()),currentView,SLOT(redo())); connect(viewIncFontSizes,SIGNAL(activated()), currentView,SLOT(slotIncFontSizes())); connect(viewDecFontSizes,SIGNAL(activated()), currentView,SLOT(slotDecFontSizes())); connect(hlmenu,SIGNAL(activated(int)), currentView,SLOT(setHl(int))); connect(utilSettings,SIGNAL(activated()), currentView,SLOT(configDialog())); - connect(currentView,SIGNAL(newCurPos()),this,SLOT(slotCursorMoved())); + } void TinyKate::slotNew( ) { KateDocument *kd= new KateDocument(false, false, this,0,this); KTextEditor::View *kv; tabwidget->addTab(kv=kd->createView(tabwidget,"BLAH"), "tinykate/tinykate", tr("Unnamed %1").arg(nextUnnamed++)); viewCount++; } void TinyKate::slotClose( ) { if (currentView==0) return; KTextEditor::View *dv=currentView; currentView=0; tabwidget->removePage(dv); delete dv->document(); viewCount--; - if (!viewCount) slotNew(); + if ((!viewCount) && (!shutDown)) slotNew(); } void TinyKate::slotSave() { // feel free to make this how you want if (currentView==0) return; // KateView *kv = (KateView*) currentView; KateDocument *kd = (KateDocument*) currentView->document(); // qDebug("saving file "+kd->docName()); if( kd->docName().isEmpty()) slotSaveAs(); else kd->saveFile(); // kv->save(); // kd->saveFile(); } void TinyKate::slotSaveAs() { if (currentView==0) return; KateDocument *kd = (KateDocument*) currentView->document(); QString filename=OFileDialog::getSaveFileName(OFileSelector::EXTENDED_ALL, QString::null); if (!filename.isEmpty()) { qDebug("saving file "+filename); QFileInfo fi(filename); QString filenamed = fi.fileName(); kd->setDocFile( filename); kd->setDocName( filenamed); kd->saveFile(); // KTextEditor::View *dv = currentView; // tabwidget->changeTab( dv, filenamed); // need to change tab label here } } - -void TinyKate::slotGoTo() -{ - int l,c; - if (currentView==0) return; - - currentView->getCursorPosition(&l,&c); - - CGotoLine g(l); - - if(g.exec()==QDialog::Accepted) - { - currentView->setCursorPosition( g.line(), c ); - } -} - -void TinyKate::slotCursorMoved() -{ - char buf[100]; - int newLine,newCol; - currentView->getCursorPosition(&newLine,&newCol); - newLine++; - newCol++; - if((newLine!=curLine)||(newCol!=curCol)) - { - sprintf(buf,"TinyKATE : line %-6d col %d",newLine,newCol); - setCaption(buf); - curLine=newLine; - curCol=newCol; - } -} diff --git a/noncore/apps/tinykate/tinykate.h b/noncore/apps/tinykate/tinykate.h index 077d5f0..2bf4de6 100644 --- a/noncore/apps/tinykate/tinykate.h +++ b/noncore/apps/tinykate/tinykate.h @@ -1,75 +1,64 @@ /*************************************************************************** tinykate.h Tiny KATE mainwindow ------------------- begin : November 2002 copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org> ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation. * * ONLY VERSION 2 OF THE LICENSE IS APPLICABLE * * * ***************************************************************************/ #ifndef __TINYKATE_H__ #define __TINYKATE_H__ #include <qmainwindow.h> #include <opie/otabwidget.h> #include <ktexteditor.h> +class QToolButton; class QAction; class QPopupMenu; -class CGotoLine; class TinyKate : public QMainWindow { Q_OBJECT public: TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0); ~TinyKate( ); public slots: void slotNew(); + void setDocument(const QString& fileref); protected slots: void slotOpen(); void slotClose(); void slotCurrentChanged(QWidget *); void slotSave(); void slotSaveAs(); - void slotGoTo(); - void slotCursorMoved(); - void setDocument(const QString &doc); - protected: void open(const QString&); private: QString currentFileName; OTabWidget *tabwidget; KTextEditor::View *currentView; - - QAction *editCopy; - QAction *editCut; - QAction *editPaste; - QAction *editUndo; - QAction *editRedo; - QAction *editFind; - QAction *editFindReplace; - QAction *viewIncFontSizes; - QAction *viewDecFontSizes; - QAction *utilSettings; - + bool shutDown; + + QToolButton *editCopy, *editCut, *editPaste, *editUndo, *editRedo, *editFindReplace; + QAction *viewIncFontSizes, *viewDecFontSizes, *utilSettings; + QPopupMenu *hlmenu; uint nextUnnamed; uint viewCount; - int curLine,curCol; }; #endif // __TINYKATE_H__ diff --git a/noncore/apps/tinykate/tinykate.pro b/noncore/apps/tinykate/tinykate.pro index f7ff451..632bd49 100644 --- a/noncore/apps/tinykate/tinykate.pro +++ b/noncore/apps/tinykate/tinykate.pro @@ -1,22 +1,22 @@ -TEMPLATE = app -CONFIG = qt warn_on release -DESTDIR = $(OPIEDIR)/bin -HEADERS = tinykate.h cgotoline.h -SOURCES = tinykate.cpp main.cpp cgotoline.cpp -INTERFACES = cgotobase.ui -INCLUDEPATH += $(OPIEDIR)/include \ - $(OPIEDIR)/noncore/apps/tinykate/libkate \ - $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ +TEMPLATE = app +CONFIG = qt warn_on release +DESTDIR = $(OPIEDIR)/bin +HEADERS = tinykate.h +SOURCES = tinykate.cpp main.cpp +INTERFACES = +INCLUDEPATH += $(OPIEDIR)/include \ + $(OPIEDIR)/noncore/apps/tinykate/libkate \ + $(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \ $(OPIEDIR)/noncore/apps/tinykate/libkate/document \ $(OPIEDIR)/noncore/apps/tinykate/libkate/view \ $(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \ $(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \ $(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back -DEPENDPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe -ltinykate -lopie -TARGET = tinykate +TARGET = tinykate include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 45a6663..42093cf 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -951,196 +951,208 @@ void MainWindow :: applyChanges() QList<InstallData> workingPackages; workingPackages.setAutoDelete( TRUE ); for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); item != 0 ; item = (QCheckListItem *)item->nextSibling() ) { if ( item->isOn() ) { InstallData *instdata = dealWithItem( item ); if ( instdata ) workingPackages.append( instdata ); else return; } } if ( workingPackages.count() == 0 ) { // Nothing to do QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) ); return; } // do the stuff InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); reloadDocuments = TRUE; stack->addWidget( dlg, 3 ); stack->raiseWidget( dlg ); } // decide what to do - either remove, upgrade or install // Current rules: // If not installed - install // If installed and different version available - upgrade // If installed and version up to date - remove InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) { QString name = item->text(); // Get package Server *s = mgr->getServer( serversList->currentText() ); Package *p = s->getPackage( name ); // If the package has a filename then it is a local file if ( p->isPackageStoredLocally() ) name = p->getFilename(); QString option; QString dest = "root"; if ( !p->isInstalled() ) { InstallData *newitem = new InstallData(); newitem->option = "I"; newitem->packageName = name; return newitem; } else { InstallData *newitem = new InstallData(); newitem->option = "D"; + + // If local file, remove using package name, not filename + if ( p->isPackageStoredLocally() ) + name = item->text(); + if ( !p->isPackageStoredLocally() ) newitem->packageName = p->getInstalledPackageName(); else newitem->packageName = name; if ( p->getInstalledTo() ) { newitem->destination = p->getInstalledTo(); } else { newitem->destination = p->getLocalPackage()->getInstalledTo(); } // Now see if version is newer or not int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); // If the version requested is older and user selected a local ipk file, then reinstall the file if ( p->isPackageStoredLocally() && val == -1 ) val = 0; if ( val == -2 ) { // Error - should handle } else if ( val == -1 ) { // Version available is older - remove only newitem->option = "D"; + + // If local file, remove using package name, not filename + if ( p->isPackageStoredLocally() ) + name = item->text(); } else { QString caption; QString text; QString secondButton; QString secondOption; if ( val == 0 ) { // Version available is the same - option to remove or reinstall caption = tr( "Do you wish to remove or reinstall\n%1?" ); text = tr( "Remove or ReInstall" ); secondButton = tr( "ReInstall" ); secondOption = "R"; // Internal action code, do not translate } else if ( val == 1 ) { // Version available is newer - option to remove or upgrade caption = tr( "Do you wish to remove or upgrade\n%1?" ); text = tr( "Remove or Upgrade" ); secondButton = tr( "Upgrade" ); secondOption = "U"; // Internal action code, do not translate } // Sticky option not implemented yet, but will eventually allow // the user to say something like 'remove all' if ( stickyOption == "" ) { QString msgtext; msgtext = caption.arg( ( const char * )name ); QuestionDlg dlg( text, msgtext, secondButton ); switch( dlg.exec() ) { case 0: // Cancel delete newitem; return 0x0; break; case 1: // Remove newitem->option = "D"; + // If local file, remove using package name, not filename + if ( p->isPackageStoredLocally() ) + name = item->text(); break; case 2: // Reinstall or Upgrade newitem->option = secondOption; break; } } else { // newitem->option = stickyOption; } } // Check if we are reinstalling the same version if ( newitem->option != "R" ) newitem->recreateLinks = true; else newitem->recreateLinks = false; // User hit cancel (on dlg - assume remove) return newitem; } } void MainWindow :: reloadData( InstallDlgImpl *dlg ) { stack->raiseWidget( progressWindow ); if ( dlg ) { dlg->close(); delete dlg; } mgr->reloadServerData(); serverSelected( -1, FALSE ); #ifdef QWS if ( reloadDocuments ) { m_status->setText( tr( "Updating Launcher..." ) ); // Finally let the main system update itself QCopEnvelope e("QPE/System", "linkChanged(QString)"); QString lf = QString::null; e << lf; } #endif stack->raiseWidget( networkPkgWindow ); } void MainWindow :: letterPushed( QString t ) { QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); if ( packagesList->firstChild() == 0 ) return; QCheckListItem *item; if ( start == 0 ) { item = (QCheckListItem *)packagesList->firstChild(); start = top; diff --git a/noncore/settings/aqpkg/opie-aqpkg.control b/noncore/settings/aqpkg/opie-aqpkg.control index b8ad1e8..46bffdd 100644 --- a/noncore/settings/aqpkg/opie-aqpkg.control +++ b/noncore/settings/aqpkg/opie-aqpkg.control @@ -1,11 +1,11 @@ Package: opie-aqpkg Files: bin/aqpkg pics/aqpkg apps/Settings/aqpkg.desktop Priority: optional Section: Settings -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal Replaces: aqpkg Architecture: arm Maintainer: Andy Qua (andy.qua@blueyonder.co.uk) Description: A Package Manager +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/settings/aqpkg/package.cpp b/noncore/settings/aqpkg/package.cpp index adda832..5a521d3 100644 --- a/noncore/settings/aqpkg/package.cpp +++ b/noncore/settings/aqpkg/package.cpp @@ -55,108 +55,109 @@ Package::Package( char *name ) packageName = name; QString tempstr = QObject::tr( "N/A" ); version = tempstr; description = tempstr; packageSize = tempstr; section = tempstr; localPackage = 0; installed = false; packageStoredLocally = false; installedToRoot = false; installed = false; installedTo = 0; differentVersionAvailable = false; } Package::~Package() { } QString Package :: toString() { QString ret = QObject::tr( "Package - %1\n version - %2" ). arg( getPackageName() ). arg( getVersion() ); if ( localPackage ) ret.append( QObject::tr( "\n inst version - %1" ).arg( localPackage->getVersion() ) ); return ret; } void Package :: setStatus( const QString &s ) { QString state_status; int two, three; status = s.simplifyWhiteSpace( ); two = status.find( " " ); // find second column three = status.find( " ", two + 1 ); // find third column state_status = status.mid( three ).stripWhiteSpace( ); if ( state_status == "installed" ) installed = true; } void Package :: setLocalPackage( Package *p ) { localPackage = p; if ( localPackage ) if ( localPackage->getVersion() < getVersion() && !installed ) differentVersionAvailable = true; else differentVersionAvailable = false; } void Package :: setVersion( const QString &v ) { version = v; + differentVersionAvailable = false; if ( localPackage ) if ( localPackage->getVersion() < getVersion() && !installed ) differentVersionAvailable = true; else differentVersionAvailable = false; } void Package :: setPackageName( const QString &name ) { packageName = name; } void Package :: setDescription( const QString &d ) { description = d; } void Package :: setFilename( const QString &f ) { filename = f; } QString Package :: getInstalledVersion() { if ( localPackage ) return localPackage->getVersion(); else return getVersion(); } QString Package :: getInstalledPackageName() { if ( localPackage ) return localPackage->getPackageName(); else return getPackageName(); } bool Package :: isInstalled() { return installed || ( localPackage && localPackage->isInstalled() ); } diff --git a/noncore/settings/aqpkg/packagewin.cpp b/noncore/settings/aqpkg/packagewin.cpp index 9553cd1..499d647 100644 --- a/noncore/settings/aqpkg/packagewin.cpp +++ b/noncore/settings/aqpkg/packagewin.cpp @@ -1,118 +1,119 @@ /* This file is part of the OPIE Project =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> .=l. Dan Williams <drw@handhelds.org> .>+-= _;:, .> :=|. This file is free software; you can .> <`_, > . <= redistribute it and/or modify it under :`=1 )Y*s>-.-- : the terms of the GNU General Public .="- .-=="i, .._ License as published by the Free Software - . .-<_> .<> Foundation; either version 2 of the License, ._= =} : or (at your option) any later version. .%`+i> _;_. .i_,=:_. -<s. This file is distributed in the hope that + . -:. = it will be useful, but WITHOUT ANY WARRANTY; : .. .:, . . . without even the implied warranty of =_ + =;=|` MERCHANTABILITY or FITNESS FOR A _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "packagewin.h" #include "package.h" #include "datamgr.h" #include <qpe/resource.h> #include <qlayout.h> #include <qpushbutton.h> #include <qstring.h> #include <qtextview.h> PackageWindow::PackageWindow( Package *package, const QString &server ) : QWidget( 0, 0, 0 ) { QString str; if ( package ) { + Package *local = package->getLocalPackage(); setCaption( package->getPackageName() ); QString destName; - if ( package->getLocalPackage() ) + if ( local ) { - if ( package->getLocalPackage()->getInstalledTo() ) + if ( local->getInstalledTo() ) destName = package->getLocalPackage()->getInstalledTo()->getDestinationName(); } else { if ( package->getInstalledTo() ) destName = package->getInstalledTo()->getDestinationName(); } if ( !package->isPackageStoredLocally() ) { str.append( tr( "<b>Description</b> - " ) ); str.append( package->getDescription() ); if ( !destName.isNull() ) { str.append( tr( "<p><b>Installed To</b> - " ) ); str.append( destName ); } str.append( tr( "<p><b>Size</b> - " ) ); str.append( package->getPackageSize() ); str.append( tr( "<p><b>Section</b> - " ) ); str.append( package->getSection() ); } else { str.append( tr( "<p><b>Filename</b> - " ) ); str.append( package->getFilename() ); } if ( server == LOCAL_SERVER ) { str.append( tr( "<p><b>Version Installed</b> - " ) ); str.append( package->getVersion() ); } else { str.append( tr( "<p><b>Version Available</b> - " ) ); str.append( package->getVersion() ); - if ( package->getLocalPackage() ) + if ( local ) { if ( package->isInstalled() ) { str.append( tr( "<p><b>Version Installed</b> - " ) ); str.append( package->getInstalledVersion() ); } } } } else { setCaption( tr( "Package Information" ) ); str = tr( "Package information is unavailable" ); } QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 ); QTextView *l = new QTextView( str, QString::null, this ); layout->addWidget( l ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "enter" ), tr( "Close" ), this ); layout->addWidget( btn ); connect( btn, SIGNAL( clicked() ), this, SLOT( close() ) ); } PackageWindow::~PackageWindow() { } diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp index 4693db1..0282236 100644 --- a/noncore/settings/aqpkg/server.cpp +++ b/noncore/settings/aqpkg/server.cpp @@ -58,258 +58,269 @@ Server :: ~Server() cleanUp(); } void Server :: cleanUp() { packageList.clear(); } void Server :: readStatusFile( QList<Destination> &destList ) { cleanUp(); Destination *dest; QListIterator<Destination> dit( destList ); bool rootRead = false; for ( ; dit.current(); ++dit ) { dest = dit.current(); bool installingToRoot = false; QString path = dest->getDestinationPath(); if ( path.right( 1 ) != "/" ) path.append( "/" ); if ( path == "/" ) { rootRead = true; installingToRoot = true; } packageFile = path; packageFile.append( "usr/lib/ipkg/status" ); readPackageFile( 0, false, installingToRoot, &( *dest ) ); } // Ensure that the root status file is read if ( !rootRead ) { packageFile = "/usr/lib/ipkg/status"; readPackageFile( 0, false, true ); } } void Server :: readLocalIpks( Server *local ) { cleanUp(); #ifdef QWS // First, get any local IPKGs in the documents area // Only applicable to Qtopie/Opie DocLnkSet files; Global::findDocuments( &files, "application/ipkg" ); // Now add the items to the list QListIterator<DocLnk> it( files.children() ); for ( ; it.current() ; ++it ) { // OK, we have a local IPK file, I think the standard naming conventions // for these are packagename_version_arm.ipk QString file = (*it)->file(); // Changed to display the filename (excluding the path) - QString packageName = Utils::getFilenameFromIpkFilename( file ); + QString packageName = Utils::getPackageNameFromIpkFilename( file ); QString ver = Utils::getPackageVersionFromIpkFilename( file ); Package *package = new Package( packageName ); package->setVersion( ver ); package->setFilename( file ); package->setPackageStoredLocally( true ); packageList.append( package ); } #else QString names[] = { "advancedfm_0.9.1-20020811_arm.ipk", "libopie_0.9.1-20020811_arm.ipk", "libopieobex_0.9.1-20020811.1_arm.ipk", "opie-addressbook_0.9.1-20020811_arm.ipk" }; for ( int i = 0 ; i < 4 ; ++i ) { // OK, we have a local IPK file, I think the standard naming conventions // for these are packagename_version_arm.ipk QString file = names[i]; int p = file.find( "_" ); QString tmp = file.mid( 0, p ); packageList.push_back( Package( tmp ) ); int p2 = file.find( "_", p+1 ); tmp = file.mid( p+1, p2-(p+1) ); packageList.back().setVersion( tmp ); packageList.back().setPackageStoredLocally( true ); } #endif // build local packages buildLocalPackages( local ); } void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest ) { QFile f( packageFile ); if ( !f.open( IO_ReadOnly ) ) return; QTextStream t( &f ); QString line; QString key; QString value; int pos; if ( clearAll ) cleanUp(); Package *currPackage = 0; bool newPackage = true; while ( !t.eof() ) { line = t.readLine(); pos = line.find( ':', 0 ); if ( pos > -1 ) key = line.mid( 0, pos ).stripWhiteSpace(); else key = QString::null; value = line.mid( pos+1, line.length()-pos ).stripWhiteSpace(); if ( key == "Package" && newPackage ) { newPackage = false; currPackage = getPackage( value ); if ( !currPackage ) { Package *package = new Package( value ); packageList.append( package ); currPackage = package; currPackage->setInstalledTo( dest ); if ( installingToRoot ) currPackage->setInstalledToRoot( true ); } else { if ( currPackage->isInstalled() ) currPackage->setInstalledTo( dest ); } } else if ( key == "Version" ) { if ( currPackage ) currPackage->setVersion( value ); } else if ( key == "Status" ) { if ( currPackage ) currPackage->setStatus( value ); } else if ( key == "Description" ) { if ( currPackage ) currPackage->setDescription( value ); } else if ( key == "Filename" ) { if ( currPackage ) currPackage->setFilename( value ); } else if ( key == "Size" ) { if ( currPackage ) currPackage->setPackageSize( value ); } else if ( key == "Section" ) { if ( currPackage ) currPackage->setSection( value ); DataManager::setAvailableCategories( value ); } else if ( key == QString::null ) { newPackage = true; } } f.close(); // build local packages buildLocalPackages( local ); } void Server :: buildLocalPackages( Server *local ) { Package *curr; QListIterator<Package> it( packageList ); + + QList<Package> *locallist = &local->getPackageList(); + for ( ; it.current(); ++it ) { curr = it.current(); QString name = curr->getPackageName(); // If the package name is an ipk name, then convert the filename to a package name if ( name.find( ".ipk" ) != -1 ) name = Utils::getPackageNameFromIpkFilename( curr->getFilename() ); if ( local ) { Package *p = local->getPackage( name ); curr->setLocalPackage( p ); if ( p ) { + // Replace local version + if ( curr->getVersion() > p->getVersion() ) + { + int pos = locallist->at(); + locallist->remove( p ); + locallist->insert( pos, curr ); + } + // Set some default stuff like size and things if ( p->getInstalledVersion() == curr->getVersion() ) { p->setPackageSize( curr->getPackageSize() ); p->setSection( curr->getSection() ); p->setDescription( curr->getDescription() ); } } } else curr->setLocalPackage( 0 ); } } Package *Server :: getPackage( QString &name ) { return getPackage( (const char *)name ); } Package *Server :: getPackage( const char *name ) { Package *ret = 0; QListIterator<Package> it( packageList ); for ( ; it.current(); ++it ) { if ( it.current()->getPackageName() == name ) ret = it.current(); } return ret; } QString Server :: toString() { QString ret = QString( "Server\n name - %1\n url - %2\n" ).arg( serverName ).arg( serverUrl ); QListIterator<Package> it( packageList ); for ( ; it.current(); ++it ) { ret.append( QString( "\n %1" ).arg( it.current()->toString() ) ); } return ret; } QList<Package> &Server::getPackageList() { return packageList; } diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp index 3d127a8..8def0d6 100644 --- a/noncore/settings/sysinfo/modulesinfo.cpp +++ b/noncore/settings/sysinfo/modulesinfo.cpp @@ -1,193 +1,191 @@ /********************************************************************** ** ModulesInfo ** ** Display Modules information ** ** Copyright (C) 2002, Michael Lauer ** mickey@tm.informatik.uni-frankfurt.de ** http://www.Vanille.de ** ** Based on ProcessInfo by Dan Williams <williamsdr@acm.org> ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** **********************************************************************/ #include <qpe/qpeapplication.h> #include <qcombobox.h> #include <qfile.h> #include <qheader.h> #include <qlayout.h> #include <qlistview.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qstring.h> #include <qtimer.h> #include <qwhatsthis.h> #include "modulesinfo.h" #include "detail.h" ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 4 ); layout->setMargin( 4 ); ModulesView = new QListView( this ); int colnum = ModulesView->addColumn( tr( "Module" ) ); colnum = ModulesView->addColumn( tr( "Size" ) ); ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); colnum = ModulesView->addColumn( tr( "Use#" ) ); ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); - colnum = ModulesView->addColumn( tr( "Used By" ) ); + colnum = ModulesView->addColumn( tr( "Used by" ) ); ModulesView->setAllColumnsShowFocus( TRUE ); layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 ); QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) ); // Test if we have /sbin/modinfo, and if so, allow module detail window if ( QFile::exists( "/sbin/modinfo" ) ) { QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), this, SLOT( viewModules( QListViewItem * ) ) ); } CommandCB = new QComboBox( FALSE, this ); CommandCB->insertItem( "modprobe -r" ); CommandCB->insertItem( "rmmod" ); // I can't think of other useful commands yet. Anyone? layout->addWidget( CommandCB, 1, 0 ); QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command to module selected above." ) ); QPushButton *btn = new QPushButton( this ); btn->setMinimumSize( QSize( 50, 24 ) ); btn->setMaximumSize( QSize( 50, 24 ) ); btn->setText( tr( "Send" ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); layout->addWidget( btn, 1, 1 ); QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) ); QTimer *t = new QTimer( this ); connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); t->start( 5000 ); updateData(); ModulesDtl = new Detail(); QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) ); } ModulesInfo::~ModulesInfo() { } void ModulesInfo::updateData() { char modname[64]; char usage[200]; int modsize, usecount; QString selectedmod; QListViewItem *curritem = ModulesView->currentItem(); if ( curritem ) { selectedmod = curritem->text( 0 ); } ModulesView->clear(); FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); if ( procfile ) { QListViewItem *newitem; QListViewItem *selecteditem = 0x0; while ( true ) { int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); if ( success == EOF ) break; QString qmodname = QString( modname ); QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' ); QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' ); QString qusage = QString( usage ); newitem = new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); if ( qmodname == selectedmod ) { selecteditem = newitem; } } ModulesView->setCurrentItem( selecteditem ); fclose( procfile ); } } void ModulesInfo::slotSendClicked() { if ( !ModulesView->currentItem() ) { return; } - QString capstr = tr( "You really want to execute\n" ); - capstr.append( CommandCB->currentText() ); - capstr.append( "\nfor this module?" ); + QString capstr = tr( "You really want to execute %1 for this module?" ).arg( CommandCB->currentText() ); QString modname = ModulesView->currentItem()->text( 0 ); if ( QMessageBox::warning( this, modname, capstr, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) { QString command = "/sbin/"; command.append( CommandCB->currentText() ); command.append( " " ); command.append( modname ); FILE* stream = popen( command, "r" ); if ( stream ) pclose( stream ); } } void ModulesInfo::viewModules( QListViewItem *modules ) { QString modname = modules->text( 0 ); QString capstr = "Module: "; capstr.append( modname ); ModulesDtl->setCaption( capstr ); QString command = "/sbin/modinfo "; command.append( modname ); FILE* modinfo = popen( command, "r" ); if ( modinfo ) { char line[200]; ModulesDtl->detailView->setText( " Details:\n------------\n" ); while( true ) { int success = fscanf( modinfo, "%[^\n]\n", line ); if ( success == EOF ) break; ModulesDtl->detailView->append( line ); } pclose( modinfo ); } ModulesDtl->showMaximized(); } diff --git a/noncore/settings/sysinfo/opie-sysinfo.control b/noncore/settings/sysinfo/opie-sysinfo.control index acb51e5..8250174 100644 --- a/noncore/settings/sysinfo/opie-sysinfo.control +++ b/noncore/settings/sysinfo/opie-sysinfo.control @@ -1,10 +1,10 @@ Package: opie-sysinfo Files: bin/sysinfo apps/Settings/sysinfo.desktop pics/sysinfo Priority: optional Section: opie/applications Maintainer: Dan Williams <williamsdr@acm.org> Architecture: arm -Version: $QPE_VERSION-$SUB_VERSION Depends: task-opie-minimal, libopie1 Description: System Information dialog For the Opie environment. +Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp index 1de1a19..8dec9be 100644 --- a/noncore/settings/sysinfo/processinfo.cpp +++ b/noncore/settings/sysinfo/processinfo.cpp @@ -103,103 +103,101 @@ void ProcessInfo::updateData() QString selectedpid; QListViewItem *curritem = ProcessView->currentItem(); if ( curritem ) { selectedpid = curritem->text( 0 ); } ProcessView->clear(); QListViewItem *newitem; QListViewItem *selecteditem = 0x0; QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs); QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList())); if ( proclist ) { QFileInfoListIterator it(*proclist); QFileInfo *f; while ( ( f = it.current() ) != 0 ) { ++it; QString processnum = f->fileName(); if ( processnum >= "1" && processnum <= "99999" ) { FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r"); if ( procfile ) { fscanf( procfile, "%d %s %c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u", &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt, &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout, &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan ); processnum = processnum.rightJustify( 5, ' ' ); QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" ); QString processstatus = QChar(state); QString processtime = QString::number( ( utime + stime ) / 100 ); processtime = processtime.rightJustify( 9, ' ' ); fclose( procfile ); newitem = new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); if ( processnum == selectedpid ) { selecteditem = newitem; } } } } ProcessView->setCurrentItem( selecteditem ); } delete proclist; delete procdir; } void ProcessInfo::slotSendClicked() { QListViewItem *currprocess = ProcessView->currentItem(); if ( !currprocess ) { return; } - QString capstr = tr( "You really want to send\n" ); - capstr.append( SignalCB->currentText() ); - capstr.append( "\nto this process?" ); + QString capstr = tr( "You really want to send %1 to this process?" ).arg( SignalCB->currentText() ); if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) { currprocess = ProcessView->currentItem(); if ( currprocess ) { QString sigstr = SignalCB->currentText(); sigstr.truncate(2); int sigid = sigstr.toUInt(); kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid ); } } } void ProcessInfo::viewProcess( QListViewItem *process ) { QString pid= process->text( 0 ).stripWhiteSpace(); QString command = process->text( 1 ); ProcessDtl->setCaption( pid + " - " + command ); FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); if ( statfile ) { char line[81]; fgets( line, 81, statfile ); ProcessDtl->detailView->setText( line ); while ( fgets( line, 81, statfile ) ) { ProcessDtl->detailView->append( line ); } fclose( statfile ); } ProcessDtl->showMaximized(); } |