23 files changed, 82 insertions, 88 deletions
diff --git a/noncore/apps/advancedfm/advancedfmMenu.cpp b/noncore/apps/advancedfm/advancedfmMenu.cpp index 26bc36d..78f9da2 100644 --- a/noncore/apps/advancedfm/advancedfmMenu.cpp +++ b/noncore/apps/advancedfm/advancedfmMenu.cpp @@ -195,120 +195,118 @@ void AdvancedFm::doDelete() { } break; case 1: // exit break; }; } else { if(doMsg) { switch ( QMessageBox::warning(this,tr("Delete"), tr("Really delete\n%1?").arg( myFile ), tr("Yes"), tr("No"), 0, 0, 1) ) { case 1: return; break; }; } QString cmd="rm "+f; QFile file(f); QFileInfo fi(myFile); if( fi.fileName().find("../",0,TRUE)==-1) { // qDebug("remove link files "+myFile); // DocLnk lnk(f); DocLnk *lnk; lnk = new DocLnk(f); // qDebug("Deleting doclnk " + lnk->linkFile()); if(lnk->isValid()) lnk->removeLinkFile(); // delete lnk; file.remove(); } } } } populateView(); } void AdvancedFm::filePerms() { QStringList curFileList = getPath(); QString filePath; filePath = CurrentDir()->canonicalPath()+"/"; for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { filePermissions *filePerm; filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(filePath+*it)); - filePerm->showMaximized(); - filePerm->exec(); + QPEApplication::execDialog( filePerm );
if( filePerm) delete filePerm; } populateView(); } void AdvancedFm::doProperties() { #if defined(QT_QWS_OPIE) QStringList curFileList = getPath(); QString filePath; filePath = CurrentDir()->canonicalPath()+"/"; // qDebug("%d",curFileList.count()); for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { // qDebug((filePath+*it)); DocLnk lnk( (filePath+*it)); LnkProperties prop( &lnk ); - prop.showMaximized(); - prop.exec(); + QPEApplication::execDialog( &prop );
} #endif } void AdvancedFm::upDir() { QDir *thisDir = CurrentDir(); QString current = thisDir->canonicalPath(); QDir dir(current); dir.cdUp(); current = dir.canonicalPath(); chdir( current.latin1() ); thisDir->cd( current, TRUE); populateView(); update(); } void AdvancedFm::copy() { qApp->processEvents(); QStringList curFileList = getPath(); QDir *thisDir = CurrentDir(); QDir *thatDir = OtherDir(); bool doMsg=true; int count=curFileList.count(); if( count > 0) { if(count > 1 ){ QString msg; msg=tr("Really copy\n%1 files?").arg(count); switch ( QMessageBox::warning(this,tr("Copy"),msg ,tr("Yes"),tr("No"),0,0,1) ) { case 0: doMsg=false; break; case 1: return; break; }; } QString curFile, item, destFile; for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { item=(*it); if(item.find("->",0,TRUE)) //symlink item = item.left(item.find("->",0,TRUE)); @@ -556,136 +554,134 @@ bool AdvancedFm::copyFile( const QString & src, const QString & dest ) { QString msg; switch(err) { case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; case EINVAL: msg = "Descriptor is not valid or locked. "; case ENOMEM: msg = "Insufficient memory to read from in_fd."; case EIO: msg = "Unspecified error while reading from in_fd."; }; success = false; // qWarning(msg); } } else { success = false; } } else { success = false; } srcFile.close(); destFile.close(); // Set file permissions if( stat( (const char *) src, &status ) == 0 ) { chmod( (const char *) dest, status.st_mode ); } return success; } void AdvancedFm::runCommand() { if( !CurrentView()->currentItem()) return; QDir *thisDir = CurrentDir(); QString curFile; curFile = thisDir->canonicalPath() +"/"+ CurrentView()->currentItem()->text(0); InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); fileDlg->setInputText(curFile); fileDlg->exec(); //QString command; if( fileDlg->result() == 1 ) { // qDebug(fileDlg->LineEdit1->text()); QStringList command; command << "/bin/sh"; command << "-c"; command << fileDlg->LineEdit1->text(); Output *outDlg; outDlg = new Output( command, this, tr("AdvancedFm Output"), true); - outDlg->showMaximized(); - outDlg->exec(); + QPEApplication::execDialog( outDlg );
qApp->processEvents(); } } void AdvancedFm::runCommandStd() { if( !CurrentView()->currentItem()) return; QString curFile; QDir *thisDir = CurrentDir(); QListView *thisView = CurrentView(); if( thisView->currentItem()) curFile = thisDir->canonicalPath() +"/"+ thisView->currentItem()->text(0); InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Run Command"),TRUE, 0); fileDlg->setInputText(curFile); fileDlg->exec(); if( fileDlg->result() == 1 ) { qApp->processEvents(); startProcess( (const QString)fileDlg->LineEdit1->text().latin1()); } } void AdvancedFm::fileStatus() { if( !CurrentView()->currentItem()) return; QString curFile; curFile = CurrentView()->currentItem()->text(0); QStringList command; command << "/bin/sh"; command << "-c"; command << "stat -l "+ curFile; Output *outDlg; outDlg = new Output( command, this, tr("AdvancedFm Output"), true); - outDlg->showMaximized(); - outDlg->exec(); + QPEApplication::execDialog( outDlg );
qApp->processEvents(); } void AdvancedFm::mkDir() { makeDir(); } void AdvancedFm::rn() { renameIt(); } void AdvancedFm::del() { doDelete(); } void AdvancedFm::mkSym() { QString cmd; QStringList curFileList = getPath(); if( curFileList.count() > 0) { QDir *thisDir = CurrentDir(); QDir * thatDir = OtherDir(); for ( QStringList::Iterator it = curFileList.begin(); it != curFileList.end(); ++it ) { QString destName = thatDir->canonicalPath()+"/"+(*it); if(destName.right(1) == "/") { destName = destName.left( destName.length() -1); } QString curFile = thisDir->canonicalPath()+"/"+(*it); if( curFile.right(1) == "/") { curFile = curFile.left( curFile.length() -1); } cmd = "ln -s "+curFile+" "+destName; // qDebug(cmd); startProcess( (const QString)cmd ); } rePopulate(); setOtherTabCurrent(); } } void AdvancedFm::doBeam() { Ir ir; if(!ir.supported()) { diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index a42c824..a5492e4 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp @@ -438,145 +438,143 @@ void Checkbook::slotPasswordClicked() delete pw; return; } else { passwordCB->setChecked( TRUE ); } delete pw; } } void Checkbook::slotNameChanged( const QString &newname ) { info->setName( newname ); // TODO - need filedir // QString namestr = filedir; // namestr.append( newname ); // namestr.append( ".qcb" ); // info->setFilename( namestr ); QString namestr = newname; namestr.append( " - " ); namestr.append( tr( "Checkbook" ) ); setCaption( namestr ); } // ---slotStartingBalanceChanged ---------------------------------------------- void Checkbook::slotStartingBalanceChanged( const QString &newbalance ) { bool ok; info->setStartingBalance( newbalance.toFloat( &ok ) ); adjustBalance(); } // --- slotNewTran ------------------------------------------------------------ void Checkbook::slotNewTran() { TranInfo *traninfo = new TranInfo( info->getNextNumber() ); if( !_dLastNew.isNull() ) traninfo->setDate(_dLastNew); Transaction *currtran = new Transaction( this, true, info->name(), traninfo, _pCfg ); - currtran->showMaximized(); - if ( currtran->exec() == QDialog::Accepted ) + if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted ) { // Add to transaction list info->addTransaction( traninfo ); // Add to transaction table float amount; QString stramount; amount = (traninfo->withdrawal() ? -1 : 1)*traninfo->amount(); stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); ( void ) new CBListItem( traninfo, tranTable, traninfo->getIdStr(), traninfo->datestr(false), traninfo->number(), traninfo->datestr(true), traninfo->desc(), stramount ); resort(); adjustBalance(); // save last date _dLastNew = traninfo->date(); // save description in list of payees, if not in there QStringList *pLst=&_pCfg->getPayees(); if( _pCfg->getSavePayees() && pLst->contains(traninfo->desc())==0 ) { pLst->append( traninfo->desc() ); pLst->sort(); _pCfg->setDirty(true); } } else { delete traninfo; } } // --- slotEditTran ----------------------------------------------------------- void Checkbook::slotEditTran() { QListViewItem *curritem = tranTable->currentItem(); if ( !curritem ) return; TranInfo *traninfo=info->findTransaction( curritem->text(COL_ID) ); Transaction *currtran = new Transaction( this, false, info->name(), traninfo, _pCfg ); - currtran->showMaximized(); - if ( currtran->exec() == QDialog::Accepted ) + if ( QPEApplication::execDialog( currtran ) == QDialog::Accepted ) { curritem->setText( COL_NUM, traninfo->number() ); curritem->setText( COL_SORTDATE, traninfo->datestr(false) ); curritem->setText( COL_DATE, traninfo->datestr(true) ); curritem->setText( COL_DESC, traninfo->desc() ); float amount = traninfo->amount(); if ( traninfo->withdrawal() ) { amount *= -1; } QString stramount; stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount ); curritem->setText( COL_AMOUNT, stramount ); resort(); adjustBalance(); // save description in list of payees, if not in there QStringList *pLst=&_pCfg->getPayees(); if( _pCfg->getSavePayees() && pLst->contains(traninfo->desc())==0 ) { pLst->append( traninfo->desc() ); pLst->sort(); _pCfg->setDirty(true); } } delete currtran; } // --- slotMenuTran ----------------------------------------------------------- void Checkbook::slotMenuTran(QListViewItem *item, const QPoint &pnt) { // active item? if( !item ) return; // Display menu QPopupMenu m; m.insertItem( QWidget::tr( "Edit" ), 1 ); m.insertItem( QWidget::tr( "New" ), 2 ); m.insertItem( QWidget::tr( "Delete" ), 3 ); int r = m.exec( pnt ); switch(r) { case 1: slotEditTran(); break; case 2: slotNewTran(); diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index f29001a..60aea42 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp @@ -1,91 +1,91 @@ /* This file is part of the OPIE Project =. .=l. Copyright (c) 2002 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 "mainwindow.h" #include "cbinfo.h" #include "configuration.h" #include "password.h" #include "checkbook.h" #include "listedit.h" #include <qpe/config.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> -#include <qmenubar.h> #include <qpe/qpemessagebox.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> +#include <qmenubar.h> #include <qaction.h> #include <qcheckbox.h> #include <qdir.h> #include <qlineedit.h> #include <qwhatsthis.h> MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) : QMainWindow( parent, name, WStyle_ContextHelp ) { setCaption( tr( "Checkbook" ) ); cbDir = Global::applicationFileName( "checkbook", "" ); lockIcon = Resource::loadPixmap( "locked" ); // Load configuration options Config config( "checkbook" ); _cfg.readConfig( config ); // Build menu and tool bars setToolBarsMovable( FALSE ); QToolBar *bar = new QToolBar( this ); bar->setHorizontalStretchable( TRUE ); QMenuBar *mb = new QMenuBar( bar ); mb->setMargin( 0 ); QPopupMenu *popup = new QPopupMenu( this ); bar = new QToolBar( this ); QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) ); connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); a->addTo( popup ); a->addTo( bar ); actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 ); actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) ); connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); actionOpen->addTo( popup ); actionOpen->addTo( bar ); actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); actionDelete->addTo( popup ); @@ -169,197 +169,194 @@ void MainWindow::buildList() } cbList->addColumn( tr( "Checkbook Name" ) ); if ( _cfg.getShowBalances() ) { int colnum = cbList->addColumn( tr( "Balance" ) ); cbList->setColumnAlignment( colnum, Qt::AlignRight ); } cbList->setAllColumnsShowFocus( TRUE ); cbList->setSorting( posName ); QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); connect( cbList, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), this, SLOT( slotEdit() ) ); setCentralWidget( cbList ); for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) { addCheckbook( cb ); } } void MainWindow::addCheckbook( CBInfo *cb ) { QListViewItem *lvi = new QListViewItem( cbList ); if ( _cfg.getShowLocks() && !cb->password().isNull() ) { lvi->setPixmap( 0, lockIcon ); } lvi->setText( posName, cb->name() ); if ( _cfg.getShowBalances() ) { QString balance; balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); lvi->setText( posName + 1, balance ); } } void MainWindow::buildFilename( const QString &name ) { tempFilename = cbDir; tempFilename.append( name ); tempFilename.append( ".qcb" ); } void MainWindow::slotNew() { CBInfo *cb = new CBInfo(); Checkbook *currcb = new Checkbook( this, cb, &_cfg ); - currcb->showMaximized(); - if ( currcb->exec() == QDialog::Accepted ) + if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) { // Save new checkbook buildFilename( cb->name() ); _cfg.setLastBook( cb->name() ); cb->setFilename( tempFilename ); cb->write(); // Add to listbox checkbooks->inSort( cb ); addCheckbook( cb ); } delete currcb; } // --- slotEdit --------------------------------------------------------------- void MainWindow::slotEdit() { // get name and open it QListViewItem *curritem = cbList->currentItem(); if ( !curritem ) return; openBook( curritem ); } // --- openBook --------------------------------------------------------------- void MainWindow::openBook(QListViewItem *curritem) { // find book in List QString currname=curritem->text(posName); CBInfo *cb = checkbooks->first(); while ( cb ) { if ( cb->name() == currname ) break; cb = checkbooks->next(); } if ( !cb ) return; // buildFilename( currname ); float currbalance = cb->balance(); bool currlock = !cb->password().isNull(); if ( currlock ) { Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) { delete pw; return; } delete pw; } _cfg.setLastBook( currname ); Checkbook *currcb = new Checkbook( this, cb, &_cfg ); - currcb->showMaximized(); - if ( currcb->exec() == QDialog::Accepted ) + if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) { QString newname = cb->name(); if ( currname != newname ) { // Update name if changed if( curritem ) { curritem->setText( posName, newname ); cbList->sort(); } _cfg.setLastBook( newname ); // Remove old file QFile f( tempFilename ); if ( f.exists() ) f.remove(); // Get new filename buildFilename( newname ); cb->setFilename( tempFilename ); } cb->write(); // Update lock if changed if ( _cfg.getShowLocks() && !cb->password().isNull() != currlock ) { if ( !cb->password().isNull() ) curritem->setPixmap( 0, lockIcon ); else curritem->setPixmap( 0, nullIcon ); } // Update balance if changed if ( _cfg.getShowBalances() && cb->balance() != currbalance ) { QString tempstr; tempstr.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); curritem->setText( posName + 1, tempstr ); } // write config, if needed if( _cfg.isDirty() ) { Config config("checkbook"); _cfg.writeConfig( config ); } } delete currcb; } // --- slotDelete ------------------------------------------------------------- void MainWindow::slotDelete() { QString currname = cbList->currentItem()->text( posName ); if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), currname ) ) { buildFilename( currname ); QFile f( tempFilename ); if ( f.exists() ) { f.remove(); } delete cbList->currentItem(); } } // --- slotConfigure ---------------------------------------------------------- void MainWindow::slotConfigure() { Configuration *cfgdlg = new Configuration( this, _cfg ); - cfgdlg->showMaximized(); - if ( cfgdlg->exec() == QDialog::Accepted ) + if ( QPEApplication::execDialog( cfgdlg ) == QDialog::Accepted ) { // read data from config dialog & save it cfgdlg->saveConfig( _cfg ); writeConfig(); buildList(); } delete cfgdlg; } // --- writeConfig -------------------------------------------------------------- void MainWindow::writeConfig() { Config config("checkbook"); _cfg.writeConfig( config ); } diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp index 2103df9..b12a395 100644 --- a/noncore/apps/odict/configdlg.cpp +++ b/noncore/apps/odict/configdlg.cpp @@ -1,104 +1,105 @@ /*************************************************************************** application: : ODict begin : December 2002 copyright : ( C ) 2002, 2003 by Carsten Niehaus email : cniehaus@handhelds.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; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "configdlg.h" #include "searchmethoddlg.h" -#include <qdialog.h> +#include <qpe/qpeapplication.h> #include <qpe/config.h> -#include <qlayout.h> +#include <qdialog.h> +#include <qlayout.h> #include <qhbox.h> #include <qvbox.h> #include <qlabel.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlineedit.h> #include <qstringlist.h> ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) { setCaption( tr( "Options" ) ); QVBoxLayout *vbox_layout = new QVBoxLayout( this ); search_tab = new QWidget( this , "search_tab" ); QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" ); QHBox *hbox = new QHBox( search_tab ); list = new QListView( hbox ); list->addColumn( tr( "Searchmethod" ) ); loadSearchMethodNames(); QVBox *vbox = new QVBox( hbox ); new_button = new QPushButton( tr( "New" ) , vbox ); change_button = new QPushButton( tr( "Change" ) , vbox ); delete_button = new QPushButton( tr( "Delete" ) , vbox ); connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) ); connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() )); connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() )); vbox_layout_searchtab->addWidget( hbox ); vbox_layout->addWidget( search_tab ); - showMaximized(); + QPEApplication::execDialog( this ); } void ConfigDlg::slotNewMethod() { SearchMethodDlg dlg( this, "SearchMethodDlg", true ); if ( dlg.exec() == QDialog::Accepted ) { dlg.saveItem(); QListViewItem *item = new QListViewItem( list ); item->setText( 0 , dlg.nameLE->text() ); } } void ConfigDlg::slotChangeMethod() { if ( list->selectedItem() ) { SearchMethodDlg dlg( this, "SearchMethodDlg", true, list->selectedItem()->text( 0 ) ); if ( dlg.exec() == QDialog::Accepted ) { dlg.saveItem(); QListViewItem *item = list->selectedItem(); item->setText( 0 , dlg.nameLE->text() ); } } } void ConfigDlg::slotDeleteMethod() { if ( list->selectedItem() ) { Config cfg ( "odict" ); cfg.setGroup( "Method_"+list->selectedItem()->text(0) ); cfg.clearGroup(); //FIXME: this only removes the entries but not the group itself list->takeItem( list->selectedItem() ); } } void ConfigDlg::loadSearchMethodNames() { Config cfg( "odict" ); QStringList groupListCfg = cfg.groupList().grep( "Method_" ); for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it ) { QListViewItem *item = new QListViewItem( list ); cfg.setGroup( *it ); diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp index 99cd8db..8ed7152 100644 --- a/noncore/apps/odict/searchmethoddlg.cpp +++ b/noncore/apps/odict/searchmethoddlg.cpp @@ -1,108 +1,109 @@ /*************************************************************************** application: : ODict begin : December 2002 copyright : ( C ) 2002, 2003 by Carsten Niehaus email : cniehaus@handhelds.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; either version 2 of the License, or * * ( at your option ) any later version. * * * **************************************************************************/ #include "searchmethoddlg.h" -#include <qdialog.h> #include <qpe/config.h> -#include <qlayout.h> +#include <qpe/qpeapplication.h> +#include <qdialog.h> +#include <qlayout.h> #include <qhbox.h> #include <qvbox.h> #include <qlabel.h> #include <qpushbutton.h> #include <qstring.h> #include <qlineedit.h> #include <qdir.h> #include <opie/ofileselector.h> #include <opie/ofiledialog.h> SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal) { QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" ); QVBox *vbox = new QVBox( this ); QHBox *hbox1 = new QHBox( vbox ); QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 ); nameLE = new QLineEdit( hbox1 ); QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox ); QHBox *hbox2 = new QHBox( vbox ); dictFileLE = new QLineEdit( hbox2 ); QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 ); connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) ); QWidget *dummywidget = new QWidget( vbox ); QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget); QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget); QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget); lang1 = new QLineEdit( dummywidget ); lang2 = new QLineEdit( dummywidget ); trenner = new QLineEdit( dummywidget ); trenner->setText( "::" ); QGridLayout *grid = new QGridLayout( dummywidget, 2,3 ); grid->addWidget( lag1, 0,0 ); grid->addWidget( devider, 0,1 ); grid->addWidget( lag2, 0,2 ); grid->addWidget( lang1, 1,0 ); grid->addWidget( trenner, 1,1 ); grid->addWidget( lang2, 1,2 ); vbox_layout->addWidget( vbox ); - showMaximized(); + QPEApplication::execDialog ( this ); if( !itemname ) setCaption( tr( "New Searchmethod" ) ); else { setCaption( tr( "Change Searchmethod" ) ); itemName = itemname; setupEntries(itemname); } } void SearchMethodDlg::setupEntries( QString item ) { Config cfg( "odict" ); cfg.setGroup( "Method_"+itemName ); trenner->setText( cfg.readEntry( "Seperator" ) ); lang1->setText( cfg.readEntry( "Lang1" ) ); lang2->setText( cfg.readEntry( "Lang2" ) ); nameLE->setText( itemName ); dictFileLE->setText( cfg.readEntry( "file" ) ); } void SearchMethodDlg::slotBrowse() { itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,QDir::homeDirPath()); dictFileLE->setText( itemName ); } void SearchMethodDlg::saveItem() { QString name = nameLE->text(); Config cfg( "odict" ); cfg.setGroup( "Method_"+name ); cfg.writeEntry( "Name", name ); cfg.writeEntry( "Seperator", trenner->text() ); cfg.writeEntry( "Lang1", lang1->text() ); cfg.writeEntry( "Lang2", lang2->text() ); cfg.writeEntry( "file", dictFileLE->text() ); } diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp index 8c4ee93..cd0a364 100644 --- a/noncore/apps/opie-bartender/bartender.cpp +++ b/noncore/apps/opie-bartender/bartender.cpp @@ -124,324 +124,320 @@ Bartender::Bartender( QWidget* parent, const char* name, WFlags fl ) dbFile.setName( QPEApplication::qpeDir()+"/etc/bartender/drinkdb.txt"); initDrinkDb(); } Bartender::~Bartender() { } /* this happens right before exit */ void Bartender::cleanUp() { dbFile.close(); } void Bartender::initDrinkDb() { if(!dbFile.isOpen()) if ( !dbFile.open( IO_ReadOnly)) { QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); return; } fillList(); } void Bartender::fillList() { dbFile.at(1); DrinkView->clear(); int i=0; QListViewItem * item ; QTextStream t( &dbFile); QString s; while ( !t.eof()) { s = t.readLine(); if(s.find("#",0,TRUE) != -1) { // qDebug(s.right(s.length()-2)); item= new QListViewItem( DrinkView, 0 ); item->setText( 0, s.right(s.length()-2)); i++; } } qDebug("there are currently %d of drinks", i); } void Bartender::fileNew() { New_Drink *newDrinks; newDrinks = new New_Drink(this,"New Drink....", TRUE); QString newName, newIng; - newDrinks->showMaximized(); - newDrinks->exec(); + QPEApplication::execDialog( newDrinks ); newName = newDrinks->LineEdit1->text(); newIng= newDrinks->MultiLineEdit1->text(); if(dbFile.isOpen()) dbFile.close(); if ( !dbFile.open( IO_WriteOnly| IO_Append)) { QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); return; } if(newDrinks ->result() == 1 ) { QString newDrink="\n# "+newName+"\n"; newDrink.append(newIng+"\n"); qDebug("writing "+newDrink); dbFile.writeBlock( newDrink.latin1(), newDrink.length()); clearList(); dbFile.close(); initDrinkDb(); } delete newDrinks; } void Bartender::showDrink(int mouse, QListViewItem * item, const QPoint&, int) { switch (mouse) { case 1: // showDrink(item); break; case 2: showDrink(item); break; } } void Bartender::showDrink( QListViewItem *item) { if(item==NULL) return; dbFile.at(0); Show_Drink *showDrinks; QString myDrink=item->text(0); showDrinks = new Show_Drink(this, myDrink, TRUE); QTextStream t( &dbFile); QString s, s2; while ( !t.eof()) { s = t.readLine(); if(s.find( myDrink, 0, TRUE) != -1) { for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { s2 = t.readLine(); if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { // qDebug(s2); showDrinks->MultiLineEdit1->append(s2); } if( dbFile.atEnd() ) break; } } } - showDrinks->showMaximized(); - showDrinks->exec(); + QPEApplication::execDialog( showDrinks ); if(showDrinks ->result() ==0) { doEdit(); } delete showDrinks; } void Bartender::askSearch() { switch ( QMessageBox::warning(this,tr("Find"),tr("Search by drink name\n")+ "\nor alcohol ?" ,tr("Drink Name"),tr("Alcohol"),0,0,1) ) { case 0: doSearchByName(); break; case 1: doSearchByDrink(); break; }; } /* search by name */ void Bartender::doSearchByName() { // if( DrinkView->currentItem() == NULL) return; QStringList searchList; QString searchForDrinkName; InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Find by Drink Name"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { searchForDrinkName = fileDlg->LineEdit1->text(); QListViewItemIterator it( DrinkView ); for ( ; it.current(); ++it ) { if ( it.current()->text(0).find( searchForDrinkName, 0, TRUE) != -1 ) { // qDebug( it.current()->text(0)); searchList.append(it.current()->text(0)); } } if(searchList.count() >0) showSearchResult(searchList); else QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+searchForDrinkName); }//end Inputdialog delete fileDlg; } void Bartender::doSearchByDrink() { // if( DrinkView->currentItem() == NULL) return; QStringList searchList; QString searchForDrinkName, lastDrinkName, tempName; InputDialog *fileDlg; fileDlg = new InputDialog(this,tr("Find by Alcohol"),TRUE, 0); fileDlg->exec(); if( fileDlg->result() == 1 ) { searchForDrinkName = fileDlg->LineEdit1->text(); dbFile.at(0); QTextStream t( &dbFile); QString s, s2; while ( !t.eof()) { s = t.readLine(); if(s.find("#",0,TRUE) != -1) { lastDrinkName=s.right(s.length()-2); // qDebug("last drink name "+lastDrinkName); } else if( s.find( searchForDrinkName ,0, FALSE) != -1 && lastDrinkName != tempName ) { // qDebug("appending "+lastDrinkName); searchList.append( lastDrinkName); tempName=lastDrinkName; } // if( dbFile.atEnd() ) break; } //oef if(searchList.count() >0) showSearchResult(searchList); else QMessageBox::message(tr("Search"),tr("Sorry no results for\n")+ searchForDrinkName); } delete fileDlg; } void Bartender::showSearchResult(QStringList &searchList) { QString result; Search_Results *searchDlg; searchList.sort(); searchDlg = new Search_Results(this, "Search Results", TRUE); - searchDlg->showMaximized(); searchDlg->ListBox1->insertStringList( searchList,-1); - searchDlg->exec(); + QPEApplication::execDialog( searchDlg ); if( searchDlg->result() == 1 ) { result= searchDlg->ListBox1->currentText(); } QListViewItemIterator it2( DrinkView ); for ( ; it2.current(); ++it2 ) { if ( it2.current()->text(0)== result ) { // qDebug( it2.current()->text(0)); showDrink(it2.current()); } } delete searchDlg; } void Bartender::doEdit() { if(DrinkView->currentItem() == NULL) { fileNew(); } QString myDrink; myDrink= DrinkView->currentItem()->text(0); dbFile.at(0); int foundAt=0; New_Drink *newDrinks; newDrinks = new New_Drink(this,"Edit Drink....", TRUE); QString newName, newIng; - newDrinks->showMaximized(); + QPEApplication::showDialog( newDrinks ); QTextStream t( &dbFile); QString s, s2; while ( !t.eof()) { s = t.readLine(); if(s.find( myDrink, 0, TRUE) != -1) { foundAt = dbFile.at() - (s.length()+1); for(int i=0;s2.find( "#", 0, TRUE) == -1;i++) { s2 = t.readLine(); if(s2.find("#",0,TRUE) == -1 || dbFile.atEnd() ) { // qDebug(s2); newDrinks->MultiLineEdit1->append(s2); newDrinks->LineEdit1->setText(myDrink); } if( dbFile.atEnd() ) break; } } } newDrinks->exec(); newName = newDrinks->LineEdit1->text(); newIng= newDrinks->MultiLineEdit1->text(); if( newDrinks ->result() == 1 ) { if(dbFile.isOpen()) dbFile.close(); if ( !dbFile.open( IO_ReadWrite )) { QMessageBox::message( (tr("Note")), (tr("Drink database not opened sucessfully.\n")) ); return; } int fd = dbFile.handle(); lseek( fd, foundAt, SEEK_SET); // dbFile.at( foundAt); #warning FIXME problems with editing drinks db ////////// FIXME write to user file QString newDrink="# "+newName+"\n"; newDrink.append(newIng+"\n"); qDebug("writing "+newDrink); dbFile.writeBlock( newDrink.latin1(), newDrink.length()); clearList(); dbFile.flush(); initDrinkDb(); } } void Bartender::clearList() { DrinkView->clear(); } void Bartender::doBac() { BacDialog *bacDlg; bacDlg = new BacDialog(this,"BAC",TRUE); - bacDlg->showMaximized(); - bacDlg->exec(); + QPEApplication::execDialog( bacDlg ); delete bacDlg; } void Bartender::openCurrentDrink() { if(DrinkView->currentItem() == NULL) return; showDrink(DrinkView->currentItem()); } void Bartender::fileMenuActivated( int item) { qDebug("Item %d", item); switch(item) { case -3: // new -3 fileNew(); break; case -4:// open -4 openCurrentDrink(); break; case -5:// drink -5 doSearchByName(); break; case -6:// alcohol -6 doSearchByDrink(); break; } } void Bartender::editMenuActivated(int item) { qDebug("Item %d", item); /* edit -8 */ switch(item) { case -8: doEdit() ; break; } } diff --git a/noncore/apps/opie-console/configdialog.cpp b/noncore/apps/opie-console/configdialog.cpp index b23f4d0..882cd3d 100644 --- a/noncore/apps/opie-console/configdialog.cpp +++ b/noncore/apps/opie-console/configdialog.cpp @@ -1,111 +1,111 @@ -#include <qlistview.h> +#include <qpe/qpeapplication.h> + +#include <qlistview.h> #include "configdialog.h" #include "profileeditordialog.h" class ConfigListItem : public QListViewItem { public: ConfigListItem( QListView* item, const Profile& ); ~ConfigListItem(); 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(tr("Edit Connection Profile")); - dlg.showMaximized(); - int ret = dlg.exec(); + int ret = QPEApplication::execDialog( &dlg ); 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(tr("New Connection")); - dlg.showMaximized(); - int ret = dlg.exec(); + int ret = QPEApplication::execDialog( &dlg ); 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/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 2673335..3fe9040 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -1,58 +1,59 @@ #include <assert.h> #include <qaction.h> #include <qmenubar.h> #include <qtoolbar.h> #include <qmessagebox.h> #include <qwhatsthis.h> #include <qfileinfo.h> #include <qpe/filemanager.h> +#include <qpe/qpeapplication.h> #include <opie/ofiledialog.h> #include "TEmulation.h" #include "profileeditordialog.h" #include "configdialog.h" #include "default.h" #include "profilemanager.h" #include "mainwindow.h" #include "tabwidget.h" #include "transferdialog.h" #include "function_keyboard.h" #include "emulation_handler.h" #include "script.h" MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { KeyTrans::loadAll(); for (int i = 0; i < KeyTrans::count(); i++ ) { KeyTrans* s = KeyTrans::find(i ); assert( s ); } m_factory = new MetaFactory(); Default def(m_factory); m_sessions.setAutoDelete( TRUE ); m_curSession = 0; m_manager = new ProfileManager( m_factory ); m_manager->load(); m_scriptsData.setAutoDelete(TRUE); initUI(); populateProfiles(); populateScripts(); } void MainWindow::initUI() { setToolBarsMovable( FALSE ); /* tool bar for the menu */ m_tool = new QToolBar( this ); m_tool->setHorizontalStretchable( TRUE ); m_bar = new QMenuBar( m_tool ); m_console = new QPopupMenu( this ); m_scripts = new QPopupMenu( this ); m_sessionsPop= new QPopupMenu( this ); m_scriptsPop = new QPopupMenu( this ); @@ -265,99 +266,98 @@ ProfileManager* MainWindow::manager() { TabWidget* MainWindow::tabWidget() { return m_consoleWindow; } void MainWindow::populateProfiles() { m_sessionsPop->clear(); Profile::ValueList list = manager()->all(); for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { m_sessionsPop->insertItem( (*it).name() ); } } void MainWindow::populateScripts() { m_scriptsPop->clear(); m_scriptsData.clear(); DocLnkSet files(QPEApplication::documentDir(), "text/plain"); QListIterator<DocLnk> dit(files.children()); for (; dit.current(); ++dit) { if (*dit && (*dit)->name().length()>0) { QFileInfo info((*dit)->file()); if (info.extension(false) == "script") { m_scriptsData.append(new DocLnk(**dit)); m_scriptsPop->insertItem((*dit)->name()); } } } } MainWindow::~MainWindow() { delete m_factory; manager()->save(); } MetaFactory* MainWindow::factory() { return m_factory; } Session* MainWindow::currentSession() { return m_curSession; } QList<Session> MainWindow::sessions() { return m_sessions; } void MainWindow::slotNew() { ProfileEditorDialog dlg(factory() ); - dlg.showMaximized(); dlg.setCaption( tr("New Connection") ); - int ret = dlg.exec(); + int ret = QPEApplication::execDialog( &dlg ); if ( ret == QDialog::Accepted ) { create( dlg.profile() ); } } void MainWindow::slotRecordScript() { if (currentSession()) { currentSession()->emulationHandler()->startRecording(); m_saveScript->setEnabled(true); m_recordScript->setEnabled(false); } } void MainWindow::slotSaveScript() { if (currentSession() && currentSession()->emulationHandler()->isRecording()) { QMap<QString, QStringList> map; QStringList text; text << "text/plain"; map.insert(tr("Script"), text ); QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); if (!filename.isEmpty()) { QFileInfo info(filename); if (info.extension(FALSE) != "script") filename += ".script"; DocLnk nf; nf.setType("text/plain"); nf.setFile(filename); nf.setName(info.fileName()); FileManager fm; fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); currentSession()->emulationHandler()->clearScript(); m_saveScript->setEnabled(false); m_recordScript->setEnabled(true); populateScripts(); } } } void MainWindow::slotRunScript(int id) { if (currentSession()) { int index = m_scriptsPop->indexOf(id); DocLnk *lnk = m_scriptsData.at(index); QString filePath = lnk->file(); Script script(filePath); currentSession()->emulationHandler()->runScript(&script); } } @@ -380,99 +380,98 @@ void MainWindow::slotConnect() { } 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(); + int ret = QPEApplication::execDialog( &conf ); 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 */ diff --git a/noncore/apps/opie-console/modemconfigwidget.cpp b/noncore/apps/opie-console/modemconfigwidget.cpp index e552990..3466e3a 100644 --- a/noncore/apps/opie-console/modemconfigwidget.cpp +++ b/noncore/apps/opie-console/modemconfigwidget.cpp @@ -1,48 +1,51 @@ + +#include <qpe/qpeapplication.h> + #include <qlabel.h> #include <qlayout.h> #include <qcombobox.h> #include <qpushbutton.h> #include <qhbox.h> #include "modemconfigwidget.h" #include "dialdialog.h" namespace { void setCurrent( const QString& str, QComboBox* bo ) { uint b = bo->count(); for (int i = 0; i < bo->count(); i++ ) { if ( bo->text(i) == str ) { bo->setCurrentItem( i ); return; } } bo->insertItem( str ); bo->setCurrentItem( b ); } } ModemConfigWidget::ModemConfigWidget( const QString& name, QWidget* parent, const char* na ) : ProfileDialogConnectionWidget( name, parent, na ) { m_lay = new QVBoxLayout( this ); m_device = new QLabel(tr( "Modem is attached to:" ), this ); m_deviceCmb = new QComboBox(this ); m_deviceCmb->setEditable( TRUE ); QLabel* telLabel = new QLabel( this ); telLabel->setText( tr( "Enter telefon number here:" ) ); QHBox *buttonBox = new QHBox( this ); m_telNumber = new QLineEdit( buttonBox ); QPushButton *atButton = new QPushButton( buttonBox ); atButton->setText( tr( "AT commands" ) ); connect( atButton, SIGNAL( clicked() ), this, SLOT( slotAT() ) ); QPushButton *dialButton = new QPushButton( buttonBox ); dialButton->setText( tr( "Enter number" ) ); connect( dialButton, SIGNAL( clicked() ), this, SLOT( slotDial() ) ); m_base = new IOLayerBase( this, "base" ); m_lay->addWidget( m_device ); m_lay->addWidget( m_deviceCmb ); @@ -192,64 +195,62 @@ void ModemConfigWidget::save( Profile& prof ) { speed = 9600; break; } switch( m_base->data() ) { case IOLayerBase::Data_Five: data = 5; break; case IOLayerBase::Data_Six: data = 6; break; case IOLayerBase::Data_Seven: data = 7; break; case IOLayerBase::Data_Eight: data = 8; break; } switch( m_base->stop() ) { case IOLayerBase::Stop_One: stop = 1; break; case IOLayerBase::Stop_OnePointFive: stop = 15; break; case IOLayerBase::Stop_Two: stop = 2; break; } prof.writeEntry( "Flow", flow ); prof.writeEntry( "Parity", parity ); prof.writeEntry( "Speed", speed ); prof.writeEntry("DataBits", data); prof.writeEntry("StopBits", stop); prof.writeEntry( "Number", m_telNumber->text() ); atConf->writeConfig(prof); } void ModemConfigWidget::slotAT() { // ATConfigDialog conf( this, "ATConfig", true ); // josef/Max I know why don't you create the stuff on the stack // but making it a TopLevel Dialog and ignoring // cancel is not fun either... // what to do? FIXME!!! -zecke - atConf->showMaximized(); - if ( atConf->exec() != QDialog::Accepted ) { + if ( QPEApplication::execDialog( atConf ) != QDialog::Accepted ) { // reload old settings } } void ModemConfigWidget::slotDial() { DialDialog dial( this, "DialConfig", true ); if(!m_telNumber->text().isEmpty()) { dial.setNumber(m_telNumber->text().replace(QRegExp("[\\-\\/\\ \\.\\,]"), "")); } - dial.showMaximized(); - if ( dial.exec() == QDialog::Accepted ) { + if ( QPEApplication::execDialog( &dial ) == QDialog::Accepted ) { m_telNumber->setText( dial.number() ); } } diff --git a/noncore/apps/opie-reader/CloseDialog.cpp b/noncore/apps/opie-reader/CloseDialog.cpp index 741fa67..d7c2652 100644 --- a/noncore/apps/opie-reader/CloseDialog.cpp +++ b/noncore/apps/opie-reader/CloseDialog.cpp @@ -1,18 +1,21 @@ #include "CloseDialog.h" #include "qlayout.h" +#include <qpe/qpeapplication.h> + CCloseDialog::CCloseDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) { setCaption(tr("Tidy-up")); QVBoxLayout *tmp = new QVBoxLayout(this); QVButtonGroup* vb = new QVButtonGroup(tr("Delete"), this); tmp->addWidget(vb); QString filestring = tr("Delete") + " " + fname; file = new QCheckBox(filestring, vb); marks = new QCheckBox(tr("Delete Bookmarks"), vb); config = new QCheckBox(tr("Delete Configuration"), vb); file->setChecked(false); marks->setChecked(true); config->setChecked(true); - if (fs) showMaximized(); + if (fs) + QPEApplication::showDialog( this ); } diff --git a/noncore/apps/opie-reader/Prefs.cpp b/noncore/apps/opie-reader/Prefs.cpp index e5320d9..5150ca5 100644 --- a/noncore/apps/opie-reader/Prefs.cpp +++ b/noncore/apps/opie-reader/Prefs.cpp @@ -1,77 +1,79 @@ /**************************************************************************** ** 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 +#include <qpe/qpeapplication.h> + 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, 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 ) @@ -382,97 +384,98 @@ CMiscPrefs::CMiscPrefs( QWidget* parent, const char* name, WFlags fl ) 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(); + if (fs) + QPEApplication::showDialog( this ); } /* 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)"); diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp index f10020a..07af597 100644 --- a/noncore/apps/opie-reader/QTReaderApp.cpp +++ b/noncore/apps/opie-reader/QTReaderApp.cpp diff --git a/noncore/apps/opie-reader/ToolbarPrefs.cpp b/noncore/apps/opie-reader/ToolbarPrefs.cpp index 361bf97..d878829 100644 --- a/noncore/apps/opie-reader/ToolbarPrefs.cpp +++ b/noncore/apps/opie-reader/ToolbarPrefs.cpp @@ -1,94 +1,96 @@ /**************************************************************************** ** 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 "ToolbarPrefs.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> #endif
+#include <qpe/qpeapplication.h> CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true), config( appdir ) { setCaption(tr( "Toolbar Settings" ) ); QTabWidget* td = new QTabWidget(this); misc = new CMiscBarPrefs(this); filebar = new CFileBarPrefs(config, this); navbar = new CNavBarPrefs(config, this); viewbar = new CViewBarPrefs(config, this); markbar = new CMarkBarPrefs(config, this); indbar = new CIndBarPrefs(config, this); td->addTab(filebar, tr("File")); td->addTab(navbar, tr("Navigation")); td->addTab(viewbar, tr("View")); td->addTab(markbar, tr("Marks")); td->addTab(indbar, tr("Indicators")); td->addTab(misc, tr("Policy")); QVBoxLayout* v = new QVBoxLayout(this); v->addWidget(td); - if (fs) showMaximized(); + if (fs) + QPEApplication::showDialog( this ); } /* CBarPrefs1::CBarPrefs1( Config& _config, QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ), config(_config) { config.setGroup( "Toolbar" ); QVBoxLayout* vb = new QVBoxLayout(this); QGroupBox* bg = new QGroupBox(3, Qt::Horizontal, "File", this); vb->addWidget(bg); open = new QCheckBox( tr("Open"), bg ); open->setChecked(config.readBoolEntry( "Open", false )); connect(open, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); close = new QCheckBox( tr("Close"), bg ); close->setChecked(config.readBoolEntry( "Close", false )); connect(close, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); info = new QCheckBox( tr("Info"), bg ); info->setChecked(config.readBoolEntry( "Info", false )); connect(info, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); twotouch = new QCheckBox( tr("Two/One\nTouch"), bg ); twotouch->setChecked(config.readBoolEntry( "Two/One Touch", false )); connect(twotouch, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); find = new QCheckBox( tr("Find"), bg ); find->setChecked(config.readBoolEntry( "Find", false )); connect(find, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); bg = new QGroupBox(2, Qt::Horizontal, "Navigation", this); vb->addWidget(bg); scroll = new QCheckBox( tr("Scroll"), bg ); scroll->setChecked(config.readBoolEntry( "Scroll", false )); connect(scroll, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); navigation = new QCheckBox( tr("Back/Home/Forward"), bg ); navigation->setChecked(config.readBoolEntry( "Back/Home/Forward", false )); connect(navigation, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); page = new QCheckBox( tr("Page\nUp/Down"), bg ); page->setChecked(config.readBoolEntry( "Page Up/Down", false )); connect(page, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); startend = new QCheckBox( tr("Goto Start/End"), bg ); startend->setChecked(config.readBoolEntry( "Goto Start/End", false )); connect(startend, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); jump = new QCheckBox( tr("Jump"), bg ); jump->setChecked(config.readBoolEntry( "Jump", false )); connect(jump, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); pageline = new QCheckBox( tr("Page/Line Scroll"), bg ); pageline->setChecked(config.readBoolEntry( "Page/Line Scroll", false )); connect(pageline, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) ); diff --git a/noncore/apps/opie-reader/URLDialog.cpp b/noncore/apps/opie-reader/URLDialog.cpp index dd4568b..e572c80 100644 --- a/noncore/apps/opie-reader/URLDialog.cpp +++ b/noncore/apps/opie-reader/URLDialog.cpp @@ -1,14 +1,17 @@ #include "URLDialog.h" #include "qlayout.h" +#include <qpe/qpeapplication.h>
+
CURLDialog::CURLDialog(const QString& fname, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true) { setCaption(tr("Save URL")); QVBoxLayout *tmp = new QVBoxLayout(this); QVButtonGroup* vb = new QVButtonGroup(fname, this); tmp->addWidget(vb); m_clipboard = new QCheckBox(tr("Clipboard"), vb); m_localfile = new QCheckBox(tr("Local file"), vb); m_globalfile = new QCheckBox(tr("Global file"), vb); - if (fs) showMaximized(); + if (fs)
+ QPEApplication::showDialog( this );
} diff --git a/noncore/apps/opie-reader/fileBrowser.cpp b/noncore/apps/opie-reader/fileBrowser.cpp index 9cd371d..05f2c31 100644 --- a/noncore/apps/opie-reader/fileBrowser.cpp +++ b/noncore/apps/opie-reader/fileBrowser.cpp @@ -1,166 +1,169 @@ /**************************************************************************** Derived from a file browser which was ** copyright 2001 ljp ljp@llornkcor.com Extensive modification by Tim Wentford to allow it to work in rotated mode ****************************************************************************/ #include "fileBrowser.h" #include "QtrListView.h" #include <qlineedit.h> #include <qpushbutton.h> #include <qfile.h> #include <qmessagebox.h> #ifndef _WINDOWS #include <unistd.h> #endif #include <qlayout.h> #ifdef _WINDOWS #include <direct.h> #endif +#include <qpe/qpeapplication.h> + #include "opie.h" fileBrowser::fileBrowser( bool allownew, QWidget* parent, const char* name, bool modal, WFlags fl , const QString filter, const QString iPath ) : QDialog( parent, name, true, fl/* | WStyle_Customize | WStyle_Tool*/), filterspec(QDir::All) { // showMaximized(); if ( !name ) setName( "fileBrowser" ); /* if (parent != NULL) { #ifdef OPIE move(0,0); resize( parent->width(), parent->height() ); #else setGeometry(parent->x(), parent->y(), parent->width(), parent->height() ); #endif } */ // showFullScreen(); setCaption(tr( "Browse for file" ) ); filterStr=filter; buttonOk = new QPushButton( this, "buttonOk" ); buttonOk->setFixedSize( 25, 25 ); buttonOk->setAutoDefault( false ); buttonOk->setText( tr( "/" ) ); buttonShowHidden = new QPushButton( this, "buttonShowHidden" ); // buttonShowHidden->setFixedSize( 50, 25 ); buttonShowHidden->setText( tr( "Hidden" ) ); buttonShowHidden->setAutoDefault( false ); buttonShowHidden->setToggleButton( true ); buttonShowHidden->setOn( false ); dirLabel = new QLabel(this, "DirLabel"); dirLabel->setAlignment(AlignLeft | AlignVCenter | ExpandTabs | WordBreak); dirLabel->setText(currentDir.canonicalPath()); ListView = new QtrListView( this, "ListView" ); ListView->addColumn( tr( "Name" ) ); ListView->setSorting( 2, FALSE); ListView->addColumn( tr( "Size" ) ); ListView->setSelectionMode(QListView::Single); ListView->setAllColumnsShowFocus( TRUE ); ListView->setColumnWidthMode(0, QListView::Manual); ListView->setColumnWidthMode(1, QListView::Manual); // signals and slots connections connect( buttonShowHidden, SIGNAL( toggled(bool) ), this, SLOT( setHidden(bool) ) ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( OnRoot() ) ); connect( ListView, SIGNAL(doubleClicked( QListViewItem*)), SLOT(listDoubleClicked(QListViewItem *)) ); connect( ListView, SIGNAL(clicked( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); connect( ListView, SIGNAL(OnOKButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); connect( ListView, SIGNAL(OnCentreButton( QListViewItem*)), SLOT(listClicked(QListViewItem *)) ); connect( ListView, SIGNAL(OnCancelButton()), SLOT(OnCancel()) ); QVBoxLayout* grid = new QVBoxLayout(this); QHBoxLayout* hgrid = new QHBoxLayout(grid); hgrid->addWidget(dirLabel,1); hgrid->addWidget(buttonShowHidden); hgrid->addWidget(buttonOk); grid->addWidget(ListView,1); if (allownew) { m_filename = new QLineEdit(this); grid->addWidget(m_filename); connect( m_filename, SIGNAL( returnPressed() ), this, SLOT( onReturn() )); } else { m_filename = NULL; } if (QFileInfo(iPath).exists()) { currentDir.setPath(iPath); #ifdef _WINDOWS _chdir(iPath.latin1()); #else chdir(iPath.latin1()); #endif } else { currentDir.setPath(QDir::currentDirPath()); chdir(QDir::currentDirPath().latin1()); } populateList(); - if (modal) showMaximized(); + if (modal) + QPEApplication::showDialog( this ); } void fileBrowser::resizeEvent(QResizeEvent* e) { ListView->setColumnWidth(1,(ListView->width())/4); ListView->setColumnWidth(0,ListView->width()-20-ListView->columnWidth(1)); } fileBrowser::~fileBrowser() { } void fileBrowser::populateList() { ListView->clear(); ////qDebug(currentDir.canonicalPath()); // currentDir.setFilter( QDir::Files | QDir::Dirs | QDir::Hidden | QDir::NoSymLinks ); currentDir.setFilter( filterspec ); currentDir.setSorting(/* QDir::Size*/ /*| QDir::Reversed | */QDir::DirsFirst); currentDir.setMatchAllDirs(TRUE); currentDir.setNameFilter(filterStr); // currentDir.setNameFilter("*.txt;*.etx"); QString fileL, fileS; const QFileInfoList *list = currentDir.entryInfoList(); QFileInfoListIterator it(*list); QFileInfo *fi; while ( (fi=it.current()) ) { if (fi->fileName() != ".") { fileS.sprintf( "%10li", fi->size() ); fileL.sprintf( "%s",fi->fileName().data() ); if( fi->isDir() ) { fileL+="/"; } else { //// qDebug("Not a dir: "+currentDir.canonicalPath()+fileL); } new QListViewItem( ListView,fileL,fileS ); } ++it; } ListView->setSorting( 2, FALSE); dirLabel->setText("Current Directory:\n"+currentDir.canonicalPath()); diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp index bd98aca..3d3c688 100644 --- a/noncore/apps/opie-sheet/mainwindow.cpp +++ b/noncore/apps/opie-sheet/mainwindow.cpp @@ -1,71 +1,74 @@ /*************************************************************************** * * * 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. * * * ***************************************************************************/ /* * Opie Sheet (formerly Sheet/Qt) * by Serdar Ozler <sozler@sitebest.com> */ #include "mainwindow.h" #include <qpe/filemanager.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/resource.h> +#include <qpe/qpeapplication.h> + #include <qmessagebox.h> #include <qfile.h> #include <qtranslator.h> #include <qradiobutton.h> + #include "cellformat.h" #include "numberdlg.h" #include "textdlg.h" #include "sortdlg.h" #include "finddlg.h" #define DEFAULT_NUM_ROWS 300 #define DEFAULT_NUM_COLS (26*3) #define DEFAULT_NUM_SHEETS 3 MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl) :QMainWindow(parent, n, fl) { // initialize variables documentModified=FALSE; // construct objects currentDoc=0; fileSelector=new FileSelector("application/sheet-qt", this, QString::null); ExcelSelector=new FileSelector("application/excel",this,QString::null,FALSE); connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide())); connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &))); connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &))); connect(ExcelSelector,SIGNAL(fileSelected(const DocLnk &)),this,SLOT(slotImportExcel(const DocLnk &))); connect(ExcelSelector,SIGNAL(closeMe()), this, SLOT(ExcelSelectorHide())); listSheets.setAutoDelete(TRUE); initActions(); initMenu(); initEditToolbar(); initFunctionsToolbar(); initStandardToolbar(); initSheet(); // set window title setCaption(tr("Opie Sheet")); // create sheets selectorFileNew(DocLnk()); } MainWindow::~MainWindow() { if (currentDoc) delete currentDoc; } @@ -702,97 +705,97 @@ void MainWindow::slotCellClicked(const QString &cell) addToData(cell); } typeSheet *MainWindow::createNewSheet() { typeSheet *newSheet=new typeSheet; int currentNo=1, tempNo=0; bool ok; for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) if (tempSheet->name.startsWith(tr("Sheet")) && (tempNo=tempSheet->name.mid(tr("Sheet").length()).toInt(&ok))>=currentNo && ok) currentNo=tempNo+1; newSheet->name=tr("Sheet")+QString::number(currentNo); newSheet->data.setAutoDelete(TRUE); comboSheets->insertItem(newSheet->name); listSheets.append(newSheet); return newSheet; } typeSheet *MainWindow::findSheet(const QString &name) { for (typeSheet *tempSheet=listSheets.first(); tempSheet; tempSheet=listSheets.next()) if (tempSheet->name==name) return tempSheet; return NULL; } void MainWindow::slotSheetChanged(const QString &name) { sheet->copySheetData(&findSheet(sheet->getName())->data); sheet->setName(name); sheet->setSheetData(&findSheet(name)->data); sheet->ReCalc(); } void MainWindow::addFlyAction(const QString &text, const QString &menuText, const QString &tip, QWidget *w) { QAction *action=new QAction(text, menuText, 0, this); action->setToolTip(tip); connect(action, SIGNAL(activated()), this, SLOT(slotFuncOutput())); action->addTo(w); } void MainWindow::slotFormatCells() { CellFormat dialogCellFormat(this); - dialogCellFormat.showMaximized(); + QPEApplication::showDialog( &dialogCellFormat ); dialogCellFormat.exec(sheet); } void MainWindow::slotEditPaste() { sheet->editPaste(); } void MainWindow::slotEditPasteContents() { sheet->editPaste(TRUE); } void MainWindow::slotRowHeight() { int row1, row2, col1, col2; sheet->getSelection(&row1, &col1, &row2, &col2); NumberDialog dialogNumber(this); if (dialogNumber.exec(tr("Row Height"), tr("&Height of each row:"), sheet->rowHeight(row1))==QDialog::Accepted) { int newHeight=dialogNumber.getValue(), row; for (row=row1; row<=row2; ++row) sheet->setRowHeight(row, newHeight); } } void MainWindow::slotRowAdjust() { int row1, row2, col1, col2; sheet->getSelection(&row1, &col1, &row2, &col2); for (int row=row1; row<=row2; ++row) sheet->adjustRow(row); } void MainWindow::slotRowShow() { int row1, row2, col1, col2; sheet->getSelection(&row1, &col1, &row2, &col2); for (int row=row1; row<=row2; ++row) sheet->showRow(row); } void MainWindow::slotRowHide() { int row1, row2, col1, col2; @@ -922,87 +925,87 @@ void MainWindow::slotSheetRename() { TextDialog dialogText(this); if (dialogText.exec(tr("Rename Sheet"), tr("&Sheet Name:"), sheet->getName())!=QDialog::Accepted || dialogText.getValue().isEmpty()) return; QString newName=dialogText.getValue(); typeSheet *tempSheet=findSheet(newName); if (tempSheet) { QMessageBox::critical(this, tr("Error"), tr("There is already a sheet named '"+newName+'\'')); return; } tempSheet=findSheet(sheet->getName()); for (int i=0; i<comboSheets->count(); ++i) if (comboSheets->text(i)==tempSheet->name) { comboSheets->changeItem(newName, i); break; } tempSheet->name=newName; sheet->setName(newName); } void MainWindow::slotSheetRemove() { if (comboSheets->count()<2) { QMessageBox::warning(this, tr("Error"), tr("There is only one sheet!")); return; } if (QMessageBox::information(this, tr("Remove Sheet"), tr("Are you sure?"), QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes) { typeSheet *tempSheet=findSheet(sheet->getName()); for (int i=0; i<comboSheets->count(); ++i) if (comboSheets->text(i)==tempSheet->name) { comboSheets->removeItem(i); break; } comboSheets->setCurrentItem(0); slotSheetChanged(comboSheets->currentText()); listSheets.remove(tempSheet); } } void MainWindow::slotDataSort() { SortDialog dialogSort(this); - dialogSort.showMaximized(); + QPEApplication::showDialog( &dialogSort ); dialogSort.exec(sheet); } void MainWindow::slotDocModified() { documentModified=TRUE; } void MainWindow::slotInsertCells() { QDialog dialogInsert(this, 0, TRUE); dialogInsert.resize(180, 130); dialogInsert.setCaption(tr("Insert Cells")); QVButtonGroup *group=new QVButtonGroup(tr("&Type"), &dialogInsert); group->setGeometry(10, 10, 160, 110); QRadioButton *radio=new QRadioButton(tr("Shift cells &down"), group); radio=new QRadioButton(tr("Shift cells &right"), group); radio=new QRadioButton(tr("Entire ro&w"), group); radio=new QRadioButton(tr("Entire &column"), group); group->setButton(0); if (dialogInsert.exec()==QDialog::Accepted) switch (group->id(group->selected())) { case 0: sheet->insertRows(1, FALSE); break; case 1: sheet->insertColumns(1, FALSE); break; case 2: sheet->insertRows(1, TRUE); break; case 3: sheet->insertColumns(1, TRUE); break; } } void MainWindow::slotDataFindReplace() { FindDialog dialogFind(this); - dialogFind.showMaximized(); + QPEApplication::showDialog( &dialogFind ); dialogFind.exec(sheet); } diff --git a/noncore/apps/tableviewer/ui/tveditview.cpp b/noncore/apps/tableviewer/ui/tveditview.cpp index 23e2b42..20a24c8 100644 --- a/noncore/apps/tableviewer/ui/tveditview.cpp +++ b/noncore/apps/tableviewer/ui/tveditview.cpp @@ -1,115 +1,117 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ /* The edit view widget. For each key in the DB display an * appropriate edit box, and a 'key' button to change that particular * key information (delete or edit). * * Bottem line should be a 'new key' button. Should be able to scroll * in both directions. */ #include "tveditview.h" #include "commonwidgets.h" #include <qlayout.h> #include <qgrid.h> #include <qvbox.h> #include <qlineedit.h> #include <qcheckbox.h> #include <qlist.h> #include <qlabel.h> #include <qscrollview.h> #include <qsignalmapper.h> +#include <qpe/qpeapplication.h> + TVEditView::TVEditView(TableState *s, DataElem *d, QWidget* parent, const char *name, WFlags fl ) : QDialog(parent, name, true, fl) { if (!name) setName("TVEditView"); QVBoxLayout *layout = new QVBoxLayout(this, 0); /* only so that will resize correctly in other widgets */ toggles = new QSignalMapper(this); QScrollView *sv = new QScrollView(this, 0); sv->setResizePolicy(QScrollView::AutoOneFit); layout->addWidget(sv); editDisplay = new QGrid(3, sv, 0); editDisplay->setSpacing(3); sv->addChild(editDisplay); connect(toggles, SIGNAL(mapped(int)), this, SLOT(toggleEnabled(int))); setData(s, d); #ifdef Q_WS_QWS - showMaximized(); + QPEApplication::showDialog( this ); #endif } TVEditView::~TVEditView() { } /*! set up the widgets in the grid, Set up initial values */ void TVEditView::setData(TableState *t, DataElem *d) { /* TODO need to somehow clear old children... a delete of each * child? */ keyIds.clear(); KeyListIterator it(*t->kRep); int i = 0; while(it.current()) { if (t->kRep->validIndex(it.currentKey())) { new QLabel(it.current()->name(), editDisplay); keyIds.insert(i, it.currentKey()); if (d->hasValidValue(it.currentKey())) { switch(it.current()->type()) { case TVVariant::String: { QLineEdit *edit = new QLineEdit(editDisplay, 0); edit->setText(d->getField(it.currentKey()).toString()); edits.append(edit); break; } case TVVariant::Int: { IntEdit *edit = new IntEdit(editDisplay, 0); edit->setValue(d->getField(it.currentKey()).toInt()); edits.append(edit); break; } case TVVariant::Time: { TimeEdit *edit = new TimeEdit(editDisplay, 0); edit->setTime(d->getField(it.currentKey()).toTime()); edits.append(edit); break; } case TVVariant::Date: { DateEdit *edit = new DateEdit(editDisplay, 0); edit->setDate(d->getField(it.currentKey()).toDate()); edits.append(edit); break; } diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp index 0182127..b03e846 100644 --- a/noncore/apps/tableviewer/ui/tvfilterview.cpp +++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp @@ -1,146 +1,148 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "tvfilterview.h" #include <qtoolbutton.h> #include <qcombobox.h> #include <qlistview.h> #include <qlayout.h> #include <qheader.h> #include <qpushbutton.h> #include <qlabel.h> +#include <qpe/qpeapplication.h> + TVFilterView::TVFilterView(TableState *t, QWidget* parent, const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl) { if ( !name ) setName( "Filter View" ); QVBoxLayout *vlayout = new QVBoxLayout(this); display = new QListView(this, "display"); display->addColumn("Key"); display->addColumn("Constraint"); display->addColumn("Value"); display->header()->setClickEnabled(FALSE); display->header()->setResizeEnabled(FALSE); vlayout->addWidget(display); QHBoxLayout *hlayout = new QHBoxLayout; hlayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); newFilterButton = new QPushButton(this, "new Filter"); newFilterButton->setMaximumSize(QSize(50, 32767)); newFilterButton->setText("New"); hlayout->addWidget(newFilterButton); deleteFilterButton = new QPushButton(this, "delete Filter"); deleteFilterButton->setMaximumSize(QSize(50, 32767)); deleteFilterButton->setText("Delete"); hlayout->addWidget(deleteFilterButton); clearFilterButton = new QPushButton(this, "delete Filter"); clearFilterButton->setMaximumSize(QSize(60, 32767)); clearFilterButton->setText("Clear All"); hlayout->addWidget(clearFilterButton); vlayout->addLayout(hlayout); QHBoxLayout *hlayout2 = new QHBoxLayout; keyNameCombo = new QComboBox(FALSE, this, "key name"); keyNameCombo->setEnabled(FALSE); hlayout2->addWidget(keyNameCombo); QLabel *label = new QLabel(this); label->setText("has value"); hlayout2->addWidget(label); keyEntry = new TVFilterKeyEntry(this, "key entry"); keyEntry->setEnabled(FALSE); vlayout->addLayout(hlayout2); vlayout->addWidget(keyEntry); connect(newFilterButton, SIGNAL( clicked() ), this, SLOT( newTerm() )); connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm())); connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms())); connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() )); connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() )); connect(display, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(setTerm(QListViewItem *))); ts = t; current = 0; terms.setAutoDelete(true); do_filter = false; #ifdef Q_WS_QWS - showMaximized(); + QPEApplication::showDialog( this ); #endif } /*! Destroys the TVFilterView widget */ TVFilterView::~TVFilterView() { } void TVFilterView::rebuildData() { } void TVFilterView::reset() { keyNameCombo->clear(); keyIds.clear(); } void TVFilterView::rebuildKeys() { int i; if (!ts) return; if(!ts->kRep) return; keyEntry->setTableState(ts); /* set up the list of keys that can be compared on */ keyNameCombo->clear(); KeyListIterator it(*ts->kRep); i = 0; while(it.current()) { if(ts->kRep->validIndex(it.currentKey())) { keyNameCombo->insertItem(it.current()->name()); keyIds.insert(i, it.currentKey()); ++i; } ++it; } } bool TVFilterView::passesFilter(DataElem *d) { if (!filterActive()) return true; FilterTerm *t; diff --git a/noncore/apps/tableviewer/ui/tvkeyedit.cpp b/noncore/apps/tableviewer/ui/tvkeyedit.cpp index 4849e87..c22ecd3 100644 --- a/noncore/apps/tableviewer/ui/tvkeyedit.cpp +++ b/noncore/apps/tableviewer/ui/tvkeyedit.cpp @@ -1,76 +1,78 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** 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. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "tvkeyedit.h" #include <qtoolbutton.h> #include <qlineedit.h> #include <qcombobox.h> #include <qlistview.h> #include <qmessagebox.h> #include <stdlib.h> #include <qpushbutton.h> +#include <qpe/qpeapplication.h> + /* QList view item... ?? that can store and update the values that I will * be changing */ class TVKEListViewItem : public QListViewItem { public: TVKEListViewItem(QString n, TVVariant::KeyType kt, int p, QListView *parent) : QListViewItem(parent) { name = n; keyType = kt; position = p; } QString text(int i) const { if(i) { return TVVariant::typeToName(keyType); } return name; } /* always sort by key index, ignore i */ QString key(int, bool) const { return QString().sprintf("%08d", position); } void setText(int i, const QString &) { ; } QString getName() const { return name; } void setName(QString n) { name = n; repaint(); } TVVariant::KeyType getKeyType() const { return keyType; } @@ -90,97 +92,97 @@ private: QString name; TVVariant::KeyType keyType; int position; }; TVKeyEdit::TVKeyEdit(TableState *t, QWidget* parent, const char *name, WFlags fl) : TVKeyEdit_gen(parent, name, true, fl) { int i; ts = t; if(!ts) return; if(!ts->kRep) return; working_state = *ts->kRep; i = 1; keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); i++; keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); i++; keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); i++; keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); KeyListIterator it(*ts->kRep); while(it.current()) { if(t->kRep->validIndex(it.currentKey())) { new TVKEListViewItem(it.current()->name(), it.current()->type(), it.currentKey(), display); } ++it; } num_keys = ts->kRep->getNumFields(); if(display->childCount() > 0) { display->setCurrentItem(display->firstChild()); setTerm(display->currentItem()); } else { deleteKeyButton->setEnabled(FALSE); clearKeysButton->setEnabled(FALSE); keyNameEdit->setEnabled(FALSE); keyTypeEdit->setEnabled(FALSE); } display->setSorting(0); #ifdef Q_WS_QWS - showMaximized(); + QPEApplication::showDialog( this ); #endif } /*! Destroys the TVKeyEdit widget */ TVKeyEdit::~TVKeyEdit() { } /* SLOTS */ void TVKeyEdit::newTerm() { /* new item, make current Item */ int i; i = working_state.addKey("<New Key>", TVVariant::String); //working_state.setNewFlag(i, TRUE); TVKEListViewItem *nItem = new TVKEListViewItem("<New Key>", TVVariant::String, i, display); display->setCurrentItem(nItem); setTerm(nItem); num_keys++; if(display->childCount() == 1) { deleteKeyButton->setEnabled(TRUE); clearKeysButton->setEnabled(TRUE); keyNameEdit->setEnabled(TRUE); keyTypeEdit->setEnabled(TRUE); } } void TVKeyEdit::updateTerm(const QString &newName) { /* TODO if name matches a deleted term, prompt for renewing old data instead */ TVKEListViewItem *i = (TVKEListViewItem *)display->currentItem(); if(i) { i->setName(newName); working_state.setKeyName(i->getPos(), newName); } } void TVKeyEdit::updateTerm(int t) { /* t is an index to a combo in a menu, NOT a type */ diff --git a/noncore/apps/tinykate/libkate/view/kateview.cpp b/noncore/apps/tinykate/libkate/view/kateview.cpp index af3b30d..794fbdb 100644 --- a/noncore/apps/tinykate/libkate/view/kateview.cpp +++ b/noncore/apps/tinykate/libkate/view/kateview.cpp @@ -39,96 +39,97 @@ #include "kateview.h" #include "../document/katedocument.h" #include "../document/katecmd.h" #include "../document/katehighlight.h" #include "kateviewdialog.h" #include "../document/katedialogs.h" #include <kateconfig.h> #include <qfocusdata.h> #include <kdebug.h> #include <kapplication.h> #include <qscrollbar.h> #include <qiodevice.h> #include <qpopupmenu.h> #include <kpopupmenu.h> #include <qkeycode.h> #include <qintdict.h> #include <qfont.h> #include <qpainter.h> #include <qpixmap.h> #include <qfileinfo.h> #include <qfile.h> #include <qevent.h> #include <qdir.h> #include <qvbox.h> #include <qprintdialog.h> #include <qpaintdevicemetrics.h> #include <qiodevice.h> #include <qbuffer.h> #include <qfocusdata.h> #include <klocale.h> #include <kglobal.h> #include <kdebug.h> #include <kmessagebox.h> #include <qregexp.h> #include <kdialogbase.h> #include <klineeditdlg.h> #include <qapplication.h> #include <kfiledialog.h> #include <kiconloader.h> #include "../document/katetextline.h" #include "kateviewdialog.h" #include "kateundohistory.h" #include <qlayout.h> +#include <qpe/qpeapplication.h> KateViewInternal::KateViewInternal(KateView *view, KateDocument *doc) : QWidget(view) { waitForPreHighlight=-1; myView = view; myDoc = doc; iconBorderWidth = 16; iconBorderHeight = 800; QWidget::setCursor(ibeamCursor); setBackgroundMode(NoBackground); setFocusPolicy(StrongFocus); xScroll = new QScrollBar(QScrollBar::Horizontal,myView); yScroll = new QScrollBar(QScrollBar::Vertical,myView); connect(xScroll,SIGNAL(valueChanged(int)),SLOT(changeXPos(int))); connect(yScroll,SIGNAL(valueChanged(int)),SLOT(changeYPos(int))); connect(yScroll,SIGNAL(valueChanged(int)),myView,SIGNAL(scrollValueChanged(int))); connect( doc, SIGNAL (preHighlightChanged(long)),this,SLOT(slotPreHighlightUpdate(long))); xPos = 0; yPos = 0; scrollTimer = 0; cursor.x = 0; cursor.y = 0; cursorOn = false; cursorTimer = 0; cXPos = 0; cOldXPos = 0; startLine = 0; endLine = -1; exposeCursor = false; updateState = 0; numLines = 0; lineRanges = 0L; newXPos = -1; newYPos = -1; drawBuffer = new QPixmap (); drawBuffer->setOptimization (QPixmap::BestOptim); bm.sXPos = 0; @@ -2282,98 +2283,97 @@ void KateView::configDialog() 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); EditConfigTab *editConfig = new EditConfigTab(page, this); 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); hlPage = new HighlightDialogPage(hlManager, &defaultStyleList, &hlDataList, 0, page); - kd->showMaximized(); - if (kd->exec()) { + if ( QPEApplication::execDialog( kd )) { // 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); } diff --git a/noncore/apps/zsafe/scqtfileedit.cpp b/noncore/apps/zsafe/scqtfileedit.cpp index effd86b..7a3d906 100644 --- a/noncore/apps/zsafe/scqtfileedit.cpp +++ b/noncore/apps/zsafe/scqtfileedit.cpp @@ -1,78 +1,80 @@ /*************************************************************************** scqtfileedit.cpp - description ------------------- begin : Mon Sep 3 2001 copyright : (C) 2001 by Werner Schulte email : sc@schulte-ac.de ***************************************************************************/ /* $Id$ */ /*************************************************************************** * * * 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 <stdio.h> #include <stdlib.h> #include "qdir.h" #include "qdialog.h" #include "qpixmap.h" #include "qlistview.h" #include "qlineedit.h" #include "qtoolbutton.h" #include "scqtfileedit.h" +#include <qpe/qpeapplication.h> + // #define DEBUGFILEEDIT /* XPM */ static const char* const file_xpm[]={ "16 16 5 1", ". c #7f7f7f", "# c None", "c c #000000", "b c #bfbfbf", "a c #ffffff", "################", "..........######", ".aaaaaaaab.#####", ".aaaaaaaaba.####", ".aaaaaaaacccc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".bbbbbbbbbbbc###", "ccccccccccccc###"}; /* XPM */ static const char * const link_file_xpm[]={ "16 16 10 1", "h c #808080", "g c #a0a0a0", "d c #c3c3c3", ". c #7f7f7f", "c c #000000", "b c #bfbfbf", "f c #303030", "e c #585858", "a c #ffffff", "# c None", "################", "..........######", ".aaaaaaaab.#####", ".aaaaaaaaba.####", ".aaaaaaaacccc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaadc###", @@ -113,97 +115,97 @@ static const char * const closed_xpm[]={ /* XPM */ static const char* const cdtoparent_xpm[]={ "15 13 3 1", ". c None", "* c #000000", "a c #ffff99", "..*****........", ".*aaaaa*.......", "***************", "*aaaaaaaaaaaaa*", "*aaaa*aaaaaaaa*", "*aaa***aaaaaaa*", "*aa*****aaaaaa*", "*aaaa*aaaaaaaa*", "*aaaa*aaaaaaaa*", "*aaaa******aaa*", "*aaaaaaaaaaaaa*", "*aaaaaaaaaaaaa*", "***************"}; ScQtFileEditDlg::ScQtFileEditDlg( QWidget *parent, const char *name, const QString &path, const QString &filter ) : ScQtFileDlg( parent, name, TRUE ), QDir( path, filter ) { // ListView->setRootIsDecorated ( TRUE ); #ifdef DEBUGFILEEDIT printf ("\nScQtFileEditDlg:: constructor name=%s", name ); printf ("\n path=%s", (const char *)path ); printf ("\n filter=%s", (const char *)filter ); printf ("\n parent=%p", parent ); fflush(stdout); #endif bpath = path; bfilter = filter; exflag = false; ListView->setAllColumnsShowFocus( TRUE ); ListView->setColumnAlignment( 1, Qt::AlignRight ); fileIcon = new QPixmap( (const char **)file_xpm); dirIcon = new QPixmap( (const char **)closed_xpm); linkIcon = new QPixmap( (const char **)link_file_xpm); cdToParentIcon = new QPixmap( (const char **)cdtoparent_xpm); #ifdef QWS - showMaximized(); + QPEApplication::execDialog( this ); #endif mkdirflag = false; MkDirButton->setEnabled( false ); initDirCombo( bpath ); initTypeCombo( bfilter ); dirstr = tr("dir"); filestr = tr("file"); linkstr = tr("link"); rFlag = false; showTimer.stop(); connect( &showTimer, SIGNAL(timeout()), SLOT( slotShowDir() ) ); fmode = QDir::All; fnfilter = false; fsorting = false; } ScQtFileEditDlg::~ScQtFileEditDlg() { #ifdef DEBUGFILEEDIT printf ("\nScQtFileEditDlg::destructor called" ); fflush(stdout); #endif if ( fileIcon != NULL ) { delete fileIcon; fileIcon = NULL; } if ( dirIcon != NULL ) { delete dirIcon; dirIcon = NULL; } if ( linkIcon != NULL ) { delete linkIcon; linkIcon = NULL; } if ( cdToParentIcon != NULL ) { delete cdToParentIcon; diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index ee1da77..bdd2aed 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp @@ -730,169 +730,157 @@ void ZSafe::deletePwd() ) ) { // Escape == button 2 case 0: // Delete clicked, Alt-S or Enter pressed. // Delete modified = true; selectedItem->parent()->takeItem(selectedItem); selectedItem = NULL; break; case 1: // Don't delete break; } } else { delCategory(); } } void ZSafe::editPwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) { // open the 'New Entry' dialog NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE); #ifdef WIN32 dialog->setCaption ("Qt " + tr("Edit Entry")); dialog->setGeometry(200, 250, 220, 310 ); #endif // set the labels dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); // set the fields dialog->NameField->setText(selectedItem->text (0)); dialog->UsernameField->setText(selectedItem->text (1)); dialog->PasswordField->setText(selectedItem->text (2)); QString comment = selectedItem->text (3); comment.replace (QRegExp("<br>"), "\n"); dialog->Field5->setText(selectedItem->text (4)); dialog->Field6->setText(selectedItem->text (5)); dialog->CommentField->insertLine(comment); dialog->CommentField->setCursorPosition(0,0); -#ifdef DESKTOP -#ifndef WIN32 - dialog->show(); -#endif -#else - dialog->showMaximized(); -#endif - DialogCode result = (DialogCode) dialog->exec(); + + DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); #ifdef DESKTOP result = Accepted; #endif if (result == Accepted) { modified = true; // edit the selected item QString name = dialog->NameField->text(); selectedItem->setText (0, tr (name)); QString user = dialog->UsernameField->text(); selectedItem->setText (1, tr (user)); QString pwd = dialog->PasswordField->text(); selectedItem->setText (2, tr (pwd)); QString comment = dialog->CommentField->text(); comment.replace (QRegExp("\n"), "<br>"); selectedItem->setText (3, tr (comment)); QString f5 = dialog->Field5->text(); selectedItem->setText (4, tr (f5)); QString f6 = dialog->Field6->text(); selectedItem->setText (5, tr (f6)); } delete dialog; } else { editCategory(); } } void ZSafe::newPwd() { if (!selectedItem) return; if (!isCategory(selectedItem)) selectedItem = selectedItem->parent(); if (isCategory(selectedItem)) { QString cat = selectedItem->text(0); // open the 'New Entry' dialog NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); #ifdef WIN32 dialog->setCaption ("Qt " + tr("New Entry")); dialog->setGeometry(200, 250, 220, 310 ); #endif // set the labels dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); retype: -#ifdef DESKTOP -#ifndef WIN32 - dialog->show(); -#endif -#else - dialog->showMaximized(); -#endif - DialogCode result = (DialogCode) dialog->exec(); + + DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); #ifdef DESKTOP result = Accepted; #endif if (result == Accepted) { QString name = dialog->NameField->text(); if (cat == name) { QMessageBox::critical( 0, tr("ZSafe"), tr("Entry name must be different\nfrom the category name.") ); goto retype; // it's not a good programming style :-) } modified = true; // add the new item QListViewItem *i = new ShadedListItem (0, selectedItem); i->setOpen (TRUE); i->setText (0, tr (name)); QString user = dialog->UsernameField->text(); i->setText (1, tr (user)); QString pwd = dialog->PasswordField->text(); i->setText (2, tr (pwd)); QString comment = dialog->CommentField->text(); comment.replace (QRegExp("\n"), "<br>"); i->setText (3, tr (comment)); QString f5 = dialog->Field5->text(); i->setText (4, tr (f5)); QString f6 = dialog->Field6->text(); i->setText (5, tr (f6)); } delete dialog; } } void ZSafe::findPwd() { // open the 'Search' dialog SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); #ifdef WIN32 dialog->setCaption ("Qt " + tr("Search")); #endif #ifdef DESKTOP @@ -1143,102 +1131,97 @@ void ZSafe::showInfo( QListViewItem *_item) if (!entry.isEmpty() && entry.compare(" ")) { text += "<u><b>"; text += getFieldLabel (selectedItem, "3", tr("Password")); text += ":<br> </b></u><blockquote>"; text += entry; text += "</blockquote>"; // text += "<br>"; } entry = selectedItem->text(4); if (!entry.isEmpty() && entry.compare(" ")) { text += "<u><b>"; text += getFieldLabel (selectedItem, "5", tr("Field 4")); text += ":<br> </b></u><blockquote>"; text += entry; text += "</blockquote>"; // text += "<br>"; } entry = selectedItem->text(5); if (!entry.isEmpty() && entry.compare(" ")) { text += "<u><b>"; text += getFieldLabel (selectedItem, "6", tr("Field 5")); text += ":<br> </b></u><blockquote>"; text += entry; text += "</blockquote>"; // text += "<br>"; } entry = selectedItem->text(3); if (!entry.isEmpty() && entry.compare(" ")) { text += "<u><b>"; text += getFieldLabel (selectedItem, "4", tr("Comment")); text += ":<br> </b></u>"; QString comment = selectedItem->text(3); comment.replace (QRegExp("\n"), "<br>"); text += comment; // text += "<br>"; } text += "</body></html>"; infoForm->InfoText->setText(text); infoForm->hide(); -#ifdef DESKTOP - infoForm->show(); -#else - infoForm->showMaximized(); -#endif - + QPEApplication::showDialog( infoForm ); } } void ZSafe::listViewSelected( QListViewItem *_item) { if (!_item) return; if (selectedItem != NULL) selectedItem->setSelected(FALSE); selectedItem = _item; #ifndef DESKTOP // set the column text dependent on the selected item ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); #endif #ifdef WIN32 // set the column text dependent on the selected item ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); #endif } bool ZSafe::isCategory(QListViewItem *_item) { if (_item == NULL) return FALSE; QString categoryName = _item->text (0); if (categories.find (categoryName)) return TRUE; else return FALSE; } void ZSafe::removeAsciiFile() { // QString fn = filename + ".txt"; diff --git a/noncore/comm/keypebble/kvnc.cpp b/noncore/comm/keypebble/kvnc.cpp index 25c8919..2fa8d1f 100644 --- a/noncore/comm/keypebble/kvnc.cpp +++ b/noncore/comm/keypebble/kvnc.cpp @@ -82,114 +82,111 @@ KVNC::KVNC( QWidget *parent, const char *name, WFlags f) : QMainWindow( 0, name connect( canvas->connection(), SIGNAL(connected()), this, SLOT(connected()) ); connect( canvas->connection(), SIGNAL(loggedIn()), this, SLOT(loggedIn()) ); connect( canvas->connection(), SIGNAL(disconnected()), this, SLOT(disconnected()) ); setupActions(); cornerButton = new QPushButton( this ); cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); connect( cornerButton, SIGNAL(pressed()), this, SLOT(showMenu()) ); canvas->setCornerWidget( cornerButton ); stack->raiseWidget( bookmarkSelector ); bar= new QToolBar( this ); setToolBarsMovable( false ); setRightJustification(false); QAction *n = new QAction( tr( "New Connection" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect( n, SIGNAL( activated() ), this, SLOT( newConnection() ) ); n->addTo( bar ); QAction *o = new QAction( tr( "Open Bookmark" ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 ); connect( o, SIGNAL( activated() ), this, SLOT( openConnection() ) ); o->addTo( bar ); QAction *d = new QAction( tr( "Delete Bookmark" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); connect( d, SIGNAL( activated() ), this, SLOT( deleteBookmark() ) ); d->addTo( bar ); } KVNC::~KVNC() { } void KVNC::newConnection() { curServer=new KRFBServer; KVNCConnDlg dlg( curServer,this); - dlg.showMaximized(); - if ( dlg.exec()) { + if ( QPEApplication::execDialog( &dlg )) { if (!curServer->name.isEmpty()) bookmarkSelector->addBookmark(curServer); canvas->openConnection(*curServer); } else curServer=0; } void KVNC::openConnection( QString name) { curServer=bookmarkSelector->getServer(name); if (curServer) { KVNCConnDlg dlg( curServer,this); - dlg.showMaximized(); - - if ( dlg.exec() ) { + if ( QPEApplication::execDialog( &dlg ) ) { canvas->openConnection(*curServer); bookmarkSelector->writeBookmarks(); } else curServer=0; } } void KVNC::openConnection( void ) { openConnection( bookmarkSelector->selectedBookmark()); } void KVNC::openConnection( QListBoxItem * item) { if (item) openConnection(item->text()); } void KVNC::setupActions() { cornerMenu = new QPopupMenu( this ); fullScreenAction = new QAction( tr("Full Screen"), QString::null, 0, 0 ); connect( fullScreenAction, SIGNAL(activated()), this, SLOT( toggleFullScreen() ) ); fullScreenAction->addTo( cornerMenu ); fullScreenAction->setEnabled( false ); ctlAltDelAction = new QAction( tr("Send Contrl-Alt-Delete"), QString::null, 0, 0 ); connect( ctlAltDelAction, SIGNAL(activated()), canvas, SLOT( sendCtlAltDel() ) ); ctlAltDelAction->addTo( cornerMenu ); ctlAltDelAction->setEnabled( false ); disconnectAction = new QAction( tr("Disconnect"), QString::null, 0, 0 ); connect( disconnectAction, SIGNAL(activated()), this, SLOT( closeConnection() ) ); disconnectAction->addTo( cornerMenu ); disconnectAction->setEnabled( false ); doubleClickAction = new QAction( tr("Next Click is Double Click"), QString::null, 0, 0 ); connect( doubleClickAction, SIGNAL(activated()), canvas, SLOT( markDoubleClick() ) ); doubleClickAction->addTo( cornerMenu ); doubleClickAction->setEnabled( false ); rightClickAction = new QAction( tr("Next Click is Right Click"), QString::null, 0, 0 ); connect( rightClickAction, SIGNAL(activated()), |