summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/brightnessapplet/.cvsignore4
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp2
-rw-r--r--noncore/apps/confedit/mainwindow.cpp6
-rw-r--r--noncore/apps/opie-bartender/bartender.cpp2
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.cpp2
-rw-r--r--noncore/apps/opie-reader/QTReaderApp.h4
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp2
-rw-r--r--noncore/apps/opie-sheet/mainwindow.h4
-rwxr-xr-xnoncore/apps/qashmoney/budgetdisplay.cpp2
-rwxr-xr-xnoncore/apps/qashmoney/budgetdisplay.h4
-rwxr-xr-xnoncore/apps/qashmoney/qashmoney.cpp2
-rwxr-xr-xnoncore/apps/qashmoney/qashmoney.h4
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp2
-rw-r--r--noncore/games/backgammon/backgammon.cpp2
-rw-r--r--noncore/games/fifteen/fifteen.cpp2
-rw-r--r--noncore/games/go/gowidget.cpp2
-rw-r--r--noncore/games/minesweep/minesweep.cpp2
-rw-r--r--noncore/games/solitaire/canvascardgame.h2
-rw-r--r--noncore/games/solitaire/canvascardwindow.cpp2
-rw-r--r--noncore/graphics/drawpad/drawpad.cpp2
-rw-r--r--noncore/multimedia/showimg/showimg.cpp2
-rw-r--r--noncore/multimedia/showimg/showimg.h6
-rw-r--r--noncore/net/opieftp/opieftp.cpp2
-rw-r--r--noncore/net/opieftp/opieftp.h2
-rw-r--r--noncore/net/opieirc/mainwindow.cpp2
-rw-r--r--noncore/net/wellenreiter/TODO15
-rw-r--r--noncore/unsupported/filebrowser/filebrowser.cpp4
-rw-r--r--noncore/unsupported/mail2/composerbase.cpp2
-rw-r--r--noncore/unsupported/mail2/composerbase.h4
-rw-r--r--noncore/unsupported/mail2/mainwindowbase.cpp2
-rw-r--r--noncore/unsupported/mail2/mainwindowbase.h4
-rw-r--r--noncore/unsupported/mail2/viewmailbase.cpp2
-rw-r--r--noncore/unsupported/mail2/viewmailbase.h4
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp4
34 files changed, 59 insertions, 50 deletions
diff --git a/noncore/applets/brightnessapplet/.cvsignore b/noncore/applets/brightnessapplet/.cvsignore
new file mode 100644
index 0000000..51d12e8
--- a/dev/null
+++ b/noncore/applets/brightnessapplet/.cvsignore
@@ -0,0 +1,4 @@
+Makefile*
+advancedconfigbase.cpp
+advancedconfigbase.h
+moc_*
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index bf00102..25f9910 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -1,261 +1,261 @@
/*
                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 <qpe/qpemenubar.h>
#include <qpe/qpemessagebox.h>
#include <qpe/qpetoolbar.h>
#include <qpe/resource.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, fl || 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 );
QPEToolBar *bar = new QPEToolBar( this );
bar->setHorizontalStretchable( TRUE );
- QPEMenuBar *mb = new QPEMenuBar( bar );
+ QMenuBar *mb = new QMenuBar( bar );
mb->setMargin( 0 );
QPopupMenu *popup = new QPopupMenu( this );
bar = new QPEToolBar( 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 );
actionDelete->addTo( bar );
popup->insertSeparator();
a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to configure this app." ) );
connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) );
a->addTo( popup );
a->addTo( bar );
mb->insertItem( tr( "Checkbook" ), popup );
// Load Checkbook selection list
checkbooks = new CBInfoList();
QDir checkdir( cbDir );
if (checkdir.exists() == true)
{
QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable,
QDir::Time );
CBInfo *cb = 0x0;
QString filename;
for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ )
{
filename = cbDir;
filename.append( (*it) );
cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename );
checkbooks->inSort( cb );
}
}
// Build Checkbook selection list control
cbList = 0x0;
buildList();
// open last book?
if( _cfg.isOpenLastBook() ) {
this->show();
this->showMaximized();
QListViewItem *itm=cbList->firstChild();
while( itm ) {
if( itm->text(posName)==_cfg.getLastBook() ) {
openBook( itm );
break;
}
itm=itm->nextSibling();
}
}
}
// --- ~MainWindow ------------------------------------------------------------
MainWindow::~MainWindow()
{
writeConfig();
}
// --- buildList --------------------------------------------------------------
void MainWindow::buildList()
{
if ( cbList )
delete cbList;
cbList = new QListView( this );
QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) );
if ( _cfg.getShowLocks() )
{
cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 );
posName = 1;
}
else
{
posName = 0;
}
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 )
{
// 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();
diff --git a/noncore/apps/confedit/mainwindow.cpp b/noncore/apps/confedit/mainwindow.cpp
index 58538af..4fe45ba 100644
--- a/noncore/apps/confedit/mainwindow.cpp
+++ b/noncore/apps/confedit/mainwindow.cpp
@@ -1,204 +1,198 @@
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
#include "mainwindow.h"
-#include <opie2/omenubar.h>
-#include <opie2/omessagebox.h>
-#include <opie2/oresource.h>
-#include <opie2/oconfig.h>
-#include <opie2/otoolbar.h>
-#include <opie2/oapplication.h>
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qtoolbutton.h>
#include <qstring.h>
#include <qlabel.h>
#include <qfile.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qcursor.h>
#include "listviewconfdir.h"
#include "listviewitemconf.h"
#include "listviewitemconfigentry.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
QMainWindow( parent, name, f ), _currentItem(0), _fileItem(0)
{
setCaption( tr("Conf File Editor") );
// setBaseSize( qApp->globalStrut() );
setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) );
mainLayout = new QVBoxLayout( this );
mainLayout->setSpacing( 0 );
mainLayout->setMargin( 0 );
qDebug("creating settingList");
settingList = new ListViewConfDir( QDir::homeDirPath() + "/Settings", this, "settingslist");
settingList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));//, sizePolicy().hasHeightForWidth() ) );
mainLayout->addWidget( settingList, 0);
qDebug("creating editor");
editor = new EditWidget(this);
editor->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Maximum));//, sizePolicy().hasHeightForWidth() ) );
mainLayout->addWidget( editor, 1 );
editor->layoutType( ListViewItemConf::File );
makeMenu();
connect(settingList, SIGNAL( pressed(QListViewItem*) ),
this, SLOT(setCurrent(QListViewItem*)));
connect( settingList, SIGNAL( clicked( QListViewItem* ) ),
this, SLOT( stopTimer( QListViewItem* ) ) );
connect( editor->LineEditGroup, SIGNAL( textChanged(const QString&) ),
SLOT( groupChanged(const QString&) ) );
connect( editor->LineEditKey, SIGNAL( textChanged(const QString&) ),
SLOT( keyChanged(const QString&) ) );
connect( editor->LineEditValue, SIGNAL( textChanged(const QString&) ),
SLOT( valueChanged(const QString&) ) );
setCurrent(0);
editor->layoutType(EditWidget::File);
}
void MainWindow::makeMenu()
{
popupTimer = new QTimer(this);
popupMenuFile = new QPopupMenu(this);
popupMenuEntry = new QPopupMenu(this);
popupActionSave = new QAction( tr("Save"),QString::null, 0, this, 0 );
popupActionSave->addTo( popupMenuFile );
// popupActionSave->addTo( popupMenuEntry );
connect( popupActionSave, SIGNAL( activated() ),
this , SLOT( saveConfFile() ) );
popupActionRevert = new QAction( tr("Revert"),QString::null, 0, this, 0 );
popupActionRevert->addTo( popupMenuFile );
popupActionRevert->addTo( popupMenuEntry );
connect( popupActionRevert, SIGNAL( activated() ),
this , SLOT( revertConfFile() ) );
popupActionDelete = new QAction( tr("Delete"),QString::null, 0, this, 0 );
popupActionDelete->addTo( popupMenuFile );
popupActionDelete->addTo( popupMenuEntry );
connect( popupActionDelete, SIGNAL( activated() ),
this , SLOT( removeConfFile() ) );
connect( popupTimer, SIGNAL(timeout()),
this, SLOT(showPopup()) );
}
MainWindow::~MainWindow()
{
}
void MainWindow::setCurrent(QListViewItem *item)
{
// qDebug("MainWindow::setCurrent");
if (!item) return;
_item = (ListViewItemConf*) item;
if (!_item) return;
popupTimer->start( 750, true );
if (_item->getType() == ListViewItemConf::File)
{
editor->layoutType(EditWidget::File);
_currentItem=0;
_fileItem = (ListViewItemConfFile*)item;
return;
}
_fileItem = 0;
_currentItem = (ListViewItemConfigEntry*)item;
if (!_currentItem) return;
QString file = _currentItem->getFile();
QString group = _currentItem->getGroup();
QString key = _currentItem->getKey();
QString val = _currentItem->getValue();
editor->TextFileName->setText(file);
editor->LineEditGroup->setText(group);
if (!key.isEmpty())
{
editor->layoutType(EditWidget::Entry);
editor->LineEditKey->setText(key);
editor->LineEditValue->setText(val);
}else{
editor->layoutType(EditWidget::Group);
}
}
void MainWindow::groupChanged(const QString &g)
{
if (!_currentItem) return;
_currentItem->setGroup(g);
}
void MainWindow::keyChanged(const QString &k)
{
if (!_currentItem) return;
_currentItem->keyChanged(k);
}
void MainWindow::valueChanged(const QString &v)
{
if (!_currentItem) return;
_currentItem->valueChanged(v);
}
void MainWindow::stopTimer( QListViewItem* )
{
popupTimer->stop();
}
void MainWindow::saveConfFile()
{
if (!_fileItem) return;
_fileItem->save();
}
void MainWindow::revertConfFile()
{
if (!_item) return;
_item->revert();
}
void MainWindow::removeConfFile()
{
if (!_item) return;
_item->remove();
}
void MainWindow::showPopup()
{
qDebug("showPopup");
if (!_item) return;
popupActionRevert->setEnabled(_item->revertable());
popupActionSave->setEnabled(_item->isChanged());
if (_fileItem)
{
popupActionSave->setEnabled(_fileItem->isChanged());
popupMenuFile->popup( QCursor::pos() );
}else if(_currentItem)
{
popupMenuEntry->popup( QCursor::pos() );
}
}
diff --git a/noncore/apps/opie-bartender/bartender.cpp b/noncore/apps/opie-bartender/bartender.cpp
index 5661ad5..3a0d8d1 100644
--- a/noncore/apps/opie-bartender/bartender.cpp
+++ b/noncore/apps/opie-bartender/bartender.cpp
@@ -1,262 +1,262 @@
/****************************************************************************
**
** Created: Sat Jul 20 08:10:53 2002
** by: L.J. Potter <ljp@llornkcor.com>
** copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "bartender.h"
#include "newdrinks.h"
#include "showdrinks.h"
#include "inputDialog.h"
#include "searchresults.h"
#include "bac.h"
#include <qpe/qpetoolbar.h>
#include <qpe/qpemenubar.h>
#include <opie/colorpopupmenu.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qcstring.h>
#include <qlineedit.h>
#include <qdir.h>
#include <qpushbutton.h>
#include <qlistbox.h>
#include <qstringlist.h>
#include <qmultilineedit.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qfile.h>
#include <qaction.h>
#include <qheader.h>
#include <qlistview.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
Bartender::Bartender( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl ) {
if ( !name )
setName( "Bartender" );
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 2);
layout->setMargin( 2);
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
setCaption( tr( "Bartender" ) );
ToolBar1 = new QPEToolBar( this, "ToolBar1" );
ToolBar1->setFixedHeight(22);
layout->addMultiCellWidget( ToolBar1, 0, 0, 0, 4 );
- QPEMenuBar *menuBar = new QPEMenuBar( ToolBar1 );
+ QMenuBar *menuBar = new QMenuBar( ToolBar1 );
QPopupMenu *fileMenu;
fileMenu = new QPopupMenu( this);
menuBar->insertItem( tr("File"), fileMenu );
fileMenu->insertItem(tr("New Drink"));
fileMenu->insertItem(tr("Open Drink"));
fileMenu->insertItem(tr("Find by Drink Name"));
fileMenu->insertItem(tr("Find by Alcohol"));
QPopupMenu *editMenu;
editMenu = new QPopupMenu( this);
menuBar->insertItem( tr("Edit"), editMenu );
editMenu->insertItem(tr("edit"));
connect( fileMenu, SIGNAL( activated(int) ), this, SLOT( fileMenuActivated(int) ));
connect( editMenu, SIGNAL( activated(int) ), this, SLOT( editMenuActivated(int) ));
QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), "New", 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
a->addTo( ToolBar1 );
a = new QAction( tr( "Open" ), Resource::loadPixmap( "bartender/bartender_sm" ), "open", 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( openCurrentDrink() ) );
a->addTo( ToolBar1 );
a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), "Find", 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( askSearch() ) );
a->addTo( ToolBar1 );
a = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ),"Edit", 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( doEdit() ) );
a->addTo( ToolBar1 );
QPushButton *t;
t= new QPushButton( "BAC", ToolBar1, "bacButtin");
connect( t, SIGNAL( clicked() ), this, SLOT( doBac() ) );
DrinkView = new QListView( this, "DrinkView" );
DrinkView->addColumn( tr( "Name of Drink" ) );
// DrinkView->setRootIsDecorated( TRUE );
DrinkView->header()->hide();
QPEApplication::setStylusOperation( DrinkView->viewport(),QPEApplication::RightOnHold);
connect(DrinkView, SIGNAL( doubleClicked(QListViewItem*)),this,SLOT(showDrink( QListViewItem*)));
connect(DrinkView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( showDrink(int, QListViewItem *, const QPoint&, int)));
layout->addMultiCellWidget( DrinkView, 1, 2, 0, 4 );
if(QDir("db").exists()) {
dbFile.setName( "db/drinkdb.txt");
} else
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();
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();
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 ) {
diff --git a/noncore/apps/opie-reader/QTReaderApp.cpp b/noncore/apps/opie-reader/QTReaderApp.cpp
index 087ce00..8c0d138 100644
--- a/noncore/apps/opie-reader/QTReaderApp.cpp
+++ b/noncore/apps/opie-reader/QTReaderApp.cpp
@@ -93,385 +93,385 @@ bool CheckVersion(int&, int&, char&);
#define PICDIR "opie-reader/"
#else
#define PICDIR "/home/tim/uqtreader/pics/"
#endif
#endif
unsigned long QTReaderApp::m_uid = 0;
void QTReaderApp::setScrollState(bool _b) { m_scrollButton->setOn(_b); }
#ifdef USEQPE
#define geticon(iconname) Resource::loadPixmap( iconname )
#define getmyicon(iconname) Resource::loadPixmap( PICDIR iconname )
#else
#define geticon(iconname) QPixmap(PICDIR iconname ".png")
#define getmyicon(iconname) geticon(iconname)
//#define geticon(iconname) QIconSet( QPixmap(PICDIR iconname) )
#endif
#ifndef _WINDOWS
#include <unistd.h>
#endif
#include <stddef.h>
#ifndef _WINDOWS
#include <dirent.h>
#endif
void QTReaderApp::listBkmkFiles()
{
bkmkselector->clear();
bkmkselector->setText("Cancel");
#ifndef USEQPE
int cnt = 0;
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) ) { // "/tmp"
qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
d.setFilter( QDir::Files | QDir::NoSymLinks );
// d.setSorting( QDir::Size | QDir::Reversed );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
while ( (fi=it.current()) ) { // for each file...
bkmkselector->insertItem(fi->fileName());
cnt++;
//qDebug( "%10li %s", fi->size(), fi->fileName().data() );
++it; // goto next list element
}
#else /* USEQPE */
int cnt = 0;
DIR *d;
d = opendir((const char *)Global::applicationFileName(APPDIR,""));
while(1)
{
struct dirent* de;
struct stat buf;
de = readdir(d);
if (de == NULL) break;
if (lstat((const char *)Global::applicationFileName(APPDIR,de->d_name),&buf) == 0 && S_ISREG(buf.st_mode))
{
bkmkselector->insertItem(de->d_name);
cnt++;
}
}
closedir(d);
#endif
if (cnt > 0)
{
//tjw menu->hide();
editorStack->raiseWidget( bkmkselector );
hidetoolbars();
m_nBkmkAction = cRmBkmkFile;
}
else
QMessageBox::information(this, PROGNAME, "No bookmark files");
}
void QTReaderApp::hidetoolbars()
{
menubar->hide();
if (fileBar != NULL) fileBar->hide();
if (viewBar != NULL) viewBar->hide();
if (navBar != NULL) navBar->hide();
if (markBar != NULL) markBar->hide();
if (m_fontVisible) m_fontBar->hide();
if (regVisible)
{
#ifdef USEQPE
Global::hideInputMethod();
#endif
regBar->hide();
}
if (searchVisible)
{
#ifdef USEQPE
Global::hideInputMethod();
#endif
searchBar->hide();
}
}
QTReaderApp::QTReaderApp( QWidget *parent, const char *name, WFlags f )
: QMainWindow( parent, name, f ), bFromDocView( FALSE ), m_dontSave(false),
fileBar(NULL), navBar(NULL), viewBar(NULL), markBar(NULL)
{
m_url_clipboard = false;
m_url_localfile = false;
m_url_globalfile = false;
ftime(&m_lastkeytime);
//// qDebug("Application directory = %s", (const tchar *)QPEApplication::documentDir());
//// qDebug("Application directory = %s", (const tchar *)Global::applicationFileName("uqtreader","bkmks.xml"));
m_bcloseDisabled = true;
m_disableesckey = false;
pBkmklist = NULL;
pOpenlist = NULL;
// doc = 0;
m_fBkmksChanged = false;
QString lang = getenv( "LANG" );
QString rot = getenv( "QWS_DISPLAY" );
/*
int m_rot = 0;
if (rot.contains("Rot90"))
{
m_rot = 90;
}
else if (rot.contains("Rot180"))
{
m_rot = 180;
}
else if (rot.contains("Rot270"))
{
m_rot = 270;
}
// qDebug("Initial Rotation(%d):%s", m_rot, (const char*)rot);
*/
m_autogenstr = "^ *[A-Z].*[a-z] *$";
#ifdef USEQPE
setIcon( Resource::loadPixmap( PICDIR "uqtreader") );
#else
setIcon( QPixmap (PICDIR "uqtreader.png") );
#endif /* USEQPE */
// QPEToolBar *bar = new QPEToolBar( this );
// menubar = new QPEToolBar( this );
#ifdef USEQPE
Config config( APPDIR );
#else
QDir d = QDir::home(); // "/"
if ( !d.cd(APPDIR) ) { // "/tmp"
qWarning( "Cannot find the \"~/" APPDIR "\" directory" );
d = QDir::home();
d.mkdir(APPDIR);
d.cd(APPDIR);
}
QFileInfo fi(d, INIFILE);
// qDebug("Path:%s", (const char*)fi.absFilePath());
Config config(fi.absFilePath());
#endif
config.setGroup("Toolbar");
m_tbmovesave = m_tbmove = config.readBoolEntry("Movable", false);
m_tbpolsave = m_tbpol = (ToolbarPolicy)config.readNumEntry("Policy", 1);
m_tbposition = (ToolBarDock)config.readNumEntry("Position", 2);
menubar = new QToolBar("Menus", this, m_tbposition);
// fileBar = new QToolBar("File", this);
// QToolBar* viewBar = new QToolBar("File", this);
// QToolBar* navBar = new QToolBar("File", this);
// QToolBar* markBar = new QToolBar("File", this);
#ifdef USEQPE
- mb = new QPEMenuBar( menubar );
+ mb = new QMenuBar( menubar );
#else
mb = new QMenuBar( menubar );
#endif
//#ifdef USEQPE
QPopupMenu* tmp = new QPopupMenu(mb);
mb->insertItem( geticon( "AppsIcon" ), tmp );
//#else
// QMenuBar* tmp = mb;
//#endif
QPopupMenu *file = new QPopupMenu( mb );
tmp->insertItem( tr( "File" ), file );
QPopupMenu *navigation = new QPopupMenu(mb);
tmp->insertItem( tr( "Navigation" ), navigation );
QPopupMenu *view = new QPopupMenu( mb );
tmp->insertItem( tr( "View" ), view );
QPopupMenu *marks = new QPopupMenu( this );
tmp->insertItem( tr( "Marks" ), marks );
QPopupMenu *settings = new QPopupMenu( this );
tmp->insertItem( tr( "Settings" ), settings );
// addToolBar(menubar, "Menus",QMainWindow::Top);
// addToolBar(fileBar, "Toolbar",QMainWindow::Top);
// QPopupMenu *edit = new QPopupMenu( this );
/*
QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
a->addTo( bar );
a->addTo( file );
*/
editorStack = new QWidgetStack( this );
setCentralWidget( editorStack );
searchVisible = FALSE;
regVisible = FALSE;
m_fontVisible = false;
m_annoWin = new CAnnoEdit(editorStack);
editorStack->addWidget(m_annoWin, get_unique_id());
connect( m_annoWin, SIGNAL( finished(const QString&, const QString&) ), this, SLOT( addAnno(const QString&, const QString&) ) );
connect( m_annoWin, SIGNAL( cancelled() ), this, SLOT( infoClose() ) );
m_infoWin = new infowin(editorStack);
editorStack->addWidget(m_infoWin, get_unique_id());
connect( m_infoWin, SIGNAL( Close() ), this, SLOT( infoClose() ) );
m_graphicwin = new GraphicWin(editorStack);
editorStack->addWidget(m_graphicwin, get_unique_id());
connect( m_graphicwin, SIGNAL( Closed() ), this, SLOT( infoClose() ) );
// bkmkselector = new QListBox(editorStack, "Bookmarks");
bkmkselector = new CBkmkSelector(editorStack, "Bookmarks");
// connect(bkmkselector, SIGNAL( selected(const QString&) ), this, SLOT( gotobkmk(const QString&) ) );
connect(bkmkselector, SIGNAL( selected(int) ), this, SLOT( gotobkmk(int) ) );
connect(bkmkselector, SIGNAL( cancelled() ), this, SLOT( cancelbkmk() ) );
editorStack->addWidget( bkmkselector, get_unique_id() );
/*
importSelector = new FileSelector( "*", editorStack, "importselector", false );
connect( importSelector, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( importFile( const DocLnk & ) ) );
editorStack->addWidget( importSelector, get_unique_id() );
// don't need the close visible, it is redundant...
importSelector->setCloseVisible( FALSE );
*/
// qDebug("Reading file list");
readfilelist();
reader = new QTReader( editorStack );
reader->bDoUpdates = false;
#ifdef USEQPE
((QPEApplication*)qApp)->setStylusOperation(reader, QPEApplication::RightOnHold);
#endif
// qDebug("Reading config");
// Config config( APPDIR );
config.setGroup( "View" );
m_debounce = config.readNumEntry("Debounce", 0);
#ifdef USEQPE
m_bFloatingDialog = config.readBoolEntry("FloatDialogs", false);
#else
m_bFloatingDialog = config.readBoolEntry("FloatDialogs", true);
#endif
reader->bstripcr = config.readBoolEntry( "StripCr", true );
reader->bfulljust = config.readBoolEntry( "FullJust", false );
reader->setextraspace(config.readNumEntry( "ExtraSpace", 0 ));
reader->setlead(config.readNumEntry( "ExtraLead", 0 ));
reader->btextfmt = config.readBoolEntry( "TextFmt", false );
reader->bautofmt = config.readBoolEntry( "AutoFmt", true );
reader->bstriphtml = config.readBoolEntry( "StripHtml", false );
reader->bpeanut = config.readBoolEntry( "Peanut", false );
reader->bdehyphen = config.readBoolEntry( "Dehyphen", false );
reader->bdepluck = config.readBoolEntry( "Depluck", false );
reader->bdejpluck = config.readBoolEntry( "Dejpluck", false );
reader->bonespace = config.readBoolEntry( "OneSpace", false );
reader->bunindent = config.readBoolEntry( "Unindent", false );
reader->brepara = config.readBoolEntry( "Repara", false );
reader->bdblspce = config.readBoolEntry( "DoubleSpace", false );
reader->bindenter = config.readNumEntry( "Indent", 0 );
reader->m_textsize = config.readNumEntry( "FontSize", 12 );
reader->m_delay = config.readNumEntry( "ScrollDelay", 5184);
reader->m_lastfile = config.readEntry( "LastFile", QString::null );
reader->m_lastposn = config.readNumEntry( "LastPosn", 0 );
reader->m_bpagemode = config.readBoolEntry( "PageMode", true );
reader->m_bMonoSpaced = config.readBoolEntry( "MonoSpaced", false);
reader->m_swapmouse = config.readBoolEntry( "SwapMouse", false);
reader->m_fontname = config.readEntry( "Fontname", "helvetica" );
reader->m_encd = config.readNumEntry( "Encoding", 0 );
reader->m_charpc = config.readNumEntry( "CharSpacing", 100 );
reader->m_overlap = config.readNumEntry( "Overlap", 0 );
reader->m_border = config.readNumEntry( "Margin", 6 );
#ifdef REPALM
reader->brepalm = config.readBoolEntry( "Repalm", true );
#endif
reader->bremap = config.readBoolEntry( "Remap", true );
reader->bmakebold = config.readBoolEntry( "MakeBold", false );
reader->setContinuous(config.readBoolEntry( "Continuous", true ));
m_targetapp = config.readEntry( "TargetApp", QString::null );
m_targetmsg = config.readEntry( "TargetMsg", QString::null );
#ifdef _SCROLLPIPE
reader->m_pipetarget = config.readEntry( "PipeTarget", QString::null );
reader->m_pauseAfterEachPara = config.readBoolEntry( "PauseAfterPara", true );
#endif
m_twoTouch = config.readBoolEntry( "TwoTouch", false);
m_doAnnotation = config.readBoolEntry( "Annotation", false);
m_doDictionary = config.readBoolEntry( "Dictionary", false);
m_doClipboard = config.readBoolEntry( "Clipboard", false);
m_spaceTarget = (ActionTypes)config.readNumEntry("SpaceTarget", cesAutoScroll);
m_escapeTarget = (ActionTypes)config.readNumEntry("EscapeTarget", cesNone);
m_returnTarget = (ActionTypes)config.readNumEntry("ReturnTarget", cesFullScreen);
m_leftTarget = (ActionTypes)config.readNumEntry("LeftTarget", cesZoomOut);
m_rightTarget = (ActionTypes)config.readNumEntry("RightTarget", cesZoomIn);
m_upTarget = (ActionTypes)config.readNumEntry("UpTarget", cesPageUp);
m_downTarget = (ActionTypes)config.readNumEntry("DownTarget", cesPageDown);
m_leftScroll = config.readBoolEntry("LeftScroll", false);
m_rightScroll = config.readBoolEntry("RightScroll", false);
m_upScroll = config.readBoolEntry("UpScroll", true);
m_downScroll = config.readBoolEntry("DownScroll", true);
m_propogatefontchange = config.readBoolEntry( "RequestorFontChange", false);
reader->setBaseSize(config.readNumEntry( "Basesize", 10 ));
#ifndef USEQPE
config.setGroup( "Geometry" );
setGeometry(0,0,
config.readNumEntry( "width", QApplication::desktop()->width()/2 ),
config.readNumEntry( "height", QApplication::desktop()->height()/2 ));
move(
config.readNumEntry( "x", 20 ),
config.readNumEntry( "y", 20 ));
#endif
setTwoTouch(m_twoTouch);
connect( reader, SIGNAL( OnShowPicture(QImage&) ), this, SLOT( showgraphic(QImage&) ) );
connect( reader, SIGNAL( OnRedraw() ), this, SLOT( OnRedraw() ) );
connect( reader, SIGNAL( OnWordSelected(const QString&, size_t, const QString&) ), this, SLOT( OnWordSelected(const QString&, size_t, const QString&) ) );
connect( reader, SIGNAL( OnURLSelected(const QString&) ), this, SLOT( OnURLSelected(const QString&) ) );
editorStack->addWidget( reader, get_unique_id() );
m_preferences_action = new QAction( tr( "Configuration" ), geticon( "SettingsIcon" ), QString::null, 0, this, NULL);
connect( m_preferences_action, SIGNAL( activated() ), this, SLOT( showprefs() ) );
m_preferences_action->addTo( settings );
m_saveconfig_action = new QAction( tr( "Save Config" ), QString::null, 0, this, NULL);
connect( m_saveconfig_action, SIGNAL( activated() ), this, SLOT( SaveConfig() ) );
m_saveconfig_action->addTo( settings );
m_loadconfig_action = new QAction( tr( "Load Config" ), QString::null, 0, this, NULL);
connect( m_loadconfig_action, SIGNAL( activated() ), this, SLOT( LoadConfig() ) );
m_loadconfig_action->addTo( settings );
m_tidyconfig_action = new QAction( tr( "Delete Config" ), QString::null, 0, this, NULL);
connect( m_tidyconfig_action, SIGNAL( activated() ), this, SLOT( TidyConfig() ) );
m_tidyconfig_action->addTo( settings );
settings->insertSeparator();
diff --git a/noncore/apps/opie-reader/QTReaderApp.h b/noncore/apps/opie-reader/QTReaderApp.h
index 2765d47..86c14b1 100644
--- a/noncore/apps/opie-reader/QTReaderApp.h
+++ b/noncore/apps/opie-reader/QTReaderApp.h
@@ -1,442 +1,442 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Palmtop 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.
**
**********************************************************************/
#ifndef __QTREADERAPP_H
#define __QTREADERAPP_H
//#define _SCROLLPIPE
//#define __ISEARCH
//#define MAX_ENCODING 6
#define MAX_ACTIONS 5
#include "useqpe.h"
#include <sys/timeb.h>
#include <qmainwindow.h>
#include "CExpander.h"
#include "CEncoding.h"
#include <qlist.h>
//#include <qpe/filemanager.h>
#include <qmap.h>
#include <qlineedit.h>
#include <qstack.h>
#include <qlistbox.h>
//#include "Queue.h"
class QWidgetStack;
class QToolButton;
class QPopupMenu;
class QToolBar;
#ifdef USEQPE
class QPEToolBar;
-class QPEMenuBar;
+class QMenuBar;
#endif
class CBkmkSelector;
class QProgressBar;
class QAction;
class CAnnoEdit;
class QFloatBar;
class CDrawBuffer;
class QTReader;
class QImage;
class Config;
enum ActionTypes
{
cesNone = 0,
cesOpenFile,
cesAutoScroll,
cesActionMark,
cesActionAnno,
cesFullScreen,
cesZoomIn,
cesZoomOut,
cesBack,
cesForward,
cesHome,
cesPageUp,
cesPageDown,
cesLineUp,
cesLineDown,
cesStartDoc,
cesEndDoc
};
/*
*m_preferences_action, *m_close_action *m_info_action, *m_touch_action,
*m_find_action, *m_jump_action, *m_setfont_action *m_goto_action,
*m_delete_action; *m_autogen_action, *m_clear_action, *m_save_action;
*m_tidy_action, *m_startBlock_action, *m_endBlock_action;
*m_setenc_action, *m_setmono_action;
*/
enum ToolbarPolicy
{
cesSingle = 0,
cesMenuTool,
cesMultiple
};
enum regedit_type
{
cAutoGen,
cAddBkmk,
cJump,
cMonoSpace,
cSetTarget,
#ifdef _SCROLLPIPE
cSetPipeTarget,
#endif
cSetConfigName,
cMargin,
cExtraSpace,
cExtraLead
};
enum bkmk_action
{
cOpenFile,
cGotoBkmk,
cDelBkmk,
cRmBkmkFile,
cLdConfig,
cRmConfig,
cExportLinks
};
enum fontselector_action
{
cChooseFont,
cChooseEncoding
};
#ifdef __ISEARCH
struct searchrecord
{
QString s;
size_t pos;
searchrecord(const QString& _s, size_t _pos) : s(_s), pos(_pos) {}
};
#endif
class infowin;
class GraphicWin;
class QTReaderApp : public QMainWindow
{
Q_OBJECT
unsigned long m_savedpos;
int m_debounce;
timeb m_lastkeytime;
bool m_annoIsEditing;
bool m_propogatefontchange, m_bFloatingDialog;
bool m_url_clipboard, m_url_localfile, m_url_globalfile;
fontselector_action m_fontAction;
void doAction(ActionTypes a, QKeyEvent* e);
public:
QTReaderApp( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~QTReaderApp();
void handlekey(QKeyEvent* e);
void hideEvent(QHideEvent*)
{
suspend();
}
void suspend();
void openFile( const QString & );
void setScrollState(bool _b);
protected:
void setfontHelper(const QString& lcn, int size = 0);
QAction* m_bkmkAvail, *m_actFullscreen;
CAnnoEdit* m_annoWin;
Bkmk* m_anno;
// void resizeEvent(QResizeEvent* e);
void closeEvent( QCloseEvent *e );
void readbkmks();
void do_mono(const QString&);
void do_jump(const QString&);
void do_settarget(const QString&);
#ifdef _SCROLLPIPE
// void do_setpipetarget(const QString&);
#endif
void do_saveconfig(const QString&, bool);
bool readconfig(const QString&, bool);
bool PopulateConfig(const char*);
ActionTypes ActNameToInt(const QString&);
bool m_doAnnotation;
bool m_doDictionary;
bool m_doClipboard;
bool m_fullscreen;
bool m_loadedconfig;
public:
void saveprefs();
public slots:
void setDocument(const QString&);
private slots:
#ifdef _SCRIPT
// void RunScript();
#endif
void SaveConfig();
void LoadConfig();
void TidyConfig();
void ExportLinks();
void zoomin();
void zoomout();
void chooseencoding();
void setfullscreen(bool sfs);
// void setcontinuous(bool sfs);
void setTwoTouch(bool _b);
void restoreFocus();
void OnAnnotation(bool _b)
{
m_doAnnotation = _b;
}
void OnDictionary(bool _b)
{
m_doDictionary = _b;
}
void OnClipboard(bool _b)
{
m_doClipboard = _b;
}
void OnWordSelected(const QString&, size_t, const QString&);
void OnURLSelected(const QString& href);
void showgraphic(QImage&);
void addAnno(const QString&, const QString&, size_t);
void addAnno(const QString&, const QString&);
void addanno();
void showAnnotation();
void do_setencoding(int i);
void do_setfont(const QString&);
void buttonActionSelected(QAction*);
// void msgHandler(const QCString&, const QByteArray&);
void monospace(bool);
void jump();
void settarget();
#ifdef _SCROLLPIPE
// void setpipetarget();
// void setpause(bool);
#endif
// void setspacing();
void setfont();
void clearBkmkList();
void listBkmkFiles();
void editMark();
void autoScroll(bool);
void addbkmk();
void savebkmks();
// void importFiles();
void showprefs();
void showtoolbarprefs();
void infoClose();
// void oldFile();
void showinfo();
// void indentplus();
// void indentminus();
void fileOpen();
void fileClose();
void editCopy();
void editFind();
void gotoStart();
void gotoEnd();
void pageup();
void pagedn();
void findNext();
void findClose();
void regClose();
#ifdef __ISEARCH
// void search( const QString& );
#else
void search();
#endif
void showEditTools();
// void stripcr(bool);
// void setfulljust(bool);
// void onespace(bool);
#ifdef REPALM
// void repalm(bool);
#endif
// void peanut(bool _b);
// void remap(bool);
// void embolden(bool);
// void autofmt(bool);
// void textfmt(bool);
// void striphtml(bool);
// void dehyphen(bool);
// void depluck(bool);
// void dejpluck(bool);
// void unindent(bool);
// void repara(bool);
// void dblspce(bool);
void pagemode(bool);
// void gotobkmk(const QString& bm);
void gotobkmk(int);
void cancelbkmk();
void do_gotomark();
void do_delmark();
void do_autogen();
void do_regaction();
void OnRedraw();
private:
void writeUrl(const QString& file, const QString& href);
QAction *m_preferences_action, *m_open_action, *m_close_action;
QAction *m_info_action, *m_touch_action, *m_find_action, *m_start_action;
QAction *m_end_action, *m_jump_action, *m_pageline_action;
QAction *m_pageup_action, *m_pagedn_action, *m_back_action;
QAction *m_home_action, *m_forward_action, *m_zoomin_action;
QAction *m_zoomout_action, *m_setfont_action, *m_mark_action;
QAction *m_annotate_action, *m_goto_action, *m_delete_action;
QAction *m_autogen_action, *m_clear_action, *m_save_action;
QAction *m_tidy_action, *m_startBlock_action, *m_endBlock_action;
QAction *m_setenc_action, *m_setmono_action, *m_saveconfig_action;
QAction *m_loadconfig_action, *m_toolbarprefs_action, *m_tidyconfig_action;
QAction *m_exportlinks_action;
void addtoolbars(Config* config);
ToolbarPolicy m_tbpol, m_tbpolsave;
ToolBarDock m_tbposition;
bool m_tbmove, m_tbmovesave;
QToolBar* filebar();
QToolBar* viewbar();
QToolBar* navbar();
QToolBar* markbar();
void hidetoolbars();
void addfilebar(Config* _config, const QString& key, QAction* a);
void addviewbar(Config* _config, const QString& key, QAction* a);
void addnavbar(Config* _config, const QString& key, QAction* a);
void addmarkbar(Config* _config, const QString& key, QAction* a);
bool checkbar(Config* _config, const QString& key);
#ifdef _SCRIPT
void SaveScript(const char* sname);
#endif
/*
void setstate(unsigned char* _sd, unsigned short _sdlen);
void getstate(unsigned char*& data, unsigned short& len);
*/
void fileOpen2();
void readfilelist();
void savefilelist();
void updatefileinfo();
bool openfrombkmk(Bkmk*);
QString m_targetapp, m_targetmsg;
bool listbkmk(CList<Bkmk>*, const QString& _lab = QString::null);
QString usefilebrowser();
void do_regedit();
void colorChanged( const QColor &c );
void clear();
void updateCaption();
void do_autogen(const QString&);
void do_addbkmk(const QString&);
bool findNextBookmark(size_t start);
private:
QAction* m_scrollButton;
QAction* m_buttonAction[MAX_ACTIONS];
CBkmkSelector* bkmkselector;
ActionTypes m_spaceTarget, m_escapeTarget, m_returnTarget, m_leftTarget, m_rightTarget,
m_upTarget, m_downTarget;
bool m_leftScroll, m_rightScroll, m_upScroll, m_downScroll;
bool m_bcloseDisabled, m_disableesckey;
size_t searchStart;
#ifdef __ISEARCH
QStack<searchrecord>* searchStack;
bool dosearch(size_t start, CDrawBuffer& test, const QString& arg);
#else
bool dosearch(size_t start, CDrawBuffer& test, const QRegExp& arg);
#endif
QWidgetStack *editorStack;
QTReader* reader;
QComboBox* m_fontSelector;
// QPEToolBar /* *menu,*/ *fileBar;
QToolBar *menubar, *fileBar, *navBar, *viewBar, *markBar;
#ifdef USEQPE
- QPEMenuBar *mb;
+ QMenuBar *mb;
#else
QMenuBar *mb;
#endif
QFloatBar *searchBar, *regBar/*, *m_fontBar*/;
QToolBar /* *searchBar, *regBar,*/ *m_fontBar;
QLineEdit *searchEdit, *regEdit;
bool searchVisible;
bool regVisible;
bool m_fontVisible, m_twoTouch;
bool bFromDocView;
static unsigned long m_uid;
long unsigned get_unique_id() { return m_uid++; }
/*
void resizeEvent( QResizeEvent * r)
{
// qDebug("resize:(%u,%u)", r->oldSize().width(), r->oldSize().height());
// qDebug("resize:(%u,%u)", r->size().width(), r->size().height());
// bgroup->move( width()-bgroup->width(), 0 );
}
*/
CList<Bkmk>* pBkmklist;
CList<Bkmk>* pOpenlist;
infowin* m_infoWin;
GraphicWin* m_graphicwin;
QProgressBar* pbar;
bool m_fBkmksChanged;
// int m_nRegAction;
regedit_type m_nRegAction;
bkmk_action m_nBkmkAction;
QString m_autogenstr;
bool m_dontSave;
};
//const int cAutoGen = 0;
//const int cAddBkmk = 1;
//const int cDelBkmk = 2;
//const int cGotoBkmk = 3;
//const int cRmBkmkFile = 4;
//const int cJump = 5;
//const int cMonoSpace = 6;
//const int cOverlap = 7;
//const int cSetTarget = 8;
//const int cOpenFile = 9;
//const int cSetPipeTarget = 10;
//const int cSetConfigName = 11;
//const int cMargin = 12;
//const int cExtraSpace = 14;
//const int cExtraLead = 15;
//const int cGfxSize = 16;
//const int cChooseFont = 2;
//const int cChooseEncoding = 1;
#endif
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index 3915e52..fb2ca79 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -172,385 +172,385 @@ int MainWindow::saveCurrentFile(bool ask)
}
if (!currentDoc->isValid())
{
TextDialog dialogText(this);
if (dialogText.exec(tr("Save File"), tr("&File Name:"), tr("UnnamedFile"))!=QDialog::Accepted || dialogText.getValue().isEmpty()) return QMessageBox::Cancel;
currentDoc->setName(dialogText.getValue());
currentDoc->setFile(QString::null);
currentDoc->setLinkFile(QString::null);
}
documentSave(currentDoc);
return QMessageBox::Yes;
}
void MainWindow::selectorFileNew(const DocLnk &lnkDoc)
{
selectorHide();
if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
if (currentDoc) delete currentDoc;
currentDoc = new DocLnk(lnkDoc);
editData->clear();
listSheets.clear();
comboSheets->clear();
typeSheet *newSheet=createNewSheet();
newSheet->data.setAutoDelete(TRUE);
sheet->setName(newSheet->name);
sheet->setSheetData(&newSheet->data);
for (int i=1; i<DEFAULT_NUM_SHEETS; ++i)
createNewSheet();
documentModified=FALSE;
}
void MainWindow::closeEvent(QCloseEvent *e)
{
if (documentModified && saveCurrentFile()==QMessageBox::Cancel) e->ignore();
else e->accept();
}
void MainWindow::selectorFileOpen(const DocLnk &lnkDoc)
{
selectorHide();
if (documentModified && saveCurrentFile()==QMessageBox::Cancel) return;
if (currentDoc) delete currentDoc;
currentDoc = new DocLnk(lnkDoc);
listSheets.clear();
comboSheets->clear();
documentOpen(lnkDoc);
documentModified=FALSE;
}
void MainWindow::selectorShow()
{
sheet->hide();
setCentralWidget(fileSelector);
fileSelector->show();
fileSelector->reread();
}
void MainWindow::selectorHide()
{
fileSelector->hide();
setCentralWidget(sheet);
sheet->show();
}
void MainWindow::slotFileNew()
{
selectorFileNew(DocLnk());
}
void MainWindow::slotFileOpen()
{
selectorShow();
}
void MainWindow::slotFileSave()
{
saveCurrentFile(FALSE);
}
void MainWindow::setDocument(const QString &applnk_filename)
{
selectorFileOpen(DocLnk(applnk_filename));
}
void MainWindow::initActions()
{
fileNew=new QAction(tr("New File"), Resource::loadPixmap( "new" ), tr("&New"), 0, this);
connect(fileNew, SIGNAL(activated()), this, SLOT(slotFileNew()));
fileOpen=new QAction(tr("Open File"), Resource::loadPixmap( "fileopen" ), tr("&Open"), 0, this);
connect(fileOpen, SIGNAL(activated()), this, SLOT(slotFileOpen()));
fileSave=new QAction(tr("Save File"),Resource::loadPixmap( "save" ), tr("&Save"), 0, this);
connect(fileSave, SIGNAL(activated()), this, SLOT(slotFileSave()));
fileSaveAs=new QAction(tr("Save File As"), Resource::loadPixmap( "save" ), tr("Save &As"), 0, this);
connect(fileSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs()));
//fileQuit=new QAction(tr("Quit"), tr("&Quit"), 0, this);
//connect(fileQuit, SIGNAL(activated()), this, SLOT(close()));
// helpGeneral=new QAction(tr("General Help"), QPixmap(help_general_xpm), tr("&General"), 0, this);
//connect(helpGeneral, SIGNAL(activated()), this, SLOT(slotHelpGeneral()));
//helpAbout=new QAction(tr("About Opie Sheet"), tr("&About"), 0, this);
//connect(helpAbout, SIGNAL(activated()), this, SLOT(slotHelpAbout()));
editAccept=new QAction(tr("Accept"),Resource::loadPixmap( "enter" ) , tr("&Accept"), 0, this);
connect(editAccept, SIGNAL(activated()), this, SLOT(slotEditAccept()));
editCancel=new QAction(tr("Cancel"), Resource::loadPixmap( "close" ), tr("&Cancel"), 0, this);
connect(editCancel, SIGNAL(activated()), this, SLOT(slotEditCancel()));
editCellSelect=new QAction(tr("Cell Selector"), QPixmap(cell_select_xpm), tr("Cell &Selector"), 0, this);
editCellSelect->setToggleAction(TRUE);
connect(editCellSelect, SIGNAL(toggled(bool)), this, SLOT(slotCellSelect(bool)));
editCut=new QAction(tr("Cut Cells"), tr("Cu&t"), 0, this);
editCopy=new QAction(tr("Copy Cells"), tr("&Copy"), 0, this);
editPaste=new QAction(tr("Paste Cells"), tr("&Paste"), 0, this);
connect(editPaste, SIGNAL(activated()), this, SLOT(slotEditPaste()));
editPasteContents=new QAction(tr("Paste Contents"), tr("Paste Cont&ents"), 0, this);
connect(editPasteContents, SIGNAL(activated()), this, SLOT(slotEditPasteContents()));
editClear=new QAction(tr("Clear Cells"), tr("C&lear"), 0, this);
insertCells=new QAction(tr("Insert Cells"), tr("C&ells"), 0, this);
connect(insertCells, SIGNAL(activated()), this, SLOT(slotInsertCells()));
insertRows=new QAction(tr("Insert Rows"), tr("&Rows"), 0, this);
connect(insertRows, SIGNAL(activated()), this, SLOT(slotInsertRows()));
insertCols=new QAction(tr("Insert Columns"), tr("&Columns"), 0, this);
connect(insertCols, SIGNAL(activated()), this, SLOT(slotInsertCols()));
insertSheets=new QAction(tr("Add Sheets"), tr("&Sheets"), 0, this);
connect(insertSheets, SIGNAL(activated()), this, SLOT(slotInsertSheets()));
formatCells=new QAction(tr("Cells"), tr("&Cells"), 0, this);
connect(formatCells, SIGNAL(activated()), this, SLOT(slotFormatCells()));
rowHeight=new QAction(tr("Row Height"), tr("H&eight"), 0, this);
connect(rowHeight, SIGNAL(activated()), this, SLOT(slotRowHeight()));
rowAdjust=new QAction(tr("Adjust Row"), tr("&Adjust"), 0, this);
connect(rowAdjust, SIGNAL(activated()), this, SLOT(slotRowAdjust()));
rowShow=new QAction(tr("Show Row"), tr("&Show"), 0, this);
connect(rowShow, SIGNAL(activated()), this, SLOT(slotRowShow()));
rowHide=new QAction(tr("Hide Row"), tr("&Hide"), 0, this);
connect(rowHide, SIGNAL(activated()), this, SLOT(slotRowHide()));
colWidth=new QAction(tr("Column Width"), tr("&Width"), 0, this);
connect(colWidth, SIGNAL(activated()), this, SLOT(slotColumnWidth()));
colAdjust=new QAction(tr("Adjust Column"), tr("&Adjust"), 0, this);
connect(colAdjust, SIGNAL(activated()), this, SLOT(slotColumnAdjust()));
colShow=new QAction(tr("Show Column"), tr("&Show"), 0, this);
connect(colShow, SIGNAL(activated()), this, SLOT(slotColumnShow()));
colHide=new QAction(tr("Hide Column"), tr("&Hide"), 0, this);
connect(colHide, SIGNAL(activated()), this, SLOT(slotColumnHide()));
sheetRename=new QAction(tr("Rename Sheet"), tr("&Rename"), 0, this);
connect(sheetRename, SIGNAL(activated()), this, SLOT(slotSheetRename()));
sheetRemove=new QAction(tr("Remove Sheet"), tr("R&emove"), 0, this);
connect(sheetRemove, SIGNAL(activated()), this, SLOT(slotSheetRemove()));
dataSort=new QAction(tr("Sort Data"), tr("&Sort"), 0, this);
connect(dataSort, SIGNAL(activated()), this, SLOT(slotDataSort()));
dataFindReplace=new QAction(tr("Find && Replace"), tr("&Find && Replace"), 0, this);
connect(dataFindReplace, SIGNAL(activated()), this, SLOT(slotDataFindReplace()));
funcEqual=new QAction(tr("Equal To"), QPixmap(func_equal_xpm), tr("&Equal To"), 0, this);
funcEqual->setToolTip("=");
connect(funcEqual, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
funcPlus=new QAction(tr("Addition"), QPixmap(func_plus_xpm), tr("&Addition"), 0, this);
funcPlus->setToolTip("+");
connect(funcPlus, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
funcMinus=new QAction(tr("Subtraction"), QPixmap(func_minus_xpm), tr("&Subtraction"), 0, this);
funcMinus->setToolTip("-");
connect(funcMinus, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
funcCross=new QAction(tr("Multiplication"), QPixmap(func_cross_xpm), tr("&Multiplication"), 0, this);
funcCross->setToolTip("*");
connect(funcCross, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
funcDivide=new QAction(tr("Division"), QPixmap(func_divide_xpm), tr("&Division"), 0, this);
funcDivide->setToolTip("/");
connect(funcDivide, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
funcParanOpen=new QAction(tr("Open ParanthesistempCellData->row+row1, tempCellData->col+col1"), QPixmap(func_paran_open_xpm), tr("&Open Paranthesis"), 0, this);
funcParanOpen->setToolTip("(");
connect(funcParanOpen, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
funcParanClose=new QAction(tr("Close Paranthesis"), QPixmap(func_paran_close_xpm), tr("&Close Paranthesis"), 0, this);
funcParanClose->setToolTip(")");
connect(funcParanClose, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
funcComma=new QAction(tr("Comma"), QPixmap(func_comma_xpm), tr("&Comma"), 0, this);
funcComma->setToolTip(",");
connect(funcComma, SIGNAL(activated()), this, SLOT(slotFuncOutput()));
}
void MainWindow::initMenu()
{
- menu=new QPEMenuBar(this);
+ menu=new QMenuBar(this);
menuFile=new QPopupMenu;
fileNew->addTo(menuFile);
fileOpen->addTo(menuFile);
fileSave->addTo(menuFile);
fileSaveAs->addTo(menuFile);
// menuFile->insertSeparator();
// fileQuit->addTo(menuFile);
menu->insertItem(tr("&File"), menuFile);
menuEdit=new QPopupMenu;
editAccept->addTo(menuEdit);
editCancel->addTo(menuEdit);
editCellSelect->addTo(menuEdit);
menuEdit->insertSeparator();
editCut->addTo(menuEdit);
editCopy->addTo(menuEdit);
editPaste->addTo(menuEdit);
editPasteContents->addTo(menuEdit);
editClear->addTo(menuEdit);
menu->insertItem(tr("&Edit"), menuEdit);
menuInsert=new QPopupMenu;
menu->insertItem(tr("&Insert"), menuInsert);
menuFormat=new QPopupMenu;
formatCells->addTo(menuFormat);
menu->insertItem(tr("&Format"), menuFormat);
menuData=new QPopupMenu;
dataSort->addTo(menuData);
dataFindReplace->addTo(menuData);
menu->insertItem(tr("&Data"), menuData);
// menuHelp=new QPopupMenu;
// helpGeneral->addTo(menuHelp);
// helpAbout->addTo(menuHelp);
// menu->insertItem(tr("&Help"), menuHelp);
submenuRow=new QPopupMenu;
rowHeight->addTo(submenuRow);
rowAdjust->addTo(submenuRow);
rowShow->addTo(submenuRow);
rowHide->addTo(submenuRow);
menuFormat->insertItem(tr("&Row"), submenuRow);
submenuCol=new QPopupMenu;
colWidth->addTo(submenuCol);
colAdjust->addTo(submenuCol);
colShow->addTo(submenuCol);
colHide->addTo(submenuCol);
menuFormat->insertItem(tr("Colum&n"), submenuCol);
submenuSheet=new QPopupMenu;
sheetRename->addTo(submenuSheet);
sheetRemove->addTo(submenuSheet);
menuFormat->insertItem(tr("&Sheet"), submenuSheet);
submenuFunc=new QPopupMenu;
menuInsert->insertItem(tr("&Function"), submenuFunc);
submenuFuncStd=new QPopupMenu;
funcPlus->addTo(submenuFuncStd);
funcMinus->addTo(submenuFuncStd);
funcCross->addTo(submenuFuncStd);
funcDivide->addTo(submenuFuncStd);
submenuFunc->insertItem(tr("&Standard"), submenuFuncStd);
submenuFuncMath=new QPopupMenu;
addFlyAction(tr("Summation"), tr("&Summation"), "SUM(", submenuFuncMath);
addFlyAction(tr("Absolute Value"), tr("&Absolute"), "ABS(", submenuFuncMath);
submenuFuncMath->insertSeparator();
addFlyAction(tr("Sine"), tr("Si&ne"), "SIN(", submenuFuncMath);
addFlyAction(tr("Arc Sine"), tr("A&rc Sine"), "ASIN(", submenuFuncMath);
addFlyAction(tr("Cosine"), tr("&Cosine"), "COS(", submenuFuncMath);
addFlyAction(tr("ArcCosine"), tr("Arc Cos&ine"), "COS(", submenuFuncMath);
addFlyAction(tr("Tangent"), tr("&Tangent"), "TAN(", submenuFuncMath);
addFlyAction(tr("Arc Tangent"), tr("Arc Tan&gent"), "ATAN(", submenuFuncMath);
addFlyAction(tr("Arc Tangent of Coordinates"), tr("C&oor. Arc Tangent"), "ATAN2(", submenuFuncMath);
submenuFuncMath->insertSeparator();
addFlyAction(tr("Exponential"), tr("&Exponential"), "EXP(", submenuFuncMath);
addFlyAction(tr("Logarithm"), tr("&Logarithm"), "LOG(", submenuFuncMath);
addFlyAction(tr("Power"), tr("&Power"), "POW(", submenuFuncMath);
submenuFunc->insertItem(tr("&Mathematical"), submenuFuncMath);
submenuFuncStat=new QPopupMenu;
addFlyAction(tr("Average"), tr("&Average"), "AVG(", submenuFuncStat);
addFlyAction(tr("Maximum"), tr("Ma&ximum"), "MAX(", submenuFuncStat);
addFlyAction(tr("Minimum"), tr("&Minimum"), "MIN(", submenuFuncStat);
addFlyAction(tr("Count"), tr("&Count"), "COUNT(", submenuFuncStat);
submenuFunc->insertItem(tr("&Statistical"), submenuFuncStat);
menuInsert->insertSeparator();
insertCells->addTo(menuInsert);
insertRows->addTo(menuInsert);
insertCols->addTo(menuInsert);
insertSheets->addTo(menuInsert);
}
void MainWindow::initStandardToolbar()
{
toolbarStandard=new QPEToolBar(this);
toolbarStandard->setHorizontalStretchable(TRUE);
moveToolBar(toolbarStandard, Top);
fileNew->addTo(toolbarStandard);
fileOpen->addTo(toolbarStandard);
fileSave->addTo(toolbarStandard);
comboSheets=new QComboBox(toolbarStandard);
toolbarStandard->setStretchableWidget(comboSheets);
connect(comboSheets, SIGNAL(activated(const QString &)), this, SLOT(slotSheetChanged(const QString &)));
}
void MainWindow::initFunctionsToolbar()
{
toolbarFunctions=new QPEToolBar(this);
toolbarFunctions->setHorizontalStretchable(TRUE);
moveToolBar(toolbarFunctions, Bottom);
funcEqual->addTo(toolbarFunctions);
funcPlus->addTo(toolbarFunctions);
funcMinus->addTo(toolbarFunctions);
funcCross->addTo(toolbarFunctions);
funcDivide->addTo(toolbarFunctions);
funcParanOpen->addTo(toolbarFunctions);
funcParanClose->addTo(toolbarFunctions);
funcComma->addTo(toolbarFunctions);
toolFunction=new QToolButton(toolbarFunctions);
toolFunction->setPixmap(func_func_xpm);
toolFunction->setTextLabel(tr("Functions"));
toolFunction->setPopup(submenuFunc);
toolFunction->setPopupDelay(0);
}
void MainWindow::initEditToolbar()
{
toolbarEdit=new QPEToolBar(this);
toolbarEdit->setHorizontalStretchable(TRUE);
moveToolBar(toolbarEdit, Bottom);
editAccept->addTo(toolbarEdit);
editCancel->addTo(toolbarEdit);
editData=new QLineEdit(toolbarEdit);
toolbarEdit->setStretchableWidget(editData);
connect(editData, SIGNAL(returnPressed()), this, SLOT(slotEditAccept()));
editCellSelect->addTo(toolbarEdit);
}
void MainWindow::slotHelpAbout()
{
QDialog dialogAbout(this, 0, TRUE);
dialogAbout.resize(width()-40, height()-80);
dialogAbout.setCaption(tr("About Opie Sheet"));
QLabel label(tr("Opie Sheet\nSpreadsheet Software for Opie\nQWDC Beta Winner (as Sheet/Qt)\n\nDeveloped by: Serdar Ozler\nRelease 1.0.2\nRelease Date: October 08, 2002\n\nThis product is licensed under GPL. It is freely distributable. If you want to get the latest version and also the source code, please visit the web site.\n\nhttp://qtopia.sitebest.com"), &dialogAbout);
label.setGeometry(dialogAbout.rect());
label.setAlignment(Qt::AlignCenter | Qt::WordBreak);
dialogAbout.exec();
}
void MainWindow::initSheet()
{
sheet=new Sheet(DEFAULT_NUM_ROWS, DEFAULT_NUM_COLS, this);
setCentralWidget(sheet);
connect(sheet, SIGNAL(currentDataChanged(const QString &)), editData, SLOT(setText(const QString &)));
connect(sheet, SIGNAL(cellClicked(const QString &)), this, SLOT(slotCellClicked(const QString &)));
connect(sheet, SIGNAL(sheetModified()), this, SLOT(slotDocModified()));
connect(editCut, SIGNAL(activated()), sheet, SLOT(editCut()));
connect(editCopy, SIGNAL(activated()), sheet, SLOT(editCopy()));
connect(editClear, SIGNAL(activated()), sheet, SLOT(editClear()));
}
void MainWindow::slotEditAccept()
{
sheet->setData(editData->text());
}
void MainWindow::slotEditCancel()
{
editData->setText(sheet->getData());
}
void MainWindow::slotCellSelect(bool lock)
{
sheet->lockClicks(lock);
diff --git a/noncore/apps/opie-sheet/mainwindow.h b/noncore/apps/opie-sheet/mainwindow.h
index 370d82e..4007f88 100644
--- a/noncore/apps/opie-sheet/mainwindow.h
+++ b/noncore/apps/opie-sheet/mainwindow.h
@@ -1,133 +1,133 @@
/***************************************************************************
* *
* 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>
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qpe/applnk.h>
#include <qpe/fileselector.h>
-#include <qpe/qpemenubar.h>
+#include <qmenubar.h>
#include <qpe/qpetoolbar.h>
#include <qmainwindow.h>
#include <qaction.h>
#include <qlineedit.h>
#include <qbutton.h>
#include <qcombobox.h>
#include <qtoolbutton.h>
#include "sheet.h"
typedef struct typeSheet
{
QString name;
QList<typeCellData> data;
};
class MainWindow: public QMainWindow
{
Q_OBJECT
// QPE objects
DocLnk* currentDoc;
- QPEMenuBar *menu;
+ QMenuBar *menu;
QPEToolBar *toolbarFunctions, *toolbarEdit, *toolbarStandard;
FileSelector *fileSelector;
// QT objects
QPopupMenu *menuFile, *menuEdit, *menuInsert, *menuFormat, *menuData, *menuHelp,
*submenuFunc, *submenuFuncStd, *submenuFuncMath, *submenuFuncStat,
*submenuRow, *submenuCol, *submenuSheet;
QAction *fileNew, *fileOpen, *fileSave, *fileSaveAs, *fileQuit, *helpAbout, *editAccept, *editCancel, *formatCells,
*funcPlus, *funcMinus, *funcCross, *funcDivide, *funcParanOpen, *funcParanClose, *funcComma, *funcEqual,
*editCut, *editCopy, *editPaste, *editPasteContents, *editClear, *insertCols, *insertRows, *insertSheets, *insertCells,
*rowHeight, *rowShow, *rowHide, *rowAdjust, *colWidth, *colShow, *colHide, *colAdjust, *sheetRename, *sheetRemove,
*dataSort, *dataFindReplace, *editCellSelect, *helpGeneral;
QLineEdit *editData;
QButton *buttonUp, *buttonDown, *buttonLeft, *buttonRight;
QComboBox *comboSheets;
QToolButton *toolFunction;
QList<typeSheet> listSheets;
QString helpFile;
// Other objects
Sheet *sheet;
// Variables
bool documentModified;
// Private functions
void initMenu();
void initActions();
void initFunctionsToolbar();
void initEditToolbar();
void initStandardToolbar();
void initSheet();
void addToData(const QString &data);
int saveCurrentFile(bool ask=TRUE);
void documentOpen(const DocLnk &lnkDoc);
void documentSave(DocLnk *lnkDoc);
void closeEvent(QCloseEvent *e);
void addFlyAction(const QString &text, const QString &menuText, const QString &tip, QWidget *w);
typeSheet *createNewSheet();
typeSheet *findSheet(const QString &name);
private slots:
void slotFileNew();
void slotFileOpen();
void slotFileSave();
void slotFileSaveAs();
void slotHelpAbout();
void slotEditAccept();
void slotEditCancel();
void slotEditPaste();
void slotEditPasteContents();
void slotFormatCells();
void slotInsertCells();
void slotInsertRows();
void slotInsertCols();
void slotInsertSheets();
void slotDataSort();
void slotDataFindReplace();
void slotRowHeight();
void slotRowAdjust();
void slotRowShow();
void slotRowHide();
void slotColumnWidth();
void slotColumnAdjust();
void slotColumnShow();
void slotColumnHide();
void slotSheetRename();
void slotSheetRemove();
void slotFuncOutput();
void slotCellSelect(bool lock);
void slotCellClicked(const QString &cell);
void slotSheetChanged(const QString &name);
void slotDocModified();
void selectorShow();
void selectorHide();
void selectorFileNew(const DocLnk &lnkDoc);
void selectorFileOpen(const DocLnk &lnkDoc);
public:
static QString appName() { return QString::fromLatin1("sheetqt"); }
MainWindow(QWidget *p, const char*, WFlags);
~MainWindow();
void setHelpFile(const QString &help_filename) { helpFile=help_filename; }
public slots:
void setDocument(const QString &applnk_filename);
};
#endif
diff --git a/noncore/apps/qashmoney/budgetdisplay.cpp b/noncore/apps/qashmoney/budgetdisplay.cpp
index afc6a2d..492595a 100755
--- a/noncore/apps/qashmoney/budgetdisplay.cpp
+++ b/noncore/apps/qashmoney/budgetdisplay.cpp
@@ -1,228 +1,228 @@
#include <qmessagebox.h>
#include <qheader.h>
#include <qfont.h>
#include <sqlite.h>
#include "budgetdisplay.h"
#include "budget.h"
#include "newaccount.h"
#include "datepicker.h"
#include "preferences.h"
#include "transaction.h"
extern Preferences *preferences;
extern Budget *budget;
extern Transaction *transaction;
BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent )
{
QFont font = this->font();
font.setWeight ( QFont::Bold );
//set the default date to today
newDate = QDate::currentDate ();
year = newDate.year();
month = newDate.month();
day = newDate.day();
datelabel = preferences->getDate ( year, month );
setCaption ( "Budget" );
firstline = new QHBox ( this );
firstline->setSpacing ( 2 );
secondline = new QHBox ( this );
secondline->setSpacing ( 10 );
- menu = new QPEMenuBar ( this );
+ menu = new QMenuBar ( this );
menu->setFrameStyle ( QFrame::Box | QFrame::Sunken );
budgetmenu = new QPopupMenu ( this );
lineitemsmenu = new QPopupMenu ( this );
datemenu = new QPopupMenu ( this );
menu->insertItem ( "Budget", budgetmenu );
menu->insertItem ( "Line Item", lineitemsmenu );
menu->insertItem ( "Date", datemenu );
budgetmenu->insertItem ( "New", this, SLOT ( newBudget () ), 0, 1 );
budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget () ), 0, 2 );
budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget () ), 0, 3 );
lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem () ), 0, 1 );
lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem () ), 0, 2 );
lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem () ), 0, 3 );
datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) );
budgetbox = new QComboBox ( firstline );
connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) );
budgetview = new QComboBox ( firstline );
budgetview->insertItem ( "Month" );
budgetview->insertItem ( "Year" );
connect ( budgetview, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentView ( int ) ) );
budgeted = new QLabel ( secondline );
budgeted->setFont ( font );
actual = new QLabel ( secondline );
actual->setFont ( font );
date = new QLabel ( secondline );
date->setFont ( font );
listview = new QListView ( this );
listview->setAllColumnsShowFocus ( TRUE );
listview->setShowSortIndicator ( TRUE );
listview->setRootIsDecorated ( TRUE );
listview->setMultiSelection ( FALSE );
listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13
listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14
listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15
listview->addColumn ( "", 0 ); // line item ids
listview->setColumnWidthMode ( 0, QListView::Manual );
listview->setColumnWidthMode ( 1, QListView::Manual );
listview->setColumnWidthMode ( 2, QListView::Manual );
listview->setColumnAlignment ( 1, Qt::AlignRight );
listview->setColumnAlignment ( 2, Qt::AlignRight );
listview->setColumnWidthMode ( 3, QListView::Manual );
listview->header()->setTracking ( FALSE );
connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) );
connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) );
// pull the column sorting preference from the preferences table, and configure the listview accordingly
int column = 0;
int direction = 0;
preferences->getSortingPreference ( 3, &column, &direction );
listview->setSorting ( column, direction );
displayBudgetNames();
layout = new QVBoxLayout ( this, 2, 2 );
layout->setMenuBar ( menu );
layout->addWidget ( firstline );
layout->addWidget ( secondline );
layout->addWidget ( listview );
}
void BudgetDisplay::deleteBudget ()
{
listview->clear();
transaction->clearBudgetIDs ( currentbudget );
budget->deleteBudget ( currentbudget );
if ( budgetbox->count() != 0 )
displayBudgetNames();
checkBudgets();
}
void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize )
{
switch ( column )
{
case 0:
preferences->changeColumnPreference ( 13, newsize );
break;
case 1:
preferences->changeColumnPreference ( 14, newsize );
break;
case 2:
preferences->changeColumnPreference ( 15, newsize );
break;
}
}
void BudgetDisplay::saveSortingPreference ( int column )
{
preferences->changeSortingPreference ( 3, column );
}
int BudgetDisplay::getIDColumn ()
{
int counter;
int columns = listview->columns();
for ( counter = 0; counter <= columns; counter++ )
if ( listview->header()->label ( counter ).length() == 0 )
return counter;
}
void BudgetDisplay::newBudget ()
{
constructBudgetWindow();
int response = nb->exec();
if ( response == 1 )
{
// open a new budget object
int addedbudget = budget->addBudget ( budgetname->text(), 0, description->text(), currencybox->currencybox->currentText(), day, month, year, day, month, year, 0 );
transaction->clearBudgetIDs ( addedbudget );
displayBudgetNames();
}
checkBudgets();
}
void BudgetDisplay::constructBudgetWindow ()
{
//construct and format the new budget window
nb = new QDialog ( this, 0, TRUE );
nb->setCaption ( "Budget" );
QLabel *namelabel = new QLabel ( "Budget Name", nb );
budgetname = new QLineEdit ( nb );
QLabel *descriptionlabel = new QLabel ( "Description", nb );
description = new QLineEdit ( nb );
currencybox = new Currency ( nb );
QBoxLayout *layout = new QVBoxLayout ( nb, 2, 2 );
layout->addWidget ( namelabel );
layout->addWidget ( budgetname );
layout->addWidget ( descriptionlabel );
layout->addWidget ( description );
layout->addWidget ( currencybox );
}
void BudgetDisplay::displayBudgetNames ()
{
budgetbox->clear();
if ( budget->getNumberOfBudgets() != 0 )
{
ids = budget->getBudgetIDs();
for ( QStringList::Iterator it = ids->begin(); it != ids->end(); ++it )
{
QString flag = "/opt/QtPalmtop/pics/flags/";
flag.append ( budget->getCurrency ( (*it).toInt() ) );
flag.append ( ".png" );
budgetbox->insertItem ( QPixmap ( flag ), budget->getBudgetName ( (*it).toInt() ) );
}
setCurrentBudget ( 0 );
}
else
checkBudgets();
}
void BudgetDisplay::setCurrentBudget ( int index )
{
currentbudget = ( ids->operator[] ( index ).toInt() );
displayLineItems();
}
void BudgetDisplay::setCurrentView ( int index )
{
displayLineItems();
}
void BudgetDisplay::showCalendar ()
{
// create new calendar object and show it
DatePicker *dp = new DatePicker ( QDate ( year, month, day ) );
dp->daylabel->hide();
dp->daybox->hide();
if ( budgetview->currentItem() == 1 )
{
dp->monthlabel->hide();
dp->monthbox->hide();
}
dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
int response = dp->exec();
if ( response == 1 )
{
// Set date integers
year = dp->getYear();
if ( budgetview->currentItem() == 0 )
month = dp->getMonth();
else
month = newDate.month();
datelabel = preferences->getDate ( year, month );
displayLineItems();
}
diff --git a/noncore/apps/qashmoney/budgetdisplay.h b/noncore/apps/qashmoney/budgetdisplay.h
index 3976ce1..a4e806c 100755
--- a/noncore/apps/qashmoney/budgetdisplay.h
+++ b/noncore/apps/qashmoney/budgetdisplay.h
@@ -1,86 +1,86 @@
#ifndef BUDGETDISPLAY_H
#define BUDGETDISPLAY_H
#include <qlistview.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qstringlist.h>
#include <qdatetime.h>
-#include <qpe/qpemenubar.h>
+#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qhbox.h>
#include "currency.h"
class BudgetDisplay : public QWidget
{
Q_OBJECT
public:
BudgetDisplay ( QWidget *parent );
- QPEMenuBar *menu;
+ QMenuBar *menu;
QPopupMenu *budgetmenu;
QPopupMenu *lineitemsmenu;
QPopupMenu *datemenu;
QHBox *firstline;
QHBox *secondline;
QLabel *budgeted;
QLabel *actual;
QLabel *date;
QLineEdit *budgetname;
QLineEdit *description;
Currency *currencybox;
QLineEdit *lineitemname;
QLineEdit *lineitemamount;
QComboBox *lineitemtime;
QListView *listview;
QComboBox *budgetbox;
QComboBox *budgetview;
QBoxLayout *layout;
int getIDColumn ();
public slots:
void displayBudgetNames ();
void displayLineItems ();
void updateBudgetInformation ();
private slots:
void saveColumnSize ( int column, int oldsize, int newsize );
void newBudget ();
void deleteBudget ();
void setCurrentBudget ( int );
void setCurrentView ( int );
void showCalendar ();
void newLineItem ();
void deleteLineItem ();
void checkBudgets ();
void editBudget ();
void editLineItem ();
void constructBudgetWindow ();
void constructLineItemWindow ();
void saveSortingPreference ( int column );
private:
QStringList *names;
QStringList *ids;
int currentbudget, year, month, day;
QDate newDate;
QString totalbudget, totalactual;
QString datelabel;
QDialog *nb;
QDialog *newlineitem;
};
#endif // BUDGETDISPLAY_H
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp
index 20e8d32..e985f0b 100755
--- a/noncore/apps/qashmoney/qashmoney.cpp
+++ b/noncore/apps/qashmoney/qashmoney.cpp
@@ -1,218 +1,218 @@
#include "qashmoney.h"
#include "preferencedialogs.h"
#include "memorydialog.h"
#include <qheader.h>
#include <iostream.h>
Budget *budget = new Budget ();
Preferences *preferences = new Preferences ();
Account *account = new Account ();
Transaction *transaction = new Transaction ();
Transfer *transfer = new Transfer ();
Memory *memory = new Memory ();
QashMoney::QashMoney () : QWidget ()
{
preferences->addPreferences ();
preferences->initializeColumnPreferences ();
preferences->initializeSortingPreferences ();
// set the text in the upper part of the frame
setCaption ( tr ( "QashMoney" ) );
// Create new menubar for our mainwindow
// and add menu items
- mainmenu = new QPEMenuBar ( this );
+ mainmenu = new QMenuBar ( this );
mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised );
preferencesmenu = new QPopupMenu ( this );
utilitiesmenu = new QPopupMenu ( this );
mainmenu->insertItem ( "Preferences", preferencesmenu );
mainmenu->insertItem ( "Utilities", utilitiesmenu );
preferencesmenu->insertItem ( "Date", this, SLOT ( displayDatePreferencesDialog () ) );
preferencesmenu->insertItem ( "Account", this, SLOT ( displayAccountPreferencesDialog () ) );
preferencesmenu->insertItem ( "Transaction", this, SLOT ( displayTransactionPreferencesDialog () ) );
utilitiesmenu->insertItem ( "Memory", this, SLOT ( displayMemoryDialog () ) );
// create the main tabwidget for displaying accounts and transactions
maintabs = new QTabWidget ( this );
tab = new QWidget ( this );
tab_2 = new QWidget ( this );
tab_3 = new QWidget ( this );
maintabs->addTab ( tab, "Accounts" );
maintabs->addTab ( tab_2, "Transactions" );
maintabs->addTab ( tab_3, "Budgets" );
tabheight = tab->height();
maintabs->setTabEnabled ( tab_2, FALSE );
// create a new account display object
accountdisplay = new AccountDisplay ( maintabs );
accountdisplay->setTabs ( tab_2, maintabs );
connect ( accountdisplay->listview, SIGNAL ( selectionChanged () ), this, SLOT ( setTransactionTab () ) );
// set the connection to disable the one touch account viewing if we are transfering money
connect ( accountdisplay->transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( toggleOneTouchViewing ( bool ) ) );
// create a new transactiondisplay object
transactiondisplay = new TransactionDisplay ( maintabs );
transactiondisplay->hide();
// create new budgetdisplay object
budgetdisplay = new BudgetDisplay ( maintabs );
budgetdisplay->hide();
tabslayout = new QVBoxLayout ( maintabs, 4, 2 );
tabslayout->addSpacing ( tabheight );
tabslayout->addWidget ( accountdisplay );
tabslayout->addWidget ( transactiondisplay );
tabslayout->addWidget ( budgetdisplay );
// connect a change in the maintabs with changing the tab display
connect ( maintabs, SIGNAL ( currentChanged ( QWidget * ) ), this, SLOT ( changeTabDisplay () ) );
// create layout that will contain the menubar and the maintabs
layout = new QVBoxLayout ( this, 2, 2 );
layout->setMenuBar ( mainmenu );
layout->addWidget ( maintabs );
}
QashMoney::~QashMoney ()
{
delete budget;
delete preferences;
delete account;
delete transaction;
delete transfer;
delete memory;
}
void QashMoney::changeTabDisplay ()
{
// if the user pressed the transactions tab, hide the account display
// object and create a new transaction display
if ( maintabs->currentPageIndex() == 1 )
{
// initialize variables
bool children = FALSE;
// hide the account display and define accountid
int accountid = accountdisplay->listview->selectedItem()->text ( accountdisplay->getIDColumn() ).toInt();
//remove all the columns from the transactiondisplay
int columns = transactiondisplay->listview->columns();
int counter;
for ( counter = 0; counter <= columns; counter++ )
transactiondisplay->listview->removeColumn ( 0 );
// set the account name and account balance
QString name = account->getAccountName ( accountid );
QString balance = account->getAccountBalance ( accountid );
transactiondisplay->name->setText ( name );
transactiondisplay->balance->setText ( balance );
// clear the limitbox
transactiondisplay->limitbox->clear();
// get parent account id
int parentaccountid = account->getParentAccountID ( accountid );
// add columns based on which account is selected
// this first if determines if we selected a parent with no children or a child
// in these cases, we add standard three columns for date, transaction, amount
transactiondisplay->listview->addColumn ( "Date", 0 );
transactiondisplay->listview->addColumn ( "Transaction", 0 );
transactiondisplay->listview->addColumn ( "Amt", 0);
transactiondisplay->listview->setColumnAlignment ( 2, Qt::AlignRight );
transactiondisplay->listview->addColumn ( "", 0 );
if ( accountdisplay->listview->selectedItem()->parent() == 0 && accountdisplay->listview->selectedItem()->childCount() != 0 ) // we selected a parent with children
{
// add an extra column for the account name for eac child transaction
transactiondisplay->listview->addColumn ( "Acct", 0 );
children = TRUE;
// hide the new transaction button
transactiondisplay->newtransaction->setEnabled ( FALSE );
}
else //we selected a parent without children or a child
transactiondisplay->newtransaction->setEnabled ( TRUE );
// disable the transactionid column so it can't be red
transactiondisplay->listview->header()->setResizeEnabled ( FALSE, 3 );
// set the accountid and children variables
transactiondisplay->setChildren ( children );
transactiondisplay->setAccountID ( accountid );
setTransactionDisplayDate ();
// display transactions
transactiondisplay->listview->clear();
QString displaytext = "%";
displaytext.prepend ( transactiondisplay->limitbox->text() );
if ( transaction->getNumberOfTransactions() > 0 )
transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate );
// display transfers
transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate );
// open a new preferences object and resize the transaction display columns
// each column will have a different size based on whether we are looking at a child
// account or children through a parent
if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns
{
transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width
transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual );
transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width
transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual );
transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 5 ) ); // normal transaction amount width
transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual );
}
else
{
transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 6 ) ); // extended transaction date width
transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual );
transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 7 ) ); // extended transaction name width
transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual );
transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 8 ) ); // extended transaction amount width
transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual );
transactiondisplay->listview->setColumnWidth ( 4, preferences->getColumnPreference ( 9 ) ); // transaction account width
transactiondisplay->listview->setColumnWidthMode ( 4, QListView::Manual );
}
// pull the column sorting preference from the preferences table, and configure the listview accordingly
int column = 0;
int direction = 0;
preferences->getSortingPreference ( 2, &column, &direction );
transactiondisplay->listview->setSorting ( column, direction );
// show the window
transactiondisplay->show();
// hide the account display and define accountid
accountdisplay->hide();
// hide the budget display
budgetdisplay->hide();
}
else if ( maintabs->currentPageIndex() == 0 )
{
disableOneTouchViewing();
// clear the account display selection
accountdisplay->listview->clearSelection();
// resize the account display columns
accountdisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 1 ) );
accountdisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 2 ) );
// set sorting preference on account display columns
int column = 0;
int direction = 0;
preferences->getSortingPreference ( 1, &column, &direction );
accountdisplay->listview->setSorting ( column, direction );
// display the accounts
if ( account->getNumberOfAccounts() != 0 )
account->displayAccounts ( accountdisplay->listview );
maintabs->setTabEnabled ( tab_2, FALSE );
// set the toggle button
diff --git a/noncore/apps/qashmoney/qashmoney.h b/noncore/apps/qashmoney/qashmoney.h
index ec2c7ec..f2c456c 100755
--- a/noncore/apps/qashmoney/qashmoney.h
+++ b/noncore/apps/qashmoney/qashmoney.h
@@ -1,64 +1,64 @@
#ifndef QASHMONEY_H
#define QASHMONEY_H
-#include <qpe/qpemenubar.h>
+#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qlayout.h>
#include <qtabwidget.h>
#include <qdatetime.h>
#include "accountdisplay.h"
#include "transactiondisplay.h"
#include "budgetdisplay.h"
#include "account.h"
#include "preferences.h"
#include "transaction.h"
#include "transfer.h"
#include "memory.h"
#include "budget.h"
class QashMoney : public QWidget
{
Q_OBJECT
public:
QashMoney ();
~QashMoney();
QTabWidget* maintabs;
QWidget* tab;
QWidget* tab_2;
QWidget* tab_3;
- QPEMenuBar *mainmenu;
+ QMenuBar *mainmenu;
QPopupMenu *preferencesmenu;
QPopupMenu *utilitiesmenu;
public slots:
void displayDatePreferencesDialog ();
void displayTransactionPreferencesDialog ();
void displayAccountPreferencesDialog ();
void displayMemoryDialog ();
void setTransactionTab ();
private slots:
void changeTabDisplay ();
void showTransactions ();
void enableOneTouchViewing ();
void disableOneTouchViewing ();
void toggleOneTouchViewing ( bool );
void setTransactionDisplayDate ();
private:
QVBoxLayout *layout;
QVBoxLayout *tabslayout;
AccountDisplay *accountdisplay;
TransactionDisplay *transactiondisplay;
BudgetDisplay *budgetdisplay;
int tabheight;
QDate newdate;
};
#endif
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp
index fbb5c24..fdf0072 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -1,261 +1,261 @@
/**********************************************************************
** 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.
**
**********************************************************************/
/* local includes */
#include "tableviewer.h"
#include "ui/tvbrowseview.h"
#include "ui/tvfilterview.h"
#include "ui/tvlistview.h"
#include "ui/tveditview.h"
#include "ui/tvkeyedit.h"
#include "db/datacache.h"
/* QPE includes */
#include <qpe/fileselector.h>
#include <qpe/resource.h>
#include <qpe/qpetoolbar.h>
/* QTE includes */
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpopupmenu.h>
#include <qapplication.h>
#include <qwidgetstack.h>
#include <qlayout.h>
#include <qbuffer.h>
/*!
\class TableViewerWindow
\brief The main window widget of the application
This is the main widget of the table viewer application.
It is the co-ordination point.
*/
/*!
Constructs a new TableViewerWindow
*/
TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f)
: QMainWindow(parent, name, f)
{
setCaption(tr("Table Viewer"));
/* Build data */
ds = new DBStore();
doc.setType("text/x-xml-tableviewer");
doc.setName("table");
dirty = FALSE;
ts.current_column = 0;
ts.kRep = ds->getKeys();
/* build menus */
- menu = new QPEMenuBar(this, 0);
+ menu = new QMenuBar(this, 0);
QPopupMenu *file_menu = new QPopupMenu;
file_menu->insertItem("New", this, SLOT(newDocument()));
file_menu->insertItem("Open", this, SLOT(selectDocument()));
file_menu->insertSeparator();
file_menu->insertItem("Properties");
/* later will want to set this up to clean up first via this, SLOT(quit) */
menu->insertItem("Document", file_menu);
QPopupMenu *edit_menu = new QPopupMenu;
edit_menu->insertItem("Edit Item", this, SLOT(editItemSlot()));
edit_menu->insertItem("Edit Keys", this, SLOT(editKeysSlot()));
edit_menu->insertItem("Edit filters", this, SLOT(filterViewSlot()));
menu->insertItem("Edit", edit_menu);
QPopupMenu *view_menu = new QPopupMenu;
view_menu->insertItem("Browse View", this, SLOT(browseViewSlot()));
view_menu->insertItem("List View", this, SLOT(listViewSlot()));
menu->insertItem("View", view_menu);
QVBoxLayout *main_layout = new QVBoxLayout;
/* Build tool bar */
navigation = new QPEToolBar(this, "navigation");
QToolButton *newItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("new")), "New Item", QString::null,
this, SLOT(newItemSlot()), navigation, "New Item");
QToolButton *editItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null,
this, SLOT(editItemSlot()), navigation, "Edit Item");
QToolButton *deleteItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("trash")), "Delete Item",
QString::null, this,
SLOT(deleteItemSlot()), navigation, "Delete Item");
navigation->addSeparator();
QToolButton *firstItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("fastback")), "First Item",
QString::null, this,
SLOT(firstItem()), navigation, "First Item");
QToolButton *previousItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("back")), "Previous Item",
QString::null, this,
SLOT(previousItem()), navigation, "Previous Item");
QToolButton *nextItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("forward")), "Next Item",
QString::null, this,
SLOT(nextItem()), navigation, "Next Item");
QToolButton *lastItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("fastforward")), "Last Item",
QString::null, this,
SLOT(lastItem()), navigation, "Last Item");
navigation->addSeparator();
QToolButton *browseButton = new QToolButton(
QIconSet(Resource::loadPixmap("day")), "View Single Item",
QString::null, this,
SLOT(browseViewSlot()), navigation, "View Single Item");
QToolButton *listButton = new QToolButton(
QIconSet(Resource::loadPixmap("month")), "View Multiple Items",
QString::null, this,
SLOT(listViewSlot()), navigation, "View Multiple Items");
setToolBarsMovable(FALSE);
setToolBarsMovable(FALSE);
setToolBarsMovable(FALSE);
/* Build widgets */
browseView = new TVBrowseView(&ts, this, 0);
listView = new TVListView(&ts, this, 0);
filterView = new TVFilterView(&ts, this, 0);
fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer",
this, "fileselector");
fileSelector->setNewVisible(FALSE);
fileSelector->setCloseVisible(FALSE);
cw = new QWidgetStack(this, 0);
cw->addWidget(listView, ListState);
cw->addWidget(browseView, BrowseState);
cw->addWidget(filterView, FilterState);
cw->addWidget(fileSelector, FileState);
current_view = FileState;
cw->raiseWidget(current_view);
fileSelector->reread();
connect(browseView, SIGNAL(searchOnKey(int, TVVariant)),
this, SLOT(searchOnKey(int, TVVariant)));
connect(browseView, SIGNAL(sortChanged(int)),
this, SLOT(setPrimaryKey(int)));
connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot()));
connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)),
this, SLOT(openDocument(const DocLnk &)));
main_layout->addWidget(menu);
main_layout->addWidget(cw);
setCentralWidget(cw);
}
/*!
Destroys the TableViewerWindow
*/
TableViewerWindow::~TableViewerWindow()
{
if(dirty)
saveDocument();
}
/*!
Opens a file dialog and loads the file specified by the dialog
*/
void TableViewerWindow::selectDocument()
{
if(dirty)
saveDocument();
current_view = FileState;
cw->raiseWidget(current_view);
fileSelector->reread();
}
void TableViewerWindow::saveDocument()
{
if(!dirty)
return;
FileManager fm;
QIODevice *dev = fm.saveFile(doc);
if(!ds->saveSource(dev, doc.type())){
qWarning("Save unsuccessful");
return;
}
dev->close();
dirty = FALSE;
}
void TableViewerWindow::newDocument()
{
DocLnk nf;
nf.setType("text/x-xml-tableviewer");
nf.setName("table");
delete ds;
ds = new DBStore();
ts.current_column = 0;
ts.kRep = ds->getKeys();
browseView->reset();
listView->reset();
filterView->reset();
doc = nf;
dirty = FALSE;
current_view = BrowseState;
cw->raiseWidget(current_view);
/* now set up for editing the keys */
ts.kRep->addKey("key", TVVariant::String);
editKeysSlot();
}
void TableViewerWindow::setDocument(const QString &f)
{
openDocument(DocLnk(f, TRUE));
}
void TableViewerWindow::openDocument(const DocLnk &f)
{
if (!f.isValid())
return;
FileManager fm;
QIODevice *dev = fm.openFile(f);
doc = f;
if(ds->openSource(dev, doc.type())) {
DataElem *d;
browseView->reset();
listView->reset();
filterView->reset();
current_view = BrowseState;
cw->raiseWidget(current_view);
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp
index 06523f1..755ed10 100644
--- a/noncore/games/backgammon/backgammon.cpp
+++ b/noncore/games/backgammon/backgammon.cpp
@@ -1,297 +1,297 @@
#include "backgammon.h"
#include "aidialog.h"
#include "filedialog.h"
#include "playerdialog.h"
#include "rulesdialog.h"
#include "themedialog.h"
#include <qdatetime.h>
#include <qfile.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qstring.h>
#include <qtimer.h>
#include <qmainwindow.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include <stdlib.h>
BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
: QMainWindow(parent, name, fl)
{
if (!name) setName("BackGammon");
setCaption(tr( "Backgammon") );
setIcon( Resource::loadPixmap( "backgammon" ) );
//general counter varaible
int a=0;
//the game engine
move=new MoveEngine();
//load the default theme
Config conf("backgammon");
if(!conf.isValid())
{
qDebug("config file does not exist");
conf.setGroup("general");
conf.writeEntry("theme","default");
conf.setGroup("rules");
conf.writeEntry("move_with_pieces_out",false);
conf.writeEntry("nice_dice",false);
conf.setGroup("display");
conf.writeEntry("small",false);
conf.writeEntry("warning",true);
conf.setGroup("ai");
conf.writeEntry("rescue",6);
conf.writeEntry("eliminate",4);
conf.writeEntry("expose",1);
conf.writeEntry("protect",5);
conf.writeEntry("safe",3);
conf.writeEntry("empty",2);
}
conf.setGroup("general");
theme_name=conf.readEntry("theme","default");
QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
//the rules
conf.setGroup("rules");
rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false);
rules.generous_dice=conf.readBoolEntry("nice_dice",false);
move->setRules(rules);
//get the AI settings
AISettings ai;
conf.setGroup("ai");
ai.rescue=conf.readNumEntry("rescue",6);
ai.eliminate=conf.readNumEntry("eliminate",4);
ai.expose=conf.readNumEntry("expose",1);
ai.protect=conf.readNumEntry("protect",5);
ai.safe=conf.readNumEntry("safe",3);
ai.empty=conf.readNumEntry("empty",2);
move->setAISettings(ai);
//get the theme component names
Config theme(theme_file,Config::File);
if(!theme.isValid())
{
qDebug("theme file does not exist");
theme.setGroup("theme");
theme.writeEntry("board","casino_board_1");
theme.writeEntry("pieces1","casino_pieces_blue");
theme.writeEntry("pieces2","casino_pieces_white");
theme.writeEntry("dice1","casino_dice");
theme.writeEntry("dice2","casino_dice");
theme.writeEntry("table","casino_table_green");
theme.writeEntry("odds","casino_odds");
}
theme.setGroup("theme");
board_name=theme.readEntry("board","casino_board_1");
piecesA_name=theme.readEntry("pieces1","casino_pieces_blue");
piecesB_name=theme.readEntry("pieces2","casino_pieces_white");
diceA_name=theme.readEntry("dice1","casino_dice");
diceB_name=theme.readEntry("dice2","casino_dice");
table_name=theme.readEntry("table","casino_table_green");
odds_name=theme.readEntry("odds","casino_odds");
//the menu
- QPEMenuBar* menuBar = new QPEMenuBar(this);
+ QMenuBar* menuBar = new QMenuBar(this);
QPopupMenu* gamemenu= new QPopupMenu(this);
gamemenu->insertItem(tr( "New" ),this,SLOT(newgame()));
gamemenu->insertSeparator();
gamemenu->insertItem(tr( "Load" ),this,SLOT(loadgame()));
gamemenu->insertItem(tr( "Save" ),this,SLOT(savegame()));
gamemenu->insertSeparator();
gamemenu->insertItem(tr( "Delete" ),this,SLOT(deletegame()));
menuBar->insertItem(tr( "Game" ),gamemenu);
QPopupMenu* thememenu= new QPopupMenu(this);
thememenu->insertItem(tr( "New" ),this,SLOT(newtheme()));
thememenu->insertSeparator();
thememenu->insertItem(tr( "Load"),this,SLOT(loadtheme()));
thememenu->insertItem(tr( "Save" ),this,SLOT(savetheme()));
thememenu->insertSeparator();
thememenu->insertItem(tr( "Default"),this,SLOT(themedefault()));
thememenu->insertItem(tr( "Delete" ),this,SLOT(deletetheme()));
menuBar->insertItem(tr( "Theme" ),thememenu);
QPopupMenu* optionmenu=new QPopupMenu(this);
optionmenu->insertItem(tr( "Player" ),this,SLOT(playerselect()));
optionmenu->insertSeparator();
optionmenu->insertItem(tr( "AI" ),this,SLOT(modify_AI()));
optionmenu->insertItem(tr( "Rules" ),this,SLOT(setrules()));
menuBar->insertItem(tr( "Options"),optionmenu);
QWidget* mainarea=new QWidget(this);
setCentralWidget(mainarea);
//the main area
QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom);
area=new QCanvas(235,235);
boardview=new BackGammonView(area,mainarea);
boardview->setMaximumHeight(240);
layout->addWidget(boardview);
connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int)));
//status bar
message=new QLabel("<b>Backgammon</b>",mainarea);
message->setAlignment(AlignHCenter);
layout->addWidget(message);
//the marker
marker_current=new QCanvasRectangle(area);
marker_current->setBrush(QColor(0,0,255));
marker_current->setSize(15,5);
marker_current->setZ(1);
for(a=0;a<4;a++)
{
marker_next[a]=new QCanvasRectangle(area);
marker_next[a]->setBrush(QColor(0,255,0));
marker_next[a]->setSize(15,5);
marker_next[a]->setZ(1);
}
connect(move,SIGNAL(done_dice1()),this,SLOT(done_dice1()));
connect(move,SIGNAL(done_dice2()),this,SLOT(done_dice2()));
connect(move,SIGNAL(done_dice3()),this,SLOT(done_dice3()));
connect(move,SIGNAL(done_dice4()),this,SLOT(done_dice4()));
connect(move,SIGNAL(nomove()),this,SLOT(nomove()));
connect(move,SIGNAL(player_finished(int)),this,SLOT(finished(int)));
//the pieces
p1=new CanvasImageItem*[15];
p1_side=new CanvasImageItem*[15];
QImage piece_1_all(Resource::loadImage("backgammon/pieces/"+piecesA_name));
QImage piece_1_front=piece_1_all.copy(0,0,15,15);
QImage piece_1_side=piece_1_all.copy(0,15,15,5);
p2=new CanvasImageItem*[15];
p2_side=new CanvasImageItem*[15];
QImage piece_2_all(Resource::loadImage("backgammon/pieces/"+piecesB_name));
QImage piece_2_front=piece_2_all.copy(0,0,15,15);
QImage piece_2_side=piece_2_all.copy(0,15,15,5);
for(a=0;a<15;a++)
{
p1[a]=new CanvasImageItem(piece_1_front,area);
p1[a]->setSize(15,15);
p1_side[a]=new CanvasImageItem(piece_1_side,area);
p1_side[a]->setSize(15,5);
p2[a]=new CanvasImageItem(piece_2_front,area);
p2[a]->setSize(15,15);
p2_side[a]=new CanvasImageItem(piece_2_side,area);
p2_side[a]->setSize(15,5);
}
draw();
//the dice
QImage dicebgA_all(Resource::loadImage("backgammon/dice/"+diceA_name));
diceA1=new CanvasImageItem*[7];
diceA2=new CanvasImageItem*[7];
QImage dicebgB_all(Resource::loadImage("backgammon/dice/"+diceB_name));
diceB1=new CanvasImageItem*[7];
diceB2=new CanvasImageItem*[7];
QImage oddsbg_all=(Resource::loadImage("backgammon/odds/"+odds_name));
//oddsDice=new CanvasImageItem*[6];
for(a=0;a<7;a++)
{
QImage dicebgA=dicebgA_all.copy(a*25,0,25,25);
diceA1[a]=new CanvasImageItem(dicebgA,area);
diceA1[a]->setX(5);
diceA1[a]->setY(205-2);
diceA1[a]->setZ(1);
diceA1[a]->setSize(25,25);
diceA2[a]=new CanvasImageItem(dicebgA,area);
diceA2[a]->setX(35);
diceA2[a]->setY(205-2);
diceA2[a]->setZ(1);
diceA2[a]->setSize(25,25);
QImage dicebgB=dicebgB_all.copy(a*25,0,25,25);
diceB1[a]=new CanvasImageItem(dicebgB,area);
diceB1[a]->setX(175);
diceB1[a]->setY(205-2);
diceB1[a]->setZ(1);
diceB1[a]->setSize(25,25);
diceB2[a]=new CanvasImageItem(dicebgB,area);
diceB2[a]->setX(205);
diceB2[a]->setY(205-2);
diceB2[a]->setZ(1);
diceB2[a]->setSize(25,25);
/*
if(a<6)
{
QImage oddsbg=oddsbg_all.copy(a*15,0,15,15);
oddsDice[a]=new CanvasImageItem(oddsbg,area);
oddsDice[a]->setX(110);
oddsDice[a]->setY(210-2);
oddsDice[a]->setZ(1);
oddsDice[a]->setSize(15,15);
oddsDice[a]->hide();
}
*/
}
//oddsDice[0]->show();
//set the board
QImage boardbg(Resource::loadImage("backgammon/boards/"+board_name));
board=new CanvasImageItem(boardbg,area);
board->setX(0);
board->setY(0);
board->setZ(0);
board->setSize(235-2,200-2);
board->show();
//the table
QImage tablebg(Resource::loadImage("backgammon/table/"+table_name));
table=new CanvasImageItem(tablebg,area);
table->setX(0);
table->setY(200-2);
table->setZ(0);
table->setSize(235-2,20);
table->show();
//the no move marker
QImage nomovebg(Resource::loadImage("backgammon/no_move"));
nomove_marker=new CanvasImageItem(nomovebg,area);
nomove_marker->setX(0);
nomove_marker->setY(200);
nomove_marker->setZ(2);
nomove_marker->hide();
//default human against computer
player1_auto=false;
player2_auto=true;
//start new game
newgame();
}
BackGammon::~BackGammon()
{
//DESTRUCTOR
}
void BackGammon::newgame()
{
gameFinished=false;
QDateTime now=QDateTime::currentDateTime();
game_name=now.date().toString()+"_"+now.time().toString();
move->reset();
draw();
diceA1_value=7;
diceA2_value=7;
diceA3_value=7;
diceA4_value=7;
diceB1_value=7;
diff --git a/noncore/games/fifteen/fifteen.cpp b/noncore/games/fifteen/fifteen.cpp
index 293cd65..212f7b1 100644
--- a/noncore/games/fifteen/fifteen.cpp
+++ b/noncore/games/fifteen/fifteen.cpp
@@ -1,247 +1,247 @@
/**********************************************************************
** 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 "fifteen.h"
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qvbox.h>
#include <qaction.h>
#include <qlayout.h>
#include <qpainter.h>
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpemenubar.h>
#include <qstringlist.h>
#include <qapplication.h>
#include <stdlib.h>
#include <time.h>
FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name)
: QMainWindow( parent, name )
{
// random seed
srand(time(0));
setToolBarsMovable( FALSE );
QVBox *vbox = new QVBox( this );
PiecesTable *table = new PiecesTable( vbox );
setCentralWidget(vbox);
QPEToolBar *toolbar = new QPEToolBar(this);
toolbar->setHorizontalStretchable( TRUE );
addToolBar(toolbar);
- QPEMenuBar *menubar = new QPEMenuBar( toolbar );
+ QMenuBar *menubar = new QMenuBar( toolbar );
menubar->setMargin(0);
QPopupMenu *game = new QPopupMenu( this );
QWidget *spacer = new QWidget( toolbar );
spacer->setBackgroundMode( PaletteButton );
toolbar->setStretchableWidget( spacer );
QAction *a = new QAction( tr( "Randomize" ), Resource::loadPixmap( "new" ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) );
a->addTo( game );
a->addTo( toolbar );
a = new QAction( tr( "Solve" ), Resource::loadPixmap( "repeat" ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), table, SLOT( slotReset() ) );
a->addTo( game );
a->addTo( toolbar );
menubar->insertItem( tr( "Game" ), game );
}
PiecesTable::PiecesTable(QWidget* parent, const char* name )
: QTableView(parent, name), _menu(0), _randomized(false)
{
// setup table view
setFrameStyle(StyledPanel | Sunken);
setBackgroundMode(NoBackground);
setMouseTracking(true);
setNumRows(4);
setNumCols(4);
// init arrays
initMap();
readConfig();
initColors();
// set font
QFont f = font();
f.setPixelSize(18);
f.setBold( TRUE );
setFont(f);
}
PiecesTable::~PiecesTable()
{
writeConfig();
}
void PiecesTable::writeConfig()
{
Config cfg("Fifteen");
cfg.setGroup("Game");
QStringList map;
for (unsigned int i = 0; i < 16; i++)
map.append( QString::number( _map[i] ) );
cfg.writeEntry("Map", map, '-');
cfg.writeEntry("Randomized", _randomized );
}
void PiecesTable::readConfig()
{
Config cfg("Fifteen");
cfg.setGroup("Game");
QStringList map = cfg.readListEntry("Map", '-');
_randomized = cfg.readBoolEntry( "Randomized", FALSE );
unsigned int i = 0;
for ( QStringList::Iterator it = map.begin(); it != map.end(); ++it ) {
_map[i] = (*it).toInt();
i++;
if ( i > 15 ) break;
}
}
void PiecesTable::paintCell(QPainter *p, int row, int col)
{
int w = cellWidth();
int h = cellHeight();
int x2 = w - 1;
int y2 = h - 1;
int number = _map[col + row * numCols()] + 1;
// draw cell background
if(number == 16)
p->setBrush(colorGroup().background());
else
p->setBrush(_colors[number-1]);
p->setPen(NoPen);
p->drawRect(0, 0, w, h);
// draw borders
if (height() > 40) {
p->setPen(colorGroup().text());
if(col < numCols()-1)
p->drawLine(x2, 0, x2, y2); // right border line
if(row < numRows()-1)
p->drawLine(0, y2, x2, y2); // bottom boder line
}
// draw number
if (number == 16) return;
p->setPen(black);
p->drawText(0, 0, x2, y2, AlignHCenter | AlignVCenter, QString::number(number));
}
void PiecesTable::resizeEvent(QResizeEvent *e)
{
QTableView::resizeEvent(e);
setCellWidth(contentsRect().width()/ numRows());
setCellHeight(contentsRect().height() / numCols());
}
void PiecesTable::initColors()
{
_colors.resize(numRows() * numCols());
for (int r = 0; r < numRows(); r++)
for (int c = 0; c < numCols(); c++)
_colors[c + r *numCols()] = QColor(255 - 70 * c,255 - 70 * r, 150);
}
void PiecesTable::initMap()
{
_map.resize(16);
for (unsigned int i = 0; i < 16; i++)
_map[i] = i;
_randomized = false;
}
void PiecesTable::randomizeMap()
{
initMap();
_randomized = true;
// find the free position
int pos = _map.find(15);
int move = 0;
while ( move < 333 ) {
int frow = pos / numCols();
int fcol = pos - frow * numCols();
// find click position
int row = rand()%4;
int col = rand()%4;
// sanity check
if ( row < 0 || row >= numRows() ) continue;
if ( col < 0 || col >= numCols() ) continue;
if ( row != frow && col != fcol ) continue;
move++;
// rows match -> shift pieces
if(row == frow) {
if (col < fcol) {
for(int c = fcol; c > col; c--) {
_map[c + row * numCols()] = _map[ c-1 + row *numCols()];
}
}
else if (col > fcol) {
for(int c = fcol; c < col; c++) {
_map[c + row * numCols()] = _map[ c+1 + row *numCols()];
}
}
}
// cols match -> shift pieces
else if (col == fcol) {
if (row < frow) {
for(int r = frow; r > row; r--) {
_map[col + r * numCols()] = _map[ col + (r-1) *numCols()];
}
}
else if (row > frow) {
for(int r = frow; r < row; r++) {
_map[col + r * numCols()] = _map[ col + (r+1) *numCols()];
}
}
}
// move free cell to click position
_map[pos=(col + row * numCols())] = 15;
repaint();
}
}
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp
index 1d38c9f..476f7ce1 100644
--- a/noncore/games/go/gowidget.cpp
+++ b/noncore/games/go/gowidget.cpp
@@ -1,257 +1,257 @@
/**********************************************************************
** 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 "gowidget.h"
#include <qpe/config.h>
#include <qpe/resource.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpemenubar.h>
#include <qpopupmenu.h>
#include <qaction.h>
#include <qapplication.h> //processEvents()
#include <qlabel.h>
//#include <stdio.h>
#include "amigo.h"
#include "goplayutils.h"
static const enum bVal computer_color = BLACK;
static int current_handicap = 1;
static QBrush *goBrush;
//static QImage *newBlackStone;
//static QImage *blackStone;
//static QImage *whiteStone;
static QPixmap *newBlackStone;
static QPixmap *blackStone;
static QPixmap *whiteStone;
static bool smallStones = FALSE;
GoMainWidget::GoMainWidget( QWidget *parent, const char* name) :
QMainWindow( parent, name )
{
setToolBarsMovable( FALSE );
GoWidget *go = new GoWidget(this);
setCentralWidget(go);
toolbar = new QPEToolBar(this);
toolbar->setHorizontalStretchable( TRUE );
addToolBar(toolbar);
- QPEMenuBar *mb = new QPEMenuBar( toolbar );
+ QMenuBar *mb = new QMenuBar( toolbar );
mb->setMargin(0);
QPopupMenu *file = new QPopupMenu( this );
QAction *a = new QAction( tr( "New Game" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), go, SLOT( newGame() ) );
a->addTo( file );
a = new QAction( tr( "Pass" ), Resource::loadPixmap( "pass" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), go, SLOT( pass() ) );
a->addTo( file );
a->addTo( toolbar );
a = new QAction( tr( "Resign" ), Resource::loadPixmap( "reset" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), go, SLOT( resign() ) );
a->addTo( file );
a = new QAction( tr( "Two player option" ), QString::null, 0, this, 0 );
a->setToggleAction( TRUE );
connect( a, SIGNAL( toggled(bool) ), go, SLOT( setTwoplayer(bool) ) );
a->addTo( file );
mb->insertItem( tr( "Game" ), file );
QLabel *turnLabel = new QLabel( toolbar );
turnLabel->setBackgroundMode( PaletteButton );
connect( go, SIGNAL(showTurn(const QPixmap&)),
turnLabel, SLOT(setPixmap(const QPixmap&)) );
QLabel * scoreLabel = new QLabel( toolbar );
scoreLabel->setBackgroundMode( PaletteButton );
connect( go, SIGNAL(showScore(const QString&)),
scoreLabel, SLOT(setText(const QString&)) );
toolbar->setStretchableWidget( scoreLabel );
go->readConfig();
}
void GoMainWidget::resizeEvent( QResizeEvent * )
{
//### this won't work because of the text label...
/*
if ( width() > height() )
moveToolBar( toolbar, Left );
else
moveToolBar( toolbar, Top );
*/
}
GoWidget *GoWidget::self = 0;
GoWidget::GoWidget( QWidget *parent, const char* name) :
QWidget( parent, name )
{
if ( self )
fatal( "Only one Go widget allowed" );
self = this;
twoplayer = FALSE;
d = bx = by = 1;
QPixmap pix = Resource::loadPixmap( "go/pine" );
goBrush = new QBrush( black, pix );
/*
QString fn = Resource::findPixmap("Go-black");
blackStone = new QImage( fn );
fn = Resource::findPixmap("Go-black-highlight");
newBlackStone = new QImage( fn );
fn = Resource::findPixmap("Go-white");
whiteStone = new QImage( fn );
*/
blackStone = new QPixmap(Resource::loadPixmap( "Go-black" ));
whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" ));
newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" ));
init();
}
GoWidget::~GoWidget()
{
writeConfig();
}
void GoWidget::writeConfig()
{
Config cfg("Go");
cfg.setGroup("Game");
cfg.writeEntry("TwoPlayer", twoplayer);
cfg.writeEntry("CurrentPlayer", currentPlayer);
cfg.writeEntry("NPassed", nPassed);
QString b;
for (int i=0; i<19; i++)
for (int j=0; j<19; j++)
b += board[i][j] == BLACK ? 'B' : board[i][j] == WHITE ? 'W' : '.';
cfg.writeEntry("Board", b);
cfg.writeEntry("LastX", lastX);
cfg.writeEntry("LastY", lastY);
extern int blackPrisoners, whitePrisoners;
cfg.writeEntry("BlackPrisoners", blackPrisoners);
cfg.writeEntry("WhitePrisoners", whitePrisoners);
}
void GoWidget::readConfig()
{
init();
Config cfg("Go");
cfg.setGroup("Game");
twoplayer = cfg.readBoolEntry("TwoPlayer");
currentPlayer = (bVal)cfg.readNumEntry("CurrentPlayer",1);
nPassed = cfg.readNumEntry("NPassed",0);
QString b = cfg.readEntry("Board");
if ( b.length() == 19*19 )
for (int i=0; i<19; i++)
for (int j=0; j<19; j++) {
QChar ch = b[j+19*i];
if ( ch != '.' )
GoPlaceStone( ch == 'B' ? BLACK : WHITE, i, j );
}
lastX = cfg.readNumEntry("LastX");
lastY = cfg.readNumEntry("LastY");
extern int blackPrisoners, whitePrisoners;
blackPrisoners = cfg.readNumEntry("BlackPrisoners",0);
whitePrisoners = cfg.readNumEntry("WhitePrisoners",0);
reportPrisoners(blackPrisoners,whitePrisoners);
emit showTurn( currentPlayer == WHITE ? *whiteStone : *blackStone );
}
void GoWidget::resizeEvent( QResizeEvent * )
{
d = QMIN(width(),height())/19;
// int r = (d/2-1);
bx = (width() - 18*d)/2 ;
by = (height() - 18*d)/2 ;
if ( d < 10 && !smallStones ) {
blackStone->convertFromImage( blackStone->convertToImage().smoothScale(8,8) );
whiteStone->convertFromImage( whiteStone->convertToImage().smoothScale(8,8) );
newBlackStone->convertFromImage( newBlackStone->convertToImage().smoothScale(8,8) );
smallStones = TRUE;
} else if ( d >= 10 && smallStones ) {
blackStone = new QPixmap(Resource::loadPixmap( "Go-black" ));
whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" ));
newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" ));
smallStones = FALSE;
}
}
void GoWidget::init()
{
lastX = lastY = newX = newY = -1;
nPassed = 0;
for ( int i = 0; i < 19; i++ )
for ( int j = 0; j < 19; j++ )
board[i][j]=-1;
gameActive = TRUE;
goRestart(current_handicap);
if ( twoplayer ) {
currentPlayer = BLACK;
} else {
doComputerMove();
currentPlayer = WHITE;
}
emit showTurn( currentPlayer == WHITE ? *whiteStone : *blackStone );
}
void GoWidget::paintEvent( QPaintEvent *e )
{
int i,j;
int r = whiteStone->width()/2;
QPainter p(this);
p.fillRect( bx - d/2, by - d/2, 19*d, 19*d, *goBrush );
int xMin = QMAX( x2board(e->rect().left()), 0 );
int xMax = QMIN( x2board(e->rect().right()), 18 );
int yMin = QMAX( y2board(e->rect().top()), 0 );
int yMax = QMIN( y2board(e->rect().bottom()), 18 );
QColor pine( 255, 186, 89 );
p.setPen( pine.dark() );
for ( i = xMin; i < xMax+1 ; i ++ ) {
p.drawLine( bx+i*d, by, bx+i*d, by+18*d );
}
for ( j = yMin; j < yMax+1 ; j ++ ) {
p.drawLine( bx, by+j*d, bx+18*d, by+j*d);
diff --git a/noncore/games/minesweep/minesweep.cpp b/noncore/games/minesweep/minesweep.cpp
index c84fe53..814070b 100644
--- a/noncore/games/minesweep/minesweep.cpp
+++ b/noncore/games/minesweep/minesweep.cpp
@@ -57,349 +57,349 @@ static const char *pix_new[]={
" .################. ",
" .################. ",
" .################. ",
" .################. ",
" .################. ",
" .################. ",
" .##############. ",
" .##############. ",
" .############. ",
" .##########. ",
" ..######.. ",
" ...... ",
" "};
/* XPM */
static const char * happy_xpm[] = {
"20 20 3 1",
" c None",
". c #ffff3f ",
"# c #000000",
" ",
" ###### ",
" ##......## ",
" #..........# ",
" #............# ",
" #..............# ",
" #..............# ",
" #....##....##....# ",
" #....##....##....# ",
" #................# ",
" #................# ",
" #................# ",
" #...#........#...# ",
" #.##........##.# ",
" #...########...# ",
" #...######...# ",
" #..........# ",
" ##......## ",
" ###### ",
" "};
/* XPM */
static const char * worried_xpm[] = {
"20 20 3 1",
" c None",
". c #ffff3f",
"# c #000000",
" ",
" ###### ",
" ##......## ",
" #..........# ",
" #............# ",
" #..............# ",
" #..............# ",
" #....##....##....# ",
" #....##....##....# ",
" #................# ",
" #................# ",
" #................# ",
" #................# ",
" #....######....# ",
" #..............# ",
" #............# ",
" #..........# ",
" ##......## ",
" ###### ",
" "};
/* XPM */
static const char * dead_xpm[] = {
"20 20 3 1",
" c None",
". c #ffff3f",
"# c #000000",
" ",
" ###### ",
" ##......## ",
" #..........# ",
" #............# ",
" #..............# ",
" #..#.#...#.#...# ",
" #....#.....#.....# ",
" #...#.#...#.#....# ",
" #................# ",
" #................# ",
" #................# ",
" #......####......# ",
" #....# #....# ",
" #...#......#...# ",
" #............# ",
" #..........# ",
" ##......## ",
" ###### ",
" "};
class ResultIndicator : private QLabel
{
public:
static void showResult( QWidget *ref, bool won );
private:
ResultIndicator( QWidget *parent, const char *name, WFlags f)
:QLabel( parent, name, f ) {}
void timerEvent( QTimerEvent *);
void center();
bool twoStage;
int timerId;
};
void ResultIndicator::showResult( QWidget *ref, bool won )
{
ResultIndicator *r = new ResultIndicator( ref, 0, WStyle_Customize | WStyle_Tool | WType_TopLevel );
r->setAlignment( AlignCenter );
r->setFrameStyle( Sunken|StyledPanel );
if ( won ) {
r->setText( MineSweep::tr("You won!") );
r->center();
r->show();
r->twoStage = FALSE;
r->timerId = r->startTimer(1500);
} else {
QPalette p( red );
r->setPalette( p );
r->setText( MineSweep::tr("You exploded!") );
r->resize( ref->size() );
r->move( ref->mapToGlobal(QPoint(0,0)) );
r->show();
r->twoStage = TRUE;
r->timerId =r->startTimer(200);
}
}
void ResultIndicator::center()
{
QWidget *w = parentWidget();
QPoint pp = w->mapToGlobal( QPoint(0,0) );
QSize s = sizeHint()*3;
pp = QPoint( pp.x() + w->width()/2 - s.width()/2,
pp.y() + w->height()/ 2 - s.height()/2 );
setGeometry( QRect(pp, s) );
}
void ResultIndicator::timerEvent( QTimerEvent *te )
{
if ( te->timerId() != timerId )
return;
killTimer( timerId );
if ( twoStage ) {
center();
twoStage = FALSE;
timerId = startTimer( 1000 );
} else {
delete this;
}
}
class MineFrame : public QFrame
{
public:
MineFrame( QWidget *parent, const char *name = 0 )
:QFrame( parent, name ) {}
void setField( MineField *f ) { field = f; }
protected:
void resizeEvent( QResizeEvent *e ) {
field->setAvailableRect( contentsRect());
QFrame::resizeEvent(e);
}
private:
MineField *field;
};
MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
: QMainWindow( parent, name, f )
{
srand(::time(0));
setCaption( tr("Mine Hunt") );
setIcon( Resource::loadPixmap( "minesweep_icon" ) );
QPEToolBar *toolBar = new QPEToolBar( this );
toolBar->setHorizontalStretchable( TRUE );
- QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
+ QMenuBar *menuBar = new QMenuBar( toolBar );
QPopupMenu *gameMenu = new QPopupMenu( this );
gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) );
gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) );
gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) );
menuBar->insertItem( tr("Game"), gameMenu );
guessLCD = new QLCDNumber( toolBar );
toolBar->setStretchableWidget( guessLCD );
QPalette lcdPal( red );
lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() );
lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() );
// guessLCD->setPalette( lcdPal );
guessLCD->setSegmentStyle( QLCDNumber::Flat );
guessLCD->setFrameStyle( QFrame::NoFrame );
guessLCD->setNumDigits( 2 );
guessLCD->setBackgroundMode( PaletteButton );
newGameButton = new QPushButton( toolBar );
newGameButton->setPixmap( QPixmap( pix_new ) );
newGameButton->setFocusPolicy(QWidget::NoFocus);
connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) );
timeLCD = new QLCDNumber( toolBar );
// timeLCD->setPalette( lcdPal );
timeLCD->setSegmentStyle( QLCDNumber::Flat );
timeLCD->setFrameStyle( QFrame::NoFrame );
timeLCD->setNumDigits( 5 ); // "mm:ss"
timeLCD->setBackgroundMode( PaletteButton );
setToolBarsMovable ( FALSE );
addToolBar( toolBar );
MineFrame *mainframe = new MineFrame( this );
mainframe->setFrameShape( QFrame::Box );
mainframe->setFrameShadow( QFrame::Raised );
mainframe->setLineWidth(2);
field = new MineField( mainframe );
mainframe->setField( field );
QFont fnt = field->font();
fnt.setBold( TRUE );
field->setFont( QFont( fnt ) );
field->setFocus();
setCentralWidget( mainframe );
connect( field, SIGNAL( gameOver( bool ) ), this, SLOT( gameOver( bool ) ) );
connect( field, SIGNAL( mineCount( int ) ), this, SLOT( setCounter( int ) ) );
connect( field, SIGNAL( gameStarted()), this, SLOT( startPlaying() ) );
timer = new QTimer( this );
connect( timer, SIGNAL( timeout() ), this, SLOT( updateTime() ) );
readConfig();
}
MineSweep::~MineSweep()
{
writeConfig();
}
void MineSweep::gameOver( bool won )
{
field->showMines();
if ( won ) {
newGameButton->setPixmap( QPixmap( happy_xpm ) );
} else {
newGameButton->setPixmap( QPixmap( dead_xpm ) );
}
ResultIndicator::showResult( this, won );
timer->stop();
}
void MineSweep::newGame()
{
newGame(field->level());
}
void MineSweep::newGame(int level)
{
timeLCD->display( "0:00" );
field->setup( level );
newGameButton->setPixmap( QPixmap( pix_new ) );
timer->stop();
}
void MineSweep::startPlaying()
{
newGameButton->setPixmap( QPixmap( worried_xpm ) );
starttime = QDateTime::currentDateTime();
timer->start( 1000 );
}
void MineSweep::beginner()
{
newGame(1);
}
void MineSweep::advanced()
{
newGame(2);
}
void MineSweep::expert()
{
newGame(3);
}
void MineSweep::setCounter( int c )
{
if ( !guessLCD )
return;
guessLCD->display( c );
}
void MineSweep::updateTime()
{
if ( !timeLCD )
return;
int s = starttime.secsTo(QDateTime::currentDateTime());
if ( s/60 > 99 )
timeLCD->display( "-----" );
else
timeLCD->display( QString().sprintf("%2d:%02d",s/60,s%60) );
}
void MineSweep::writeConfig() const
{
Config cfg("MineSweep");
cfg.setGroup("Panel");
cfg.writeEntry("Time",
timer->isActive() ? starttime.secsTo(QDateTime::currentDateTime()) : -1);
field->writeConfig(cfg);
}
void MineSweep::readConfig()
{
Config cfg("MineSweep");
field->readConfig(cfg);
cfg.setGroup("Panel");
int s = cfg.readNumEntry("Time",-1);
if ( s<0 ) {
newGame();
} else {
startPlaying();
starttime = QDateTime::currentDateTime().addSecs(-s);
updateTime();
}
}
diff --git a/noncore/games/solitaire/canvascardgame.h b/noncore/games/solitaire/canvascardgame.h
index d159de6..b93cfbf 100644
--- a/noncore/games/solitaire/canvascardgame.h
+++ b/noncore/games/solitaire/canvascardgame.h
@@ -1,97 +1,97 @@
/**********************************************************************
** 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.
**
**********************************************************************/
#ifndef CANVAS_CARD_GAME_H
#define CANVAS_CARD_GAME_H
#include "cardgame.h"
#include "canvasshapes.h"
#include "canvascard.h"
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qmainwindow.h>
-#include <qpe/qpemenubar.h>
+#include <qmenubar.h>
#include <qpainter.h>
#include <stdlib.h>
#include <time.h>
class CanvasCardPile;
class CanvasCardGame : public QCanvasView, public CardGame
{
public:
CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, int numOfDecks = 1, const char *name = 0, WFlags f = 0) :
QCanvasView( &c, parent, name, f ),
CardGame(0,numOfDecks),
moved(FALSE),
moving(NULL),
alphaCardPile( NULL ),
cardXOff(0), cardYOff(0),
snapOn(snap),
numberToDraw(1) { }
virtual ~CanvasCardGame();
virtual Card *newCard( eValue v, eSuit s, bool f ) {
return new CanvasCard( v, s, f, canvas() );
}
virtual void readConfig( Config& cfg ) { Q_UNUSED( cfg ); }
virtual void writeConfig( Config& cfg ) { Q_UNUSED( cfg ); }
virtual void gameWon();
virtual bool haveWeWon() { return FALSE; }
virtual bool mousePressCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); return FALSE; }
virtual void mouseReleaseCard(Card *card, QPoint p) { Q_UNUSED(card); Q_UNUSED(p); }
void cancelMoving() { moving = NULL; }
void toggleSnap() { snapOn = (snapOn == TRUE) ? FALSE : TRUE; }
void toggleCardsDrawn() { numberToDraw = (numberToDraw == 1) ? 3 : 1; }
int cardsDrawn() { return numberToDraw; }
void setNumberToDraw(int numToDraw) { this->numberToDraw = numToDraw; }
void readPile( Config& cfg, CardPile *pile, QString name, int& highestZ );
protected:
void contentsMousePressEvent(QMouseEvent *e);
void contentsMouseReleaseEvent(QMouseEvent *e);
void contentsMouseMoveEvent(QMouseEvent *e);
virtual void checkUnusable() { } //added for freecell
protected:
// Mouse event state variables
bool moved;
CanvasCard *moving;
CanvasCardPile *alphaCardPile;
int cardXOff, cardYOff;
private:
bool snapOn;
int numberToDraw;
};
#endif
diff --git a/noncore/games/solitaire/canvascardwindow.cpp b/noncore/games/solitaire/canvascardwindow.cpp
index 317a02d..dec5591 100644
--- a/noncore/games/solitaire/canvascardwindow.cpp
+++ b/noncore/games/solitaire/canvascardwindow.cpp
@@ -1,252 +1,252 @@
/**********************************************************************
** 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 "canvascardwindow.h"
#include "patiencecardgame.h"
#include "freecellcardgame.h"
#include "chicanecardgame.h"
#include "harpcardgame.h"
#include "teeclubcardgame.h"
#include <qpe/resource.h>
#include <qmainwindow.h>
#include <qpopupmenu.h>
#include <qstyle.h>
CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) :
QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0),
cardGame(NULL)
{
setIcon( Resource::loadPixmap( "cards" ) );
// Create Playing Area for Games
if ( QPixmap::defaultDepth() < 12 ) {
// canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B));
// canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50));
canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D));
} else {
QPixmap bg;
bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither );
canvas.setBackgroundPixmap(bg);
}
#if defined( QT_QWS_CASSIOPEIA )
canvas.setAdvancePeriod(70);
#else
canvas.setAdvancePeriod(30);
#endif
#ifdef _PATIENCE_USE_ACCELS_
- QPEMenuBar* menu = menuBar();
+ QMenuBar* menu = menuBar();
QPopupMenu* file = new QPopupMenu;
file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F);
file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F);
file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F);
file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F);
file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F);
menu->insertItem(tr("&Game"), file);
menu->insertSeparator();
settings = new QPopupMenu;
settings->insertItem(tr("&Change card backs"), this, SLOT(changeCardBacks()), Key_F2);
snap_id = settings->insertItem(tr("&Snap to position"), this, SLOT(snapToggle()), Key_F3);
settings->setCheckable(TRUE);
menu->insertItem(tr("&Settings"),settings);
menu->insertSeparator();
QPopupMenu* help = new QPopupMenu;
help->insertItem(tr("&About"), this, SLOT(help()), Key_F1);
help->setItemChecked(dbf_id, TRUE);
menu->insertItem(tr("&Help"),help);
#else
QMenuBar* menu = menuBar();
QPopupMenu* file = new QPopupMenu;
file->insertItem(tr("Patience"), this, SLOT(initPatience()));
file->insertItem(tr("Freecell"), this, SLOT(initFreecell()));
file->insertItem(tr("Chicane"), this, SLOT(initChicane()));
file->insertItem(tr("Harp"), this, SLOT(initHarp()));
file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()));
menu->insertItem(tr("Play"), file);
menu->insertSeparator();
settings = new QPopupMenu;
settings->setCheckable(TRUE);
settings->insertItem(tr("Change card backs"), this, SLOT(changeCardBacks()));
snap_id = settings->insertItem(tr("Snap to position"), this, SLOT(snapToggle()));
QString m;
drawId = settings->insertItem(tr("Turn one card"), this, SLOT(drawnToggle()));
menu->insertItem(tr("Settings"),settings);
settings->setCheckable(TRUE);
#endif
menu->show();
Config cfg( "Patience" );
cfg.setGroup( "GlobalSettings" );
snapOn = cfg.readBoolEntry( "SnapOn", TRUE);
settings->setItemChecked(snap_id, snapOn);
gameType = cfg.readNumEntry( "GameType", -1 );
drawThree = cfg.readBoolEntry( "DrawThree", FALSE);
if ( gameType == 0 ) {
cardGame = new PatienceCardGame( &canvas, snapOn, this );
cardGame->setNumberToDraw(drawThree ? 3 : 1);
setCaption(tr("Patience"));
setCentralWidget(cardGame);
cardGame->readConfig( cfg );
setCardBacks();
} else if ( gameType == 1 ) {
cardGame = new FreecellCardGame( &canvas, snapOn, this );
setCaption(tr("Freecell"));
setCentralWidget(cardGame);
//cardGame->newGame(); // Until we know how to handle reading freecell config
cardGame->readConfig( cfg );
setCardBacks();
} else if ( gameType == 2 ) {
cardGame = new ChicaneCardGame( &canvas, snapOn, this );
cardGame->setNumberToDraw(1);
setCaption(tr("Chicane"));
setCentralWidget(cardGame);
cardGame->readConfig( cfg );
setCardBacks();
} else if ( gameType == 3 ) {
cardGame = new HarpCardGame( &canvas, snapOn, this );
cardGame->setNumberToDraw(1);
setCaption(tr("Harp"));
setCentralWidget(cardGame);
cardGame->readConfig( cfg );
setCardBacks();
} else if ( gameType == 4 ) {
cardGame = new TeeclubCardGame( &canvas, snapOn, this );
cardGame->setNumberToDraw(1);
setCaption(tr("Teeclub"));
setCentralWidget(cardGame);
cardGame->readConfig( cfg );
setCardBacks();
} else {
// Probably there isn't a config file or it is broken
// Start a new game
initPatience();
}
updateDraw();
}
CanvasCardWindow::~CanvasCardWindow()
{
if (cardGame) {
Config cfg("Patience");
cfg.setGroup( "GlobalSettings" );
cfg.writeEntry( "GameType", gameType );
cfg.writeEntry( "SnapOn", snapOn );
cfg.writeEntry( "DrawThree", drawThree);
cfg.write();
cardGame->writeConfig( cfg );
delete cardGame;
}
}
void CanvasCardWindow::resizeEvent(QResizeEvent *)
{
QSize s = centralWidget()->size();
int fw = style().defaultFrameWidth();
canvas.resize( s.width() - fw - 2, s.height() - fw - 2);
}
void CanvasCardWindow::initPatience()
{
// Create New Game
if ( cardGame )
delete cardGame;
cardGame = new PatienceCardGame( &canvas, snapOn, this );
cardGame->setNumberToDraw(drawThree ? 3 : 1);
gameType = 0;
setCaption(tr("Patience"));
setCentralWidget(cardGame);
cardGame->newGame();
setCardBacks();
updateDraw();
}
void CanvasCardWindow::initFreecell()
{
// Create New Game
if ( cardGame ) {
delete cardGame;
}
cardGame = new FreecellCardGame( &canvas, snapOn, this );
gameType = 1;
setCaption(tr("Freecell"));
setCentralWidget(cardGame);
cardGame->newGame();
setCardBacks();
}
void CanvasCardWindow::initChicane()
{
// Create New Game
if ( cardGame ) {
delete cardGame;
}
cardGame = new ChicaneCardGame( &canvas, snapOn, this );
cardGame->setNumberToDraw(1);
gameType = 2;
setCaption(tr("Chicane"));
setCentralWidget(cardGame);
cardGame->newGame();
setCardBacks();
}
void CanvasCardWindow::initHarp()
{
// Create New Game
if ( cardGame ) {
delete cardGame;
}
cardGame = new HarpCardGame( &canvas, snapOn, this );
cardGame->setNumberToDraw(1);
gameType = 3;
setCaption(tr("Harp"));
setCentralWidget(cardGame);
cardGame->newGame();
setCardBacks();
}
void CanvasCardWindow::initTeeclub()
{
// Create New Game
if ( cardGame ) {
diff --git a/noncore/graphics/drawpad/drawpad.cpp b/noncore/graphics/drawpad/drawpad.cpp
index ac08e15..feae237 100644
--- a/noncore/graphics/drawpad/drawpad.cpp
+++ b/noncore/graphics/drawpad/drawpad.cpp
@@ -1,260 +1,260 @@
/***************************************************************************
* *
* DrawPad - a drawing program for Opie Environment *
* *
* (C) 2002 by S. Prud'homme <prudhomme@laposte.net> *
* *
* 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 "drawpad.h"
#include "drawpadcanvas.h"
#include "ellipsetool.h"
#include "erasetool.h"
#include "exportdialog.h"
#include "filledellipsetool.h"
#include "filledrectangletool.h"
#include "filltool.h"
#include "importdialog.h"
#include "linetool.h"
#include "newpagedialog.h"
#include "page.h"
#include "pageinformationdialog.h"
#include "pointtool.h"
#include "rectangletool.h"
#include "texttool.h"
#include "thumbnailview.h"
#include <opie/colordialog.h>
#include <opie/colorpopupmenu.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qpe/global.h>
#include <qpe/qpemenubar.h>
#include <qpe/qpetoolbar.h>
#include <qpe/resource.h>
#include <qaction.h>
#include <qfile.h>
#include <qmessagebox.h>
#include <qpainter.h>
#include <qspinbox.h>
#include <qtoolbutton.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
DrawPad::DrawPad(QWidget* parent, const char* name, WFlags fl )
: QMainWindow(parent, name, WStyle_ContextHelp)
{
// init members
m_pDrawPadCanvas = new DrawPadCanvas(this, this);
connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView()));
setCentralWidget(m_pDrawPadCanvas);
// init menu
setToolBarsMovable(false);
QPEToolBar* menuToolBar = new QPEToolBar(this);
- QPEMenuBar* menuBar = new QPEMenuBar(menuToolBar);
+ QMenuBar* menuBar = new QMenuBar(menuToolBar);
QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar);
QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this);
connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll()));
deleteAllAction->addTo(toolsPopupMenu);
toolsPopupMenu->insertSeparator();
QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this);
connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage()));
importPageAction->addTo(toolsPopupMenu);
QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this);
connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage()));
exportPageAction->addTo(toolsPopupMenu);
toolsPopupMenu->insertSeparator();
QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this);
connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView()));
thumbnailViewAction->addTo(toolsPopupMenu);
QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this);
connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation()));
pageInformationAction->addTo(toolsPopupMenu);
toolsPopupMenu->insertSeparator();
m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this);
m_pAntiAliasingAction->setToggleAction(true);
m_pAntiAliasingAction->addTo(toolsPopupMenu);
menuBar->insertItem(tr("Tools"), toolsPopupMenu);
// init page toolbar
QPEToolBar* pageToolBar = new QPEToolBar(this);
QAction* newPageAction = new QAction(tr("New Page"), Resource::loadPixmap("new"), QString::null, 0, this);
connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage()));
newPageAction->addTo(pageToolBar);
newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) );
QAction* clearPageAction = new QAction(tr("Clear Page"), Resource::loadPixmap("drawpad/clear"), QString::null, 0, this);
connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage()));
clearPageAction->addTo(pageToolBar);
clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) );
QAction* deletePageAction = new QAction(tr("Delete Page"), Resource::loadPixmap("trash"), QString::null, 0, this);
connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage()));
deletePageAction->addTo(pageToolBar);
deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) );
QPEToolBar* emptyToolBar = new QPEToolBar(this);
emptyToolBar->setHorizontalStretchable(true);
// init navigation toolbar
QPEToolBar* navigationToolBar = new QPEToolBar(this);
m_pUndoAction = new QAction(tr("Undo"), Resource::loadIconSet("undo"), QString::null, 0, this);
connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo()));
m_pUndoAction->addTo(navigationToolBar);
m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) );
m_pRedoAction = new QAction(tr("Redo"), Resource::loadIconSet("redo"), QString::null, 0, this);
connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo()));
m_pRedoAction->addTo(navigationToolBar);
m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) );
m_pFirstPageAction = new QAction(tr("First Page"), Resource::loadIconSet("fastback"), QString::null, 0, this);
connect(m_pFirstPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goFirstPage()));
m_pFirstPageAction->addTo(navigationToolBar);
m_pFirstPageAction->setWhatsThis( tr( "Click here to view the first page." ) );
m_pPreviousPageAction = new QAction(tr("Previous Page"), Resource::loadIconSet("back"), QString::null, 0, this);
connect(m_pPreviousPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goPreviousPage()));
m_pPreviousPageAction->addTo(navigationToolBar);
m_pPreviousPageAction->setWhatsThis( tr( "Click here to view the previous page." ) );
m_pNextPageAction = new QAction(tr("Next Page"), Resource::loadIconSet("forward"), QString::null, 0, this);
connect(m_pNextPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goNextPage()));
m_pNextPageAction->addTo(navigationToolBar);
m_pNextPageAction->setWhatsThis( tr( "Click here to view the next page." ) );
m_pLastPageAction = new QAction(tr("Last Page"), Resource::loadIconSet("fastforward"), QString::null, 0, this);
connect(m_pLastPageAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(goLastPage()));
m_pLastPageAction->addTo(navigationToolBar);
m_pLastPageAction->setWhatsThis( tr( "Click here to view the last page." ) );
// init draw mode toolbar
QPEToolBar* drawModeToolBar = new QPEToolBar(this);
m_pLineToolButton = new QToolButton(drawModeToolBar);
m_pLineToolButton->setToggleButton(true);
QWhatsThis::add( m_pLineToolButton, tr( "Click here to select one of the available tools to draw lines." ) );
QPopupMenu* linePopupMenu = new QPopupMenu(m_pLineToolButton);
m_pPointToolAction = new QAction(tr("Draw Point"), Resource::loadPixmap("drawpad/point"), "", 0, this);
connect(m_pPointToolAction, SIGNAL(activated()), this, SLOT(setPointTool()));
m_pPointToolAction->addTo(linePopupMenu);
m_pLineToolAction = new QAction(tr("Draw Line"), Resource::loadPixmap("drawpad/line"), "", 0, this);
connect(m_pLineToolAction, SIGNAL(activated()), this, SLOT(setLineTool()));
m_pLineToolAction->addTo(linePopupMenu);
m_pLineToolButton->setPopup(linePopupMenu);
m_pLineToolButton->setPopupDelay(0);
m_pRectangleToolButton = new QToolButton(drawModeToolBar);
m_pRectangleToolButton->setToggleButton(true);
QWhatsThis::add( m_pRectangleToolButton, tr( "Click here to select one of the available tools to draw rectangles." ) );
QPopupMenu* rectanglePopupMenu = new QPopupMenu(m_pRectangleToolButton);
m_pRectangleToolAction = new QAction(tr("Draw Rectangle"), Resource::loadPixmap("drawpad/rectangle"), "", 0, this);
connect(m_pRectangleToolAction, SIGNAL(activated()), this, SLOT(setRectangleTool()));
m_pRectangleToolAction->addTo(rectanglePopupMenu);
m_pFilledRectangleToolAction = new QAction(tr("Draw Filled Rectangle"), Resource::loadPixmap("drawpad/filledrectangle"), "", 0, this);
connect(m_pFilledRectangleToolAction, SIGNAL(activated()), this, SLOT(setFilledRectangleTool()));
m_pFilledRectangleToolAction->addTo(rectanglePopupMenu);
m_pRectangleToolButton->setPopup(rectanglePopupMenu);
m_pRectangleToolButton->setPopupDelay(0);
m_pEllipseToolButton = new QToolButton(drawModeToolBar);
m_pEllipseToolButton->setToggleButton(true);
QWhatsThis::add( m_pEllipseToolButton, tr( "Click here to select one of the available tools to draw ellipses." ) );
QPopupMenu* ellipsePopupMenu = new QPopupMenu(m_pEllipseToolButton);
m_pEllipseToolAction = new QAction(tr("Draw Ellipse"), Resource::loadPixmap("drawpad/ellipse"), "", 0, this);
connect(m_pEllipseToolAction, SIGNAL(activated()), this, SLOT(setEllipseTool()));
m_pEllipseToolAction->addTo(ellipsePopupMenu);
m_pFilledEllipseToolAction = new QAction(tr("Draw Filled Ellipse"), Resource::loadPixmap("drawpad/filledellipse"), "", 0, this);
connect(m_pFilledEllipseToolAction, SIGNAL(activated()), this, SLOT(setFilledEllipseTool()));
m_pFilledEllipseToolAction->addTo(ellipsePopupMenu);
m_pEllipseToolButton->setPopup(ellipsePopupMenu);
m_pEllipseToolButton->setPopupDelay(0);
m_pTextToolAction = new QAction(tr("Insert Text"), Resource::loadPixmap("drawpad/text"), QString::null, 0, this);
m_pTextToolAction->setToggleAction(true);
connect(m_pTextToolAction, SIGNAL(activated()), this, SLOT(setTextTool()));
m_pTextToolAction->addTo(drawModeToolBar);
m_pTextToolAction->setWhatsThis( tr( "Click here to select the text drawing tool." ) );
m_pFillToolAction = new QAction(tr("Fill Region"), Resource::loadPixmap("drawpad/fill"), QString::null, 0, this);
m_pFillToolAction->setToggleAction(true);
connect(m_pFillToolAction, SIGNAL(activated()), this, SLOT(setFillTool()));
m_pFillToolAction->addTo(drawModeToolBar);
m_pFillToolAction->setWhatsThis( tr( "Click here to select the fill tool." ) );
m_pEraseToolAction = new QAction(tr("Erase Point"), Resource::loadPixmap("drawpad/erase"), QString::null, 0, this);
m_pEraseToolAction->setToggleAction(true);
connect(m_pEraseToolAction, SIGNAL(activated()), this, SLOT(setEraseTool()));
m_pEraseToolAction->addTo(drawModeToolBar);
m_pEraseToolAction->setWhatsThis( tr( "Click here to select the eraser tool." ) );
m_pTool = 0;
setRectangleTool();
setEllipseTool();
setPointTool();
emptyToolBar = new QPEToolBar(this);
emptyToolBar->setHorizontalStretchable(true);
emptyToolBar->addSeparator();
// init draw parameters toolbar
QPEToolBar* drawParametersToolBar = new QPEToolBar(this);
m_pPenWidthSpinBox = new QSpinBox(1, 9, 1, drawParametersToolBar);
connect(m_pPenWidthSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changePenWidth(int)));
QToolTip::add(m_pPenWidthSpinBox, tr("Pen Width"));
m_pPenWidthSpinBox->setValue(1);
m_pPenWidthSpinBox->setFocusPolicy(QWidget::NoFocus);
QWhatsThis::add( m_pPenWidthSpinBox, tr( "Click here to select the width of the drawing pen." ) );
m_pPenColorToolButton = new QToolButton(drawParametersToolBar);
m_pPenColorToolButton->setPixmap(Resource::loadPixmap("drawpad/pencolor"));
QWhatsThis::add( m_pPenColorToolButton, tr( "Click here to select the color used when drawing." ) );
OColorPopupMenu* penColorPopupMenu = new OColorPopupMenu(Qt::black, m_pPenColorToolButton);
connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, SLOT(changePenColor(const QColor&)));
diff --git a/noncore/multimedia/showimg/showimg.cpp b/noncore/multimedia/showimg/showimg.cpp
index 56bdecf..b7754f7 100644
--- a/noncore/multimedia/showimg/showimg.cpp
+++ b/noncore/multimedia/showimg/showimg.cpp
@@ -42,385 +42,385 @@
#include <qaction.h>
#include <qfiledialog.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qscrollview.h>
#include <qlabel.h>
#include <qpainter.h>
#include <qkeycode.h>
#include <qapplication.h>
#include <qclipboard.h>
#include <qtimer.h>
#include <qspinbox.h>
ControlsDialog::ControlsDialog(const QString &caption,QImage image,int *brightness,QWidget *parent)
: QDialog(parent,0,true)
{
setCaption(caption);
if ( parent ) {
setPalette(parent->palette());
}
b=brightness;
img=image;
setMinimumSize(140,80);
QGridLayout *gl= new QGridLayout(this,2,2,4,4);
pixmap =new ImageWidget(this);;
QPixmap pm;
pm.convertFromImage(img);
pixmap->setPixmap(pm);
pixmap->setMinimumSize(pm.width(),pm.height());
gl->addMultiCellWidget(pixmap,0,0,0,2,AlignCenter);
QLabel *l=new QLabel(tr("Brightness")+":",this);
gl->addWidget(l,1,0,AlignLeft);
spb=new QSpinBox(-100,100,2,this);
gl->addWidget(spb,1,1,AlignRight);
spb->setValue(0);
connect(spb,SIGNAL(valueChanged(int)),this, SLOT(bValueChanged(int)));
}
void ControlsDialog::bValueChanged(int value)
{
QImage nImage=img;
nImage.detach();
ImageViewer::intensity(nImage, (float)value/100);
QPixmap pm;
pm.convertFromImage(nImage);
pixmap->setPixmap(pm);
pixmap->repaint(false);
}
void ControlsDialog::accept()
{
*b=spb->value();
done(1);
}
//===========================================================================
InfoDialog::InfoDialog(const QString &caption, const QStringList text,QWidget *parent)
: QDialog(parent,0,true)
{
setCaption(caption);
if ( parent )
{
setPalette(parent->palette());
}
QString labels[]={ tr("File Name"),tr("Format"),tr("File Size"),tr("Size"),tr("Colors"),tr("Alpha") };
setMinimumSize(180,80);
int num=ImageViewer::LAST+1;
if ( text[ImageViewer::ALPHA].isEmpty() )
num--;
QGridLayout *gl= new QGridLayout(this,num,2,4,2);
QLabel *l;
int count=0;
for ( int i=0;i<num;i++ )
{
if ( i==1 )
{
QFrame *frm=new QFrame(this);
frm->setFrameStyle(QFrame::HLine|QFrame::Sunken);
gl->addMultiCellWidget(frm,i,i,0,1);
}
else
{
l=new QLabel( tr( labels[count] )+":",this);
gl->addWidget(l,i,0,AlignLeft);
l=new QLabel(text[count],this);
gl->addWidget(l,i,1,AlignRight);
count++;
}
}
}
void InfoDialog::displayInfo(const QString &caption, const QStringList text, QWidget *parent)
{
InfoDialog *dlg=new InfoDialog(caption,text,parent);
dlg->exec();
delete dlg;
}
//===========================================================================
ImagePane::ImagePane( QWidget *parent ) : QWidget( parent )
{
vb = new QVBoxLayout( this );
image = new QScrollView(this,0,WResizeNoErase|WNorthWestGravity);
pic=new ImageWidget(image);
image->addChild(pic);
connect(pic, SIGNAL( clicked() ), this, SLOT( imageClicked() ));
vb->addWidget( image );
}
void ImagePane::setPixmap( const QPixmap &pm )
{
pic->setPixmap( pm );
pic->resize(pm.width(),pm.height());
image->updateScrollBars ();
pic->repaint(false);
}
void ImagePane::imageClicked()
{
emit clicked();
}
//===========================================================================
/*
Draws the portion of the scaled pixmap that needs to be updated
*/
void ImageWidget::paintEvent( QPaintEvent *e )
{
QPainter painter(this);
painter.setClipRect(e->rect());
painter.fillRect(0,0,width(),height(),QColor(0,0,0));
if ( pixmap.size() != QSize( 0, 0 ) )
{ // is an image loaded?
painter.drawPixmap((width() - pixmap.width()) / 2, (height() - pixmap.height()) / 2, pixmap);
}
}
void ImageWidget::mouseReleaseEvent(QMouseEvent *)
{
emit clicked();
}
//===========================================================================
ImageViewer::ImageViewer( QWidget *parent, const char *name, int wFlags )
: QMainWindow( parent, name, WResizeNoErase ), filename( 0 ), bFromDocView( FALSE )
{
setCaption( tr("Image Viewer") );
setIcon( Resource::loadPixmap( "ImageViewer" ) );
Config cfg("Image Viewer");
cfg.setGroup("Image Viewer");
showThumbView=cfg.readBoolEntry("ShowThumbnails",false);
isSized=cfg.readBoolEntry("SizeToScreen",true);
isFullScreen = FALSE;
setToolBarsMovable( FALSE );
toolBar = new QPEToolBar( this );
toolBar->setHorizontalStretchable( TRUE );
- menuBar = new QPEMenuBar( toolBar );
+ menuBar = new QMenuBar( toolBar );
current=menuBar;
fileMenuFile = new QPopupMenu(this);
//menuBarmenubarFile->insertItem( tr("File"), fileMenu );
fileMenuFile->insertItem(tr("Open"),
this, SLOT(openFile()), 0);
viewMenuFile = new QPopupMenu( this );
//menubarFile->insertItem( tr("View"), viewMenu );
viewMenuFile->insertItem( tr("Thumbnail View"),
this, SLOT(switchThumbView()), 0, SHOW_THUMBNAILS );
viewMenuFile->setItemChecked ( SHOW_THUMBNAILS, showThumbView );
optionsMenuFile = new QPopupMenu( this);
//menubarFile->insertItem( tr("Options"),optionsMenu );
slideAction = new QAction( tr( "Slide show" ), Resource::loadIconSet( "slideshow" ),
QString::null, 0, this, 0 );
slideAction->setToggleAction( TRUE );
connect( slideAction, SIGNAL( toggled(bool) ), this, SLOT( slideShow(bool) ) );
slideAction->addTo( optionsMenuFile);
// slideAction->addTo( toolBar );
// optionsMenuFile->insertItem( tr("Slideshow") );
optionsMenuFile->insertSeparator();
optionsMenuFile->insertItem( tr("Preferences.."), this, SLOT(settings()), 0);
// optionsMenuFile->insertItem( tr("Help"), this, SLOT(help()), 0);
QStrList fmt = QImage::outputFormats();
fileMenuView = new QPopupMenu( this );
//menubarView->insertItem( tr("File"),fileMenu );
fileMenuView->insertItem( tr("Image Info ..."),this, SLOT(displayInfoDialog()),0 );
fileMenuView->insertSeparator();
viewMenuView = new QPopupMenu(this );
viewMenuView->setCheckable ( true );
//menubarView->insertItem( tr("View"),viewMenu );
viewMenuView->insertItem(tr("Horizontal flip"), this, SLOT(hFlip()), 0);
viewMenuView->insertItem(tr("Vertical flip"), this, SLOT(vFlip()), 0);
stack = new QWidgetStack( this );
stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
setCentralWidget( stack );
imagePanel = new ImagePane( stack );
connect(imagePanel, SIGNAL(clicked()), this, SLOT(normalView()));
ImageFileSelector::CURRENT_VIEW cv;
if(showThumbView)
cv=ImageFileSelector::THUMBNAIL;
else
cv=ImageFileSelector::DETAILED;
qDebug("cv = %d",cv);
fileSelector = new ImageFileSelector( cv,stack, "fs");
//switchThumbView();
//fileSelector = new ImageFileSelector("image/*", stack, "fs");
//fileSelector->setNewVisible(FALSE);
//fileSelector->setCloseVisible(FALSE);
connect( fileSelector, SIGNAL( closeMe() ), this, SLOT( closeFileSelector() ) );
connect( fileSelector, SIGNAL( fileSelected( const DocLnk &) ),
this, SLOT( openFile( const DocLnk & ) ) );
imageList = fileSelector->fileList();
slideAction->setEnabled( imageList.count() != 0);
iconToolBar = new QPEToolBar(this);
QAction *a;
a = new QAction( tr( "Open ..." ), Resource::loadPixmap( "fileopen" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( open() ) );
a->addTo( fileMenuView);
a->addTo( iconToolBar );
a = new QAction( tr( "Rotate 90"), Resource::loadPixmap( "rotate90" ), QString::null, 0, this, 0);
connect( a, SIGNAL( activated() ), this, SLOT( rot90() ) );
a->addTo( iconToolBar );
a->addTo( viewMenuView );
a = new QAction( tr( "Rotate 180" ), Resource::loadPixmap( "repeat" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( rot180() ) );
a->addTo( iconToolBar );
a->addTo( viewMenuView );
a = new QAction( tr( "Rotate 270"), Resource::loadPixmap( "rotate270" ), QString::null, 0, this, 0);
connect( a, SIGNAL( activated() ), this, SLOT( rot270() ) );
//a->addTo( iconToolBar );
a->addTo( viewMenuView );
viewMenuView->insertSeparator();
viewMenuView->insertItem(tr("Brightness ..."), this, SLOT(displayControlsDialog()), 0);
viewMenuView->insertItem(tr("Black And White"), this, SLOT(blackAndWhite()), 0,BLACKANDWHITE);
viewMenuView->insertSeparator();
sss = new QAction( tr( "Scale to Screen"), Resource::loadPixmap( "scale" ), QString::null, 0, this, 0,true);
connect( sss, SIGNAL( activated() ), this, SLOT( switchSizeToScreen() ) );
sss->addTo( iconToolBar );
sss->addTo( viewMenuView );
sss->setOn(isSized);
viewMenuView->insertSeparator();
a = new QAction( tr( "Fullscreen" ), Resource::loadPixmap( "fullscreen" ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( fullScreen() ) );
a->addTo( iconToolBar );
a->addTo( viewMenuView);
a = new QAction( tr( "Stop Slideshow" ), Resource::loadPixmap( "quit_icon" ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( stopSlideShow() ) );
a->addTo( iconToolBar );
a->addTo( viewMenuView);
Config config( "ImageViewer" );
config.setGroup( "SlideShow" );
slideDelay = config.readNumEntry( "Delay", 2);
slideRepeat = config.readBoolEntry( "Repeat", FALSE );
slideReverse = config.readBoolEntry("Reverse", FALSE);
config.setGroup("Default");
rotateOnLoad = config.readBoolEntry("Rotate", FALSE);
fastLoad = config.readBoolEntry("FastLoad", TRUE);
slideTimer = new QTimer( this );
connect( slideTimer, SIGNAL(timeout()), this, SLOT(slideUpdate()) );
switchToFileSelector();
setMouseTracking( TRUE );
}
ImageViewer::~ImageViewer()
{
Config cfg("Image Viewer");
cfg.setGroup("Image Viewer");
cfg.writeEntry("ShowThumbnails",(int)showThumbView);
cfg.writeEntry("SizeToScreen",(int)isSized);
cfg.setGroup( "SlideShow" );
cfg.writeEntry( "Delay", slideDelay);
cfg.writeEntry( "Repeat", slideRepeat );
cfg.writeEntry("Reverse", slideReverse);
cfg.setGroup("Default");
cfg.writeEntry("Rotate", rotateOnLoad);
cfg.writeEntry("FastLoad", fastLoad);
delete imagePanel; // in case it is fullscreen
}
void ImageViewer::help() {
}
void ImageViewer::settings()
{
SettingsDialog dlg( this, 0, TRUE );
dlg.setDelay( slideDelay );
dlg.setRepeat( slideRepeat );
dlg.setReverse( slideReverse );
dlg.setRotate(rotateOnLoad);
dlg.setFastLoad(fastLoad);
if ( QPEApplication::execDialog(&dlg) == QDialog::Accepted ) {
diff --git a/noncore/multimedia/showimg/showimg.h b/noncore/multimedia/showimg/showimg.h
index abbd976..da4c0b6 100644
--- a/noncore/multimedia/showimg/showimg.h
+++ b/noncore/multimedia/showimg/showimg.h
@@ -1,289 +1,289 @@
/**********************************************************************
** 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.
**
**********************************************************************/
#ifndef SHOWIMG_H
#define SHOWIMG_H
#include <qwidget.h>
#include <qmainwindow.h>
#include <qimage.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qscrollview.h>
#include <qdialog.h>
#include <qstringlist.h>
#include <qvaluelist.h>
#include <qwmatrix.h>
class QAction;
class QPEToolBar;
-class QPEMenuBar;
+class QMenuBar;
class QPopupMenu;
class QWidgetStack;
class FileSelector;
class DocLnk;
class QLabel;
class QAction;
class QSpinBox;
class ImageFileSelector;
class QTimer;
class ImageWidget : public QWidget
{
Q_OBJECT
public:
ImageWidget( QWidget *parent=0 )
: QWidget( parent ) {
setBackgroundMode(NoBackground);
}
~ImageWidget() { }
void setPixmap( const QPixmap &pm ) {
pixmap = pm;
show();
}
signals:
void clicked();
protected:
void paintEvent( QPaintEvent * );
void mouseReleaseEvent(QMouseEvent* event);
private:
QPixmap pixmap;
};
class InfoDialog:public QDialog
{
Q_OBJECT
public:
static void displayInfo(const QString &caption, const QStringList text, QWidget *parent);
private:
InfoDialog(const QString &caption,const QStringList text, QWidget *parent);
};
class ControlsDialog:public QDialog
{
Q_OBJECT
public:
ControlsDialog(const QString &caption,const QImage image,int *brightness, QWidget *parent);
private slots:
void bValueChanged(int);
void accept();
private:
ImageWidget *pixmap;
QSpinBox *spb;
QImage img;
int *b;
};
class ImagePane : public QWidget
{
Q_OBJECT
public:
ImagePane( QWidget *parent=0 );
~ImagePane() { }
//void showStatus();
//void hideStatus();
//QLabel *statusLabel()
//{
// return status;
//}
void setPixmap( const QPixmap &pm );
int paneWidth() const {
return image->visibleWidth();
}
int paneHeight() const {
return image->visibleHeight();
}
void setPosition(int x, int y) {
image->setContentsPos (x,y );
}
void disable() {
pic->hide();
}
signals:
void clicked();
private:
QScrollView *image;
ImageWidget *pic;
QVBoxLayout *vb;
private slots:
void imageClicked();
};
class ImageViewer : public QMainWindow
{
Q_OBJECT
public:
static QString appName() { return QString::fromLatin1("showimg"); }
ImageViewer( QWidget *parent=0, const char *name=0, int wFlags=0 );
~ImageViewer();
void loadImage( const char *fileName );
void show(const QString& fileref);
void show();
enum INFO_STRINGS {
PATH,
FORMAT,
FILE_SIZE,
SIZE,
COLORS,
ALPHA,
LAST
};
enum RotateDirection {
Rotate90, Rotate180, Rotate270
};
static QImage rotate(QImage &img, RotateDirection r);
static QImage& intensity(QImage &image, float percent);
static QImage& toGray(QImage &image, bool fast = false);
bool showThumbView; // a flag to indicate if FileSelector should be initialized with thumbnail view
protected:
void resizeEvent( QResizeEvent * );
void closeEvent( QCloseEvent * );
private:
int imageIndex(void);
void updateCaption( QString name );
bool loadSelected();
void scale();
bool reconvertImage();
int calcHeight();
void setImage(const QImage& newimage);
void updateImageInfo(QString &filePath);
void switchToFileSelector();
void switchToImageView();
void updateImage();
private slots:
void slideShow( bool on );
void help();
void slideUpdate();
bool nextImage();
bool prevImage();
void settings();
void switchThumbView();
void switchSizeToScreen();
void setDocument(const QString& fileref);
void doDelayedLoad();
void openFile( const DocLnk &file );
void openFile();
void open();
void closeFileSelector();
void hFlip();
void vFlip();
void rot180();
void rot90();
void rot270();
void normalView();
void fullScreen();
void stopSlideShow();
void blackAndWhite();
void displayInfoDialog();
void displayControlsDialog();
private:
QWMatrix matrix;
bool rotated90;
enum MENU_ITEMS {
SHOW_THUMBNAILS,
SIZE_TO_SCREEN,
BLACKANDWHITE
};
QString filename;
QString delayLoad;
QImage image; // the loaded image
QPixmap pm; // the converted pixmap
QPixmap pmScaled; // the scaled pixmap
QPEToolBar *toolBar;
QPEToolBar *iconToolBar;
- QPEMenuBar *menuBar;
- QPEMenuBar *current;
+ QMenuBar *menuBar;
+ QMenuBar *current;
QPopupMenu *fileMenuFile;
QPopupMenu *viewMenuFile;
QPopupMenu *optionsMenuFile;
QPopupMenu *fileMenuView;
QPopupMenu *viewMenuView;
QAction *sss; // scale to screen size
QLabel *lab;
ImagePane *imagePanel;
QWidgetStack *stack;
//FileSelector *fileSelector;
ImageFileSelector *fileSelector;
bool isFullScreen;
bool isSized; // true if image is to be resized to fit the window size
bool bFromDocView; // a flag to indicate whether or not we were
// launched from the document view...
int slideDelay;
bool slideRepeat;
bool slideReverse; // show slideshow in reverse order
bool rotateOnLoad; // rotate by 90 degrees on loading
bool fastLoad;
QTimer *slideTimer;
QValueList<DocLnk> imageList;
QAction *slideAction;
QString imageInfo[LAST];
};
#endif // SHOWIMG_H
diff --git a/noncore/net/opieftp/opieftp.cpp b/noncore/net/opieftp/opieftp.cpp
index ee7d32f..48629bf 100644
--- a/noncore/net/opieftp/opieftp.cpp
+++ b/noncore/net/opieftp/opieftp.cpp
@@ -1,263 +1,263 @@
/***************************************************************************
opieftp.cpp
-------------------
** Created: Sat Mar 9 23:33:09 2002
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
//#define DEVELOPERS_VERSION
#include "opieftp.h"
extern "C" {
#include "../ftplib/ftplib.h"
}
#include "inputDialog.h"
#include <qpe/qpemenubar.h>
#include <qpe/qpeapplication.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/mimetype.h>
#include <qtextstream.h>
#include <qpushbutton.h>
#include <qtoolbutton.h>
#include <qcombobox.h>
#include <qlistview.h>
#include <qlabel.h>
#include <qprogressbar.h>
#include <qspinbox.h>
#include <qtabwidget.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qlineedit.h>
#include <qlistbox.h>
#include <unistd.h>
#include <stdlib.h>
QProgressBar *ProgressBar;
static netbuf *conn=NULL;
static int log_progress(netbuf *, int xfered, void *)
{
// int fsz = *(int *)arg;
// int pct = (xfered * 100) / fsz;
// printf("%3d%%\r", pct);
// fflush(stdout);
ProgressBar->setProgress(xfered);
qApp->processEvents();
return 1;
}
OpieFtp::OpieFtp( QWidget* parent, const char* name, WFlags fl)
: QMainWindow( parent, name, fl )
{
setCaption( tr( "OpieFtp" ) );
fuckeduphack=FALSE;
QGridLayout *layout = new QGridLayout( this );
layout->setSpacing( 2);
layout->setMargin( 2);
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
- QPEMenuBar *menuBar = new QPEMenuBar(this);
+ QMenuBar *menuBar = new QMenuBar(this);
// QPEToolBar *menuBar = new QPEToolBar(this);
// menuBar->setHorizontalStretchable( TRUE );
QWMatrix matrix;
QPixmap pix(Resource::loadPixmap( "UnknownDocument" ));
matrix.scale( .4, .4);
unknownXpm = pix.xForm(matrix);
connectionMenu = new QPopupMenu( this );
localMenu = new QPopupMenu( this );
remoteMenu = new QPopupMenu( this );
tabMenu = new QPopupMenu( this );
layout->addMultiCellWidget( menuBar, 0, 0, 0, 2 );
menuBar->insertItem( tr( "Connection" ), connectionMenu);
// menuBar->insertItem( tr( "Local" ), localMenu);
// menuBar->insertItem( tr( "Remote" ), remoteMenu);
menuBar->insertItem( tr( "View" ), tabMenu);
tabMenu->insertItem( tr( "Local" ), localMenu);
tabMenu->insertItem( tr( "Remote" ), remoteMenu);
connectionMenu->insertItem( tr( "New" ), this, SLOT( newConnection() ));
connectionMenu->insertItem( tr( "Connect" ), this, SLOT( connector() ));
connectionMenu->insertItem( tr( "Disconnect" ), this, SLOT( disConnector() ));
localMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showHidden() ));
localMenu->insertSeparator();
localMenu->insertItem( tr( "Upload" ), this, SLOT( localUpload() ));
localMenu->insertItem( tr( "Make Directory" ), this, SLOT( localMakDir() ));
localMenu->insertItem( tr( "Rename" ), this, SLOT( localRename() ));
localMenu->insertSeparator();
localMenu->insertItem( tr( "Delete" ), this, SLOT( localDelete() ));
localMenu->setCheckable(TRUE);
remoteMenu->insertItem( tr( "Download" ), this, SLOT( remoteDownload() ));
remoteMenu->insertItem( tr( "Make Directory" ), this, SLOT( remoteMakDir() ));
remoteMenu->insertItem( tr( "Rename" ), this, SLOT( remoteRename() ));
remoteMenu->insertSeparator();
remoteMenu->insertItem( tr( "Delete" ), this, SLOT( remoteDelete() ));
tabMenu->insertSeparator();
tabMenu->insertItem( tr( "Switch to Local" ), this, SLOT( switchToLocalTab() ));
tabMenu->insertItem( tr( "Switch to Remote" ), this, SLOT( switchToRemoteTab() ));
tabMenu->insertItem( tr( "Switch to Config" ), this, SLOT( switchToConfigTab() ));
tabMenu->insertSeparator();
// tabMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
tabMenu->setCheckable(TRUE);
cdUpButton = new QToolButton( this,"cdUpButton");
cdUpButton->setPixmap(Resource::loadPixmap("up"));
cdUpButton ->setFixedSize( QSize( 20, 20 ) );
connect( cdUpButton ,SIGNAL(released()),this,SLOT( upDir()) );
layout->addMultiCellWidget( cdUpButton, 0, 0, 3, 3 );
cdUpButton->hide();
// docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"",this,"docsButton");
// docButton->setFixedSize( QSize( 20, 20 ) );
// connect( docButton,SIGNAL(released()),this,SLOT( docButtonPushed()) );
// docButton->setFlat(TRUE);
// layout->addMultiCellWidget( docButton, 0, 0, 6, 6 );
homeButton = new QToolButton(this,"homeButton");
homeButton->setPixmap( Resource::loadPixmap("home"));
homeButton->setFixedSize( QSize( 20, 20 ) );
connect(homeButton,SIGNAL(released()),this,SLOT(homeButtonPushed()) );
layout->addMultiCellWidget( homeButton, 0, 0, 4, 4);
homeButton->hide();
TabWidget = new QTabWidget( this, "TabWidget" );
layout->addMultiCellWidget( TabWidget, 1, 1, 0, 4 );
// TabWidget->setTabShape(QTabWidget::Triangular);
tab = new QWidget( TabWidget, "tab" );
tabLayout = new QGridLayout( tab );
tabLayout->setSpacing( 2);
tabLayout->setMargin( 2);
Local_View = new QListView( tab, "Local_View" );
// Local_View->setResizePolicy( QListView::AutoOneFit );
Local_View->addColumn( tr("File"),150);
Local_View->addColumn( tr("Date"),-1);
Local_View->setColumnAlignment(1,QListView::AlignRight);
Local_View->addColumn( tr("Size"),-1);
Local_View->setColumnAlignment(2,QListView::AlignRight);
Local_View->setAllColumnsShowFocus(TRUE);
Local_View->setMultiSelection( TRUE);
Local_View->setSelectionMode(QListView::Extended);
Local_View->setFocusPolicy(QWidget::ClickFocus);
QPEApplication::setStylusOperation( Local_View->viewport(),QPEApplication::RightOnHold);
tabLayout->addWidget( Local_View, 0, 0 );
connect( Local_View, SIGNAL( clicked( QListViewItem*)),
this,SLOT( localListClicked(QListViewItem *)) );
// connect( Local_View, SIGNAL( doubleClicked( QListViewItem*)),
// this,SLOT( localListClicked(QListViewItem *)) );
connect( Local_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
TabWidget->insertTab( tab, tr( "Local" ) );
tab_2 = new QWidget( TabWidget, "tab_2" );
tabLayout_2 = new QGridLayout( tab_2 );
tabLayout_2->setSpacing( 2);
tabLayout_2->setMargin( 2);
Remote_View = new QListView( tab_2, "Remote_View" );
Remote_View->addColumn( tr("File"),150);
Remote_View->addColumn( tr("Date"),-1);
// Remote_View->setColumnAlignment(1,QListView::AlignRight);
Remote_View->addColumn( tr("Size"),-1);
Remote_View->setColumnAlignment(2,QListView::AlignRight);
Remote_View->setColumnAlignment(3,QListView::AlignCenter);
Remote_View->addColumn( tr("Dir"),-1);
Remote_View->setColumnAlignment(4,QListView::AlignRight);
Remote_View->setAllColumnsShowFocus(TRUE);
Remote_View->setMultiSelection( FALSE);
Remote_View->setSelectionMode(QListView::Extended);
Remote_View->setFocusPolicy(QWidget::ClickFocus);
QPEApplication::setStylusOperation( Remote_View->viewport(),QPEApplication::RightOnHold);
connect( Remote_View, SIGNAL( clicked( QListViewItem*)),
this,SLOT( remoteListClicked(QListViewItem *)) );
connect( Remote_View, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( RemoteListPressed(int, QListViewItem *, const QPoint&, int)) );
tabLayout_2->addWidget( Remote_View, 0, 0 );
TabWidget->insertTab( tab_2, tr( "Remote" ) );
tab_3 = new QWidget( TabWidget, "tab_3" );
tabLayout_3 = new QGridLayout( tab_3 );
tabLayout_3->setSpacing( 2);
tabLayout_3->setMargin( 2);
TextLabel1 = new QLabel( tab_3, "TextLabel1" );
TextLabel1->setText( tr( "Username" ) );
tabLayout_3->addMultiCellWidget( TextLabel1, 0, 0, 0, 1 );
UsernameComboBox = new QComboBox( FALSE, tab_3, "UsernameComboBox" );
UsernameComboBox->setEditable(TRUE);
tabLayout_3->addMultiCellWidget( UsernameComboBox, 1, 1, 0, 1 );
connect( UsernameComboBox,SIGNAL(textChanged(const QString &)),this,
SLOT( UsernameComboBoxEdited(const QString & ) ));
TextLabel2 = new QLabel( tab_3, "TextLabel2" );
TextLabel2->setText( tr( "Password" ) );
tabLayout_3->addMultiCellWidget( TextLabel2, 0, 0, 2, 3 );
PasswordEdit = new QLineEdit( "", tab_3, "PasswordComboBox" );
PasswordEdit->setEchoMode(QLineEdit::Password);
tabLayout_3->addMultiCellWidget( PasswordEdit, 1, 1, 2, 3 );
connect( PasswordEdit,SIGNAL(textChanged(const QString &)),this,
SLOT( PasswordEditEdited(const QString & ) ));
//PasswordEdit->setFixedWidth(85);
TextLabel3 = new QLabel( tab_3, "TextLabel3" );
TextLabel3->setText( tr( "Remote server" ) );
tabLayout_3->addMultiCellWidget( TextLabel3, 2, 2, 0, 1 );
ServerComboBox = new QComboBox( FALSE, tab_3, "ServerComboBox" );
ServerComboBox->setEditable(TRUE);
tabLayout_3->addMultiCellWidget( ServerComboBox, 3, 3, 0, 1 );
connect(ServerComboBox,SIGNAL(activated(int)),this,SLOT(serverComboSelected(int ) ));
connect(ServerComboBox,SIGNAL(textChanged(const QString &)),this,
SLOT(serverComboEdited(const QString & ) ));
QLabel *TextLabel5 = new QLabel( tab_3, "TextLabel5" );
TextLabel5->setText( tr( "Remote path" ) );
tabLayout_3->addMultiCellWidget( TextLabel5, 2, 2, 2, 3 );
remotePath = new QLineEdit( "/", tab_3, "remotePath" );
tabLayout_3->addMultiCellWidget( remotePath, 3, 3, 2, 3 );
TextLabel4 = new QLabel( tab_3, "TextLabel4" );
TextLabel4->setText( tr( "Port" ) );
tabLayout_3->addMultiCellWidget( TextLabel4, 4, 4, 0, 1 );
PortSpinBox = new QSpinBox( tab_3, "PortSpinBox" );
PortSpinBox->setButtonSymbols( QSpinBox::UpDownArrows );
diff --git a/noncore/net/opieftp/opieftp.h b/noncore/net/opieftp/opieftp.h
index 7bd615a..f58778a 100644
--- a/noncore/net/opieftp/opieftp.h
+++ b/noncore/net/opieftp/opieftp.h
@@ -1,143 +1,143 @@
/***************************************************************************
opieftp.h
-------------------
** Created: Sat Mar 9 23:33:09 2002
copyright : (C) 2002 by ljp
email : ljp@llornkcor.com
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef OPIEFTP_H
#define OPIEFTP_H
#include <qvariant.h>
#include <qdialog.h>
#include <qmainwindow.h>
#include <qdir.h>
#include <qstring.h>
#include <qpoint.h>
#include <qpixmap.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QComboBox;
class QListView;
class QListViewItem;
class QLabel;
class QProgressBar;
class QSpinBox;
class QTabWidget;
class QWidget;
class QPEToolBar;
-class QPEMenuBar;
+class QMenuBar;
class QPopupMenu;
class QFile;
class QLineEdit;
class QPushButton;
class QToolButton;
class QStringList;
class QListBox;
class QTimer;
class OpieFtp : public QMainWindow
{
Q_OBJECT
public:
OpieFtp( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~OpieFtp();
static QString appName() { return QString::fromLatin1("opieftp"); }
QTabWidget *TabWidget;
QWidget *tab, *tab_2, *tab_3;
QListView *Local_View, *Remote_View;
QListBox *serverListView;
QComboBox *UsernameComboBox, *ServerComboBox, *currentPathCombo;
QLineEdit *PasswordEdit, *remotePath;
QLabel *TextLabel2, *TextLabel1, *TextLabel3, *TextLabel4;;
QSpinBox* PortSpinBox;
QPopupMenu *connectionMenu, *localMenu, *remoteMenu, *tabMenu, *aboutMenu;
QDir currentDir;
QString currentRemoteDir;
QString filterStr;
QListViewItem * item;
QPushButton *connectServerBtn, *newServerButton;//
QToolButton *cdUpButton, *homeButton, *docButton;
bool b;
int currentServerConfig;
protected slots:
void timerOut();
void upDir();
void homeButtonPushed();
void docButtonPushed();
void doAbout();
void serverComboEdited(const QString & );
void UsernameComboBoxEdited(const QString & );
void PasswordEditEdited(const QString & );
void showLocalMenu( QListViewItem *);
void showRemoteMenu( QListViewItem *);
void doLocalCd();
void doRemoteCd();
void localUpload();
void remoteDownload();
void newConnection();
void connector();
void disConnector();
void populateLocalView();
bool populateRemoteView();
void showHidden();
void writeConfig();
void readConfig();
void localListClicked(QListViewItem *);
void remoteListClicked(QListViewItem *);
void ListPressed( int, QListViewItem *, const QPoint&, int);
void RemoteListPressed( int, QListViewItem *, const QPoint&, int);
void localMakDir();
void localDelete();
void remoteMakDir();
void remoteDelete();
bool remoteDirList(const QString &);
bool remoteChDir(const QString &);
void tabChanged(QWidget*);
void cleanUp();
void remoteRename();
void localRename();
void currentPathComboChanged();
void currentPathComboActivated(const QString &);
void switchToLocalTab();
void switchToRemoteTab();
void switchToConfigTab();
void fillCombos();
void clearCombos();
void fillRemoteCombo(const QString&);
void fillCombo(const QString &);
void serverComboSelected(int);
void deleteServer();
void connectorBtnToggled(bool);
void NewServer();
void serverListClicked( const QString &);
protected:
QPixmap unknownXpm;
bool fuckeduphack;
QStringList remoteDirPathStringList, localDirPathStringList;
QString newServerName;
void nullifyCallBack();
QGridLayout* tabLayout;
QGridLayout* tabLayout_2;
QGridLayout* tabLayout_3;
};
#endif // OPIEFTP_H
diff --git a/noncore/net/opieirc/mainwindow.cpp b/noncore/net/opieirc/mainwindow.cpp
index 8f76cdd..95fbdcd 100644
--- a/noncore/net/opieirc/mainwindow.cpp
+++ b/noncore/net/opieirc/mainwindow.cpp
@@ -1,93 +1,93 @@
#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpopupmenu.h>
#include <qwhatsthis.h>
#include "mainwindow.h"
#include "ircservertab.h"
#include "ircserverlist.h"
#include "ircsettings.h"
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
setCaption(tr("IRC Client"));
m_tabWidget = new IRCTabWidget(this);
QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here"));
connect(m_tabWidget, SIGNAL(currentChanged(QWidget *)), this, SLOT(selected(QWidget *)));
setCentralWidget(m_tabWidget);
setToolBarsMovable(FALSE);
- QPEMenuBar *menuBar = new QPEMenuBar(this);
+ QMenuBar *menuBar = new QMenuBar(this);
QPopupMenu *irc = new QPopupMenu(this);
menuBar->insertItem(tr("IRC"), irc);
QAction *a = new QAction(tr("New connection"), Resource::loadPixmap("pass"), QString::null, 0, this, 0);
connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
a->setWhatsThis(tr("Create a new connection to an IRC server"));
a->addTo(irc);
a = new QAction(tr("Settings"), Resource::loadPixmap("SettingsIcon"), QString::null, 0, this, 0);
a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
connect(a, SIGNAL(activated()), this, SLOT(settings()));
a->addTo(irc);
loadSettings();
}
/*IRCTabWidget MainWindow::getTabWidget(){
return m_tabWidget;
} */
void MainWindow::loadSettings() {
Config config("OpieIRC");
config.setGroup("OpieIRC");
IRCTab::m_backgroundColor = config.readEntry("BackgroundColor", "#FFFFFF");
IRCTab::m_textColor = config.readEntry("TextColor", "#000000");
IRCTab::m_errorColor = config.readEntry("ErrorColor", "#FF0000");
IRCTab::m_selfColor = config.readEntry("SelfColor", "#CC0000");
IRCTab::m_otherColor = config.readEntry("OtherColor", "#0000BB");
IRCTab::m_serverColor = config.readEntry("ServerColor", "#0000FF");
IRCTab::m_notificationColor = config.readEntry("NotificationColor", "#AA3300");
IRCTab::m_maxLines = config.readNumEntry("Lines", 100);
}
void MainWindow::selected(QWidget *) {
m_tabWidget->setTabColor(m_tabWidget->currentPageIndex(), black);
emit updateScroll();
}
void MainWindow::addTab(IRCTab *tab) {
connect(tab, SIGNAL(changed(IRCTab *)), this, SLOT(changeEvent(IRCTab *)));
m_tabWidget->addTab(tab, tab->title());
m_tabWidget->showPage(tab);
tab->setID(m_tabWidget->currentPageIndex());
m_tabs.append(tab);
}
void MainWindow::changeEvent(IRCTab *tab) {
if (tab->id() != m_tabWidget->currentPageIndex())
m_tabWidget->setTabColor(tab->id(), blue);
}
void MainWindow::killTab(IRCTab *tab) {
m_tabWidget->removePage(tab);
m_tabs.remove(tab);
/* there might be nicer ways to do this .. */
delete tab;
}
void MainWindow::newConnection() {
IRCServerList list(this, "ServerList", TRUE);
if (list.exec() == QDialog::Accepted && list.hasServer()) {
IRCServerTab *serverTab = new IRCServerTab(list.server(), this, m_tabWidget);
addTab(serverTab);
serverTab->doConnect();
}
}
void MainWindow::settings() {
IRCSettings settings(this, "Settings", TRUE);
if (settings.exec() == QDialog::Accepted) {
QListIterator<IRCTab> it(m_tabs);
for (; it.current(); ++it) {
/* Inform all tabs about the new settings */
it.current()->settingsChanged();
}
}
}
diff --git a/noncore/net/wellenreiter/TODO b/noncore/net/wellenreiter/TODO
index a1d5bee..0336417 100644
--- a/noncore/net/wellenreiter/TODO
+++ b/noncore/net/wellenreiter/TODO
@@ -1,4 +1,15 @@
-- save configuration settings
- beep over headphone / customizable
-- autoshow new nets - maybe in other color or more contrast
+- identification of probe requests
+ i.e. other sniffers around
+
+- decloaking of falsely reported zero-length SSIDs
+
+- option to run skript on
+ - new net
+ - new station
+ - <whatever>
+
+- adaptive hopping scheme !
+
+-
diff --git a/noncore/unsupported/filebrowser/filebrowser.cpp b/noncore/unsupported/filebrowser/filebrowser.cpp
index d16e771..114ebfa 100644
--- a/noncore/unsupported/filebrowser/filebrowser.cpp
+++ b/noncore/unsupported/filebrowser/filebrowser.cpp
@@ -1,232 +1,232 @@
/**********************************************************************
** 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 "inlineedit.h"
#include "filebrowser.h"
#include "filePermissions.h"
#include <qpe/resource.h>
#include <qpe/global.h>
#include <qpe/mimetype.h>
#include <qpe/applnk.h>
#include <qpe/config.h>
#include <qcopchannel_qws.h>
#include <qpe/qcopenvelope_qws.h>
#include <qmessagebox.h>
#include <qdir.h>
#include <qregexp.h>
#include <qheader.h>
#include <qpe/qpetoolbar.h>
#include <qpopupmenu.h>
-#include <qpe/qpemenubar.h>
+#include <qmenubar.h>
#include <qaction.h>
#include <qstringlist.h>
#include <qcursor.h>
#include <qmultilineedit.h>
#include <qfont.h>
#include <qpainter.h>
#include <qprogressbar.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <qpe/qpeapplication.h>
//
// FileItem
//
FileItem::FileItem( QListView * parent, const QFileInfo & fi )
: QListViewItem( parent ),
fileInfo( fi )
{
QDate d = fi.lastModified().date();
setText( 0, fi.fileName() );
setText( 1, sizeString( fi.size() ) + " " );
setText( 2, QString().sprintf("%4d-%02d-%02d",d.year(), d.month(), d.day() ) );
MimeType mt(fi.filePath());
if ( fi.isSymLink() )
setText( 3, "symlink" );
else if( fi.isDir() )
setText( 3, "directory" );
else if( isLib() )
setText( 3, "library" );
else
setText( 3, mt.description() );
QPixmap pm;
if( fi.isDir() ){
if( !QDir( fi.filePath() ).isReadable() )
pm = Resource::loadPixmap( "lockedfolder" );
else
pm = Resource::loadPixmap( "folder" );
}
else if( !fi.isReadable() )
pm = Resource::loadPixmap( "locked" );
else if( isLib() )
pm = Resource::loadPixmap( "library" );
else if( ((FileView* )parent)->getShowThumbnails() && mt.id().contains(QRegExp("^image/", FALSE, FALSE)) )
pm = drawThumbnail(fi);
else
pm = mt.pixmap();
if ( pm.isNull() )
pm = Resource::loadPixmap("UnknownDocument-14");
if( fi.isSymLink() ){
// overlay link image
QPixmap lnk = Resource::loadPixmap( "filebrowser/symlink" );
QPainter painter( &pm );
painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
pm.setMask( pm.createHeuristicMask( FALSE ) );
}
setPixmap(0,pm);
}
QString FileItem::sizeString( unsigned int s )
{
double size = s;
if ( size > 1024 * 1024 * 1024 )
return QString().sprintf( "%.1f", size / ( 1024 * 1024 * 1024 ) ) + "G";
else if ( size > 1024 * 1024 )
return QString().sprintf( "%.1f", size / ( 1024 * 1024 ) ) + "M";
else if ( size > 1024 )
return QString().sprintf( "%.1f", size / ( 1024 ) ) + "K";
else
return QString::number( size ) + "B";
}
QString FileItem::key( int column, bool ascending ) const
{
QString tmp;
ascending = ascending;
if( (column == 0) && fileInfo.isDir() ){ // Sort by name
// We want the directories to appear at the top of the list
tmp = (char) 0;
return (tmp + text( column ).lower());
}
else if( column == 2 ) { // Sort by date
QDateTime epoch( QDate( 1980, 1, 1 ) );
tmp.sprintf( "%08d", epoch.secsTo( fileInfo.lastModified() ) );
return tmp;
}
else if( column == 1 ) { // Sort by size
return tmp.sprintf( "%08d", fileInfo.size() );
}
return text( column ).lower();
}
bool FileItem::isLib()
{
// This is of course not foolproof
if( !qstrncmp("lib", fileInfo.baseName(), 3) &&
( fileInfo.extension().contains( "so" ) ||
fileInfo.extension().contains( "a" ) ) )
return TRUE;
else
return FALSE;
}
int FileItem::launch()
{
DocLnk doc( fileInfo.filePath(), FALSE );
doc.execute();
listView()->clearSelection();
return 1;
}
bool FileItem::rename( const QString & name )
{
QString oldpath, newpath;
if ( name.isEmpty() )
return FALSE;
if ( name.contains( QRegExp("[/\\$\"\'\\*\\?]") ) )
return FALSE;
oldpath = fileInfo.filePath();
newpath = fileInfo.dirPath() + "/" + name;
if ( ::rename( (const char *) oldpath, (const char *) newpath ) != 0 )
return FALSE;
else
return TRUE;
}
QPixmap FileItem::drawThumbnail(const QFileInfo &file) {
/*
* this thing is sloooooow, and it also doesn't load
* dynamicly (like a web browser). if anyone knows how to
* do that, please do!
*/
QString cacheDir = "/tmp/filebrowserThumbnailCache";
QFileInfo cachedFile (cacheDir + file.filePath());
if (cachedFile.exists() && cachedFile.lastModified() == file.lastModified()) {
QPixmap cachedImage (cachedFile.filePath());
return cachedImage;
}
else {
QImage image (file.filePath());
// if inside of cache dir, don't render thumbnails! recursive error!
if (image.isNull() || file.filePath().contains(QRegExp("^" + cacheDir))) {
DocLnk doc (file.filePath());
return doc.pixmap();
}
Config cfg("Filebrowser");
cfg.setGroup("View");
int size;
size =cfg.readNumEntry("ThumbSize", 72);
QPixmap thumb (size, size);
double scale = (double)image.height() / (double)image.width();
int newHeight = int(size * scale);
thumb.convertFromImage (image.smoothScale(size, newHeight));
if (!cachedFile.dir().exists()) {
QString cmd = "/bin/mkdir -p \"" + cachedFile.dirPath() +"\"";
system( (const char *) cmd );
}
if (thumb.save(cachedFile.filePath(), QPixmap::imageFormat(file.filePath()), 70)) {
// make thumbnail modify time the same as the image
QString cmd = "/bin/touch -r \"" + file.filePath() +"\" " +
"\"" + cachedFile.filePath() + "\"";
system( (const char *) cmd );
}
return thumb;
}
}
//
@@ -653,385 +653,385 @@ void FileView::viewAsText()
FileItem * i = (FileItem *) currentItem();
QCopEnvelope e("QPE/Application/textedit","setDocument(QString)");
e << i->getFilePath();
// Global::execute( "textedit -f ", i->getFilePath() );
}
void FileView::itemClicked( QListViewItem * i)
{
FileItem * t = (FileItem *) i;
if( t == NULL ) return;
if( t->isDir() ){
setDir( t->getFilePath() );
}
}
void FileView::itemDblClicked( QListViewItem * i)
{
if(menuKeepsOpen){
cancelMenuTimer();
}
FileItem * t = (FileItem *) i;
if(t == NULL) return;
if(t->launch() == -1){
QMessageBox::warning( this, tr( "Launch Application" ),
tr( "Launch failed!" ), tr( "Ok" ) );
}
}
void FileView::parentDir()
{
setDir( currentDir + "./.." );
}
void FileView::lastDir()
{
if( dirHistory.count() == 0 ) return;
QString newDir = dirHistory.last();
dirHistory.remove( dirHistory.last() );
generateDir( newDir );
}
void FileView::contentsMousePressEvent( QMouseEvent * e )
{
QListView::contentsMousePressEvent( e );
menuTimer.start( 750, TRUE );
}
void FileView::contentsMouseReleaseEvent( QMouseEvent * e )
{
QListView::contentsMouseReleaseEvent( e );
if(!menuKeepsOpen){
menuTimer.stop();
}
}
void FileView::cancelMenuTimer()
{
if( menuTimer.isActive() )
menuTimer.stop();
}
void FileView::addToDocuments()
{
FileItem * i = (FileItem *) currentItem();
DocLnk f;
QString n = i->text(0);
n.replace(QRegExp("\\..*"),"");
f.setName( n );
f.setFile( i->getFilePath() );
f.writeLink();
}
void FileView::run()
{
FileItem * i = (FileItem *) currentItem();
i->launch();
}
void FileView::showFileMenu()
{
FileItem * i = (FileItem *) currentItem();
if ( !i )
return;
QPopupMenu * m = new QPopupMenu( this );
if ( !i->isDir() ) {
m->insertItem( tr( "Add to Documents" ), this, SLOT( addToDocuments() ) );
m->insertSeparator();
}
MimeType mt(i->getFilePath());
const AppLnk* app = mt.application();
if ( !i->isDir() ) {
if ( app )
m->insertItem( app->pixmap(), tr( "Open in " + app->name() ), this, SLOT( run() ) );
else if( i->isExecutable() )
m->insertItem( Resource::loadPixmap( i->text( 0 ) ), tr( "Run" ), this, SLOT( run() ) );
m->insertItem( Resource::loadPixmap( "txt" ), tr( "View as text" ),
this, SLOT( viewAsText() ) );
m->insertSeparator();
}
m->insertItem( tr( "Rename" ), this, SLOT( rename() ) );
m->insertItem( Resource::loadPixmap("cut"),
tr( "Cut" ), this, SLOT( cut() ) );
m->insertItem( Resource::loadPixmap("copy"),
tr( "Copy" ), this, SLOT( copy() ) );
m->insertItem( Resource::loadPixmap("paste"),
tr( "Paste" ), this, SLOT( paste() ) );
m->insertItem( tr( "Change Permissions" ), this, SLOT( chPerm() ) );
m->insertItem(Resource::loadPixmap( "close" ), tr( "Delete" ), this, SLOT( del() ) );
m->insertSeparator();
m->insertItem( tr( "Select all" ), this, SLOT( selectAll() ) );
m->insertItem( tr( "Deselect all" ), this, SLOT( deselectAll() ) );
m->popup( QCursor::pos() );
}
//
// FileBrowser
//
void FileView::setShowHidden(bool hidden)
{
showHidden=hidden;
}
void FileView::setShowSymlinks(bool symlinks)
{
showSymlinks=symlinks;
}
void FileView::setShowThumbnails(bool thumbnails)
{
showThumbnails=thumbnails;
}
void FileView::setMenuKeepsOpen(bool keepOpen)
{
menuKeepsOpen=keepOpen;
}
FileBrowser::FileBrowser( QWidget * parent,
const char * name, WFlags f ) :
QMainWindow( parent, name, f )
{
init( QDir::current().canonicalPath() );
}
FileBrowser::FileBrowser( const QString & dir, QWidget * parent,
const char * name, WFlags f ) :
QMainWindow( parent, name, f )
{
init( dir );
}
void FileBrowser::init(const QString & dir)
{
setCaption( tr("File Manager") );
setIcon( Resource::loadPixmap( "filebrowser_icon" ) );
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
Config cfg("Filebrowser");
cfg.setGroup("View");
bool showHidden=(cfg.readEntry("Hidden","FALSE") == "TRUE");
bool showSymlinks=(cfg.readEntry("Symlinks","FALSE") == "TRUE");
bool showThumbnails=(cfg.readEntry("Thumbnails","FALSE") == "TRUE");
cfg.setGroup("Menu");
bool menuKeepsOpen=(cfg.readEntry("KeepOpen", "FALSE") == "TRUE");
fileView = new FileView( dir, this, 0, showHidden, showSymlinks, showThumbnails );
fileView->setAllColumnsShowFocus( TRUE );
fileView->setMenuKeepsOpen(menuKeepsOpen);
setCentralWidget( fileView );
setToolBarsMovable( FALSE );
QPEToolBar* toolBar = new QPEToolBar( this );
toolBar->setHorizontalStretchable( TRUE );
- QPEMenuBar* menuBar = new QPEMenuBar( toolBar );
+ QMenuBar* menuBar = new QMenuBar( toolBar );
dirMenu = new QPopupMenu( this );
menuBar->insertItem( tr( "Dir" ), dirMenu );
sortMenu = new QPopupMenu( this );
menuBar->insertItem( tr( "Sort" ), sortMenu );
sortMenu->insertItem( tr( "by Name "), this, SLOT( sortName() ) );
sortMenu->insertItem( tr( "by Size "), this, SLOT( sortSize() ) );
sortMenu->insertItem( tr( "by Date "), this, SLOT( sortDate() ) );
sortMenu->insertItem( tr( "by Type "), this, SLOT( sortType() ) );
sortMenu->insertSeparator();
sortMenu->insertItem( tr( "Ascending" ), this, SLOT( updateSorting() ) );
sortMenu->setItemChecked( sortMenu->idAt( 5 ), TRUE );
sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE );
viewMenu = new QPopupMenu( this);
viewMenu->insertItem( tr( "Hidden"), this, SLOT( updateShowHidden() ) );
viewMenu->insertItem( tr( "Symlinks"), this, SLOT( updateShowSymlinks() ) );
viewMenu->insertItem( tr( "Thumbnails"), this, SLOT( updateShowThumbnails() ) );
viewMenu->setItemChecked( viewMenu->idAt( 0 ), showHidden );
viewMenu->setItemChecked( viewMenu->idAt( 1 ), showSymlinks );
viewMenu->setItemChecked( viewMenu->idAt( 2 ), showThumbnails );
menuBar->insertItem( tr("View"), viewMenu );
toolBar = new QPEToolBar( this );
lastAction = new QAction( tr("Previous dir"), Resource::loadIconSet( "back" ),
QString::null, 0, this, 0 );
connect( lastAction, SIGNAL( activated() ), fileView, SLOT( lastDir() ) );
lastAction->addTo( toolBar );
lastAction->setEnabled( FALSE );
upAction = new QAction( tr("Parent dir"), Resource::loadIconSet( "up" ),
QString::null, 0, this, 0 );
connect( upAction, SIGNAL( activated() ), fileView, SLOT( parentDir() ) );
upAction->addTo( toolBar );
QAction *a = new QAction( tr("New folder"), Resource::loadPixmap( "newfolder" ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), fileView, SLOT( newFolder() ) );
a->addTo( toolBar );
a = new QAction( tr("Cut"), Resource::loadPixmap( "cut" ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), fileView, SLOT( cut() ) );
a->addTo( toolBar );
a = new QAction( tr("Copy"), Resource::loadPixmap( "copy" ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), fileView, SLOT( copy() ) );
a->addTo( toolBar );
pasteAction = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ),
QString::null, 0, this, 0 );
connect( pasteAction, SIGNAL( activated() ), fileView, SLOT( paste() ) );
pasteAction->addTo( toolBar );
// dirLabel = new QLabel(this, "DirLabel");
connect( fileView, SIGNAL( dirChanged() ), SLOT( updateDirMenu() ) );
updateDirMenu();
QCopChannel* pcmciaChannel = new QCopChannel( "QPE/Card", this );
connect( pcmciaChannel, SIGNAL(received(const QCString &, const QByteArray &)),
this, SLOT(pcmciaMessage( const QCString &, const QByteArray &)) );
}
void FileBrowser::pcmciaMessage( const QCString &msg, const QByteArray &)
{
if ( msg == "mtabChanged()" ) {
// ## Only really needed if current dir is on a card
fileView->updateDir();
}
}
void FileBrowser::changeCaption(const QString & dir) {
setCaption( dir);
}
void FileBrowser::dirSelected( int id )
{
int i = 0, j;
QString dir;
// Bulid target dir from menu
while( (j = dirMenu->idAt( i )) != id ){
dir += dirMenu->text( j ).stripWhiteSpace();
if( dirMenu->text( j ) != "/" ) dir += "/";
i++;
}
dir += dirMenu->text( dirMenu->idAt( i ) ).stripWhiteSpace();
fileView->setDir( dir );
}
void FileBrowser::updateDirMenu()
{
QString spc, cd = fileView->cd();
QStringList l = QStringList::split( "/", cd );
int i = 0;
dirMenu->clear();
dirMenu->insertItem( tr( "/" ), this, SLOT( dirSelected(int) ) );
for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it ) {
spc.fill( ' ', i++);
dirMenu->insertItem( spc + (*it), this,
SLOT( dirSelected(int) ) );
}
dirMenu->setItemChecked( dirMenu->idAt( l.count() ), TRUE );
lastAction->setEnabled( fileView->history().count() != 0 );
upAction->setEnabled( cd != "/" );
}
void FileBrowser::sortName()
{
fileView->setSorting( 0, sortMenu->isItemChecked( sortMenu->idAt( 5 ) ) );
fileView->sort();
sortMenu->setItemChecked( sortMenu->idAt( 0 ), TRUE );
sortMenu->setItemChecked( sortMenu->idAt( 1 ), FALSE );
sortMenu->setItemChecked( sortMenu->idAt( 2 ), FALSE );
sortMenu->setItemChecked( sortMenu->idAt( 3 ), FALSE );
}
void FileBrowser::sortSize()
{
fileView->setSorting( 1, sortMenu->isItemChecked( sortMenu->idAt( 5 ) ) );
fileView->sort();
sortMenu->setItemChecked( sortMenu->idAt( 0 ), FALSE );
sortMenu->setItemChecked( sortMenu->idAt( 1 ), TRUE );
sortMenu->setItemChecked( sortMenu->idAt( 2 ), FALSE );
sortMenu->setItemChecked( sortMenu->idAt( 3 ), FALSE );
}
void FileBrowser::sortDate()
{
fileView->setSorting( 2, sortMenu->isItemChecked( sortMenu->idAt( 5 ) ) );
fileView->sort();
sortMenu->setItemChecked( sortMenu->idAt( 0 ), FALSE );
sortMenu->setItemChecked( sortMenu->idAt( 1 ), FALSE );
sortMenu->setItemChecked( sortMenu->idAt( 2 ), TRUE );
sortMenu->setItemChecked( sortMenu->idAt( 3 ), FALSE );
}
void FileBrowser::sortType()
{
fileView->setSorting( 3, sortMenu->isItemChecked( sortMenu->idAt( 5 ) ) );
fileView->sort();
sortMenu->setItemChecked( sortMenu->idAt( 0 ), FALSE );
sortMenu->setItemChecked( sortMenu->idAt( 1 ), FALSE );
sortMenu->setItemChecked( sortMenu->idAt( 2 ), FALSE );
sortMenu->setItemChecked( sortMenu->idAt( 3 ), TRUE );
}
void FileBrowser::updateSorting()
{
sortMenu->setItemChecked( sortMenu->idAt( 5 ), !sortMenu->isItemChecked( sortMenu->idAt( 5 ) ) );
if ( sortMenu->isItemChecked( sortMenu->idAt( 0 ) ) )
sortName();
else if ( sortMenu->isItemChecked( sortMenu->idAt( 1 ) ) )
sortSize();
else if ( sortMenu->isItemChecked( sortMenu->idAt( 2 ) ) )
sortDate();
else
sortType();
}
void FileView::chPerm() {
FileItem * i;
QStringList fl;
QString cmd;
if((i = (FileItem *) firstChild()) == 0) return;
while( i ){
if( i->isSelected() ){
fl += i->getFilePath();
}
i = (FileItem *) i->nextSibling();
}
if( fl.count() < 1 ) return;
if( QMessageBox::warning( this, tr("Change permissions"), tr("Are you sure?"),
tr("Yes"), tr("No") ) == 0) {
for ( QStringList::Iterator it = fl.begin(); it != fl.end(); ++it ) {
filePermissions *filePerm;
filePerm = new filePermissions(this, "Permissions",true,0,(const QString &)(*it));
filePerm->exec();
if( filePerm)
diff --git a/noncore/unsupported/mail2/composerbase.cpp b/noncore/unsupported/mail2/composerbase.cpp
index 6f6ab8e..34d6eb6 100644
--- a/noncore/unsupported/mail2/composerbase.cpp
+++ b/noncore/unsupported/mail2/composerbase.cpp
@@ -1,205 +1,205 @@
#include <qmultilineedit.h>
#include <qpopupmenu.h>
#include <qcombobox.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qaction.h>
#include <qlabel.h>
#include <qvbox.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include "mailstatusbar.h"
#include "listviewplus.h"
#include "composerbase.h"
ComposerBase::ComposerBase(QWidget *parent, const char *name, WFlags fl)
: QMainWindow(parent, name, fl)
{
setCaption(tr("Compose Message"));
setToolBarsMovable(false);
toolbar = new QPEToolBar(this);
- menubar = new QPEMenuBar( toolbar );
+ menubar = new QMenuBar( toolbar );
mailmenu = new QPopupMenu( menubar );
menubar->insertItem( tr( "Mail" ), mailmenu );
addToolBar(toolbar);
toolbar->setHorizontalStretchable(true);
QLabel *spacer = new QLabel(toolbar);
spacer->setBackgroundMode(QWidget::PaletteButton);
toolbar->setStretchableWidget(spacer);
sendmail = new QAction(tr("Send the mail"), QIconSet(Resource::loadPixmap("mail/sendmail")), 0, 0, this);
sendmail->addTo(toolbar);
sendmail->addTo(mailmenu);
queuemail = new QAction(tr("Queue the mail"), QIconSet(Resource::loadPixmap("mail/sendall")), 0, 0, this);
queuemail->addTo(toolbar);
queuemail->addTo(mailmenu);
attachfile = new QAction(tr("Attach a file"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true);
attachfile->addTo(toolbar);
attachfile->addTo(mailmenu);
connect(attachfile, SIGNAL(toggled(bool)), SLOT(slotAttachfileChanged(bool)));
addressbook = new QAction(tr("Addressbook"), QIconSet(Resource::loadPixmap("mail/addbook")), 0, 0, this);
addressbook->addTo(toolbar);
addressbook->addTo(mailmenu);
QWidget *main = new QWidget(this);
setCentralWidget(main);
QGridLayout *layout = new QGridLayout(main);
fromBox = new QComboBox(main);
fromBox->insertItem(tr("From"), POPUP_FROM_FROM);
fromBox->insertItem(tr("Reply"), POPUP_FROM_REPLYTO);
layout->addWidget(fromBox, 0, 0);
connect(fromBox, SIGNAL(activated(int)), SLOT(slotFromMenuChanged(int)));
QHBoxLayout *fromLayout = new QHBoxLayout();
layout->addLayout(fromLayout, 0, 1);
from = new QComboBox(main);
fromLayout->addWidget(from);
replyto = new QLineEdit(main);
replyto->hide();
fromLayout->addWidget(replyto);
receiversBox = new QComboBox(main);
receiversBox->insertItem(tr("To"), POPUP_RECV_TO);
receiversBox->insertItem(tr("Cc"), POPUP_RECV_CC);
receiversBox->insertItem(tr("Bcc"), POPUP_RECV_BCC);
layout->addWidget(receiversBox, 1, 0);
connect(receiversBox, SIGNAL(activated(int)), SLOT(slotReceiverMenuChanged(int)));
QHBoxLayout *receiverLayout = new QHBoxLayout();
layout->addLayout(receiverLayout, 1, 1);
to = new QLineEdit(main);
receiverLayout->addWidget(to);
cc = new QLineEdit(main);
cc->hide();
receiverLayout->addWidget(cc);
bcc = new QLineEdit(main);
bcc->hide();
receiverLayout->addWidget(bcc);
subjectBox = new QComboBox(main);
subjectBox->insertItem(tr("Subj."), POPUP_SUBJ_SUBJECT);
subjectBox->insertItem(tr("Prio."), POPUP_SUBJ_PRIORITY);
layout->addWidget(subjectBox, 2, 0);
connect(subjectBox, SIGNAL(activated(int)), SLOT(slotSubjectMenuChanged(int)));
QHBoxLayout *subjectLayout = new QHBoxLayout();
layout->addLayout(subjectLayout, 2, 1);
subject = new QLineEdit(main);
subjectLayout->addWidget(subject);
priority = new QComboBox(main);
priority->insertItem(tr("Low"), POPUP_PRIO_LOW);
priority->insertItem(tr("Normal"), POPUP_PRIO_NORMAL);
priority->insertItem(tr("High"), POPUP_PRIO_HIGH);
priority->setCurrentItem(POPUP_PRIO_NORMAL);
priority->hide();
subjectLayout->addWidget(priority);
QVBox *view = new QVBox(main);
layout->addMultiCellWidget(view, 3, 3, 0, 1);
message = new QMultiLineEdit(view);
message->setMinimumHeight(30);
attachWindow = new QMainWindow(view, 0, 0);
attachWindow->setMinimumHeight(80);
attachWindow->setMaximumHeight(80);
attachWindow->setToolBarsMovable(false);
attachWindow->hide();
attachToolbar = new QPEToolBar(attachWindow);
attachToolbar->setVerticalStretchable(true);
addattach = new QAction(tr("Add an Attachement"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this);
addattach->addTo(attachToolbar);
delattach = new QAction(tr("Remove Attachement"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this);
delattach->addTo(attachToolbar);
QLabel *attachSpacer = new QLabel(attachToolbar);
attachSpacer->setBackgroundMode(QWidget::PaletteButton);
attachToolbar->setStretchableWidget(attachSpacer);
attachWindow->addToolBar(attachToolbar, QMainWindow::Left);
attachView = new ListViewPlus(attachWindow);
attachView->addColumn(tr("Name"), 80);
attachView->addColumn(tr("Description"), 110);
attachView->setAllColumnsShowFocus(true);
attachWindow->setCentralWidget(attachView);
attachPopup = new QPopupMenu(attachView);
attachPopup->insertItem(tr("Rename"), POPUP_ATTACH_RENAME);
attachPopup->insertItem(tr("Change Description"), POPUP_ATTACH_DESC);
attachPopup->insertSeparator();
attachPopup->insertItem(tr("Remove"), POPUP_ATTACH_REMOVE);
attachView->setPopup(attachPopup);
status = new MailStatusBar(view);
}
void ComposerBase::slotAttachfileChanged(bool toggled)
{
if (toggled) {
if (attachWindow->isHidden()) attachWindow->show();
} else {
if (!attachWindow->isHidden()) attachWindow->hide();
}
}
void ComposerBase::slotFromMenuChanged(int id)
{
if (POPUP_FROM_FROM == id) {
if (from->isHidden()) from->show();
if (!replyto->isHidden()) replyto->hide();
} else if (POPUP_FROM_REPLYTO == id) {
if (!from->isHidden()) from->hide();
if (replyto->isHidden()) replyto->show();
}
}
void ComposerBase::slotReceiverMenuChanged(int id)
{
if (POPUP_RECV_TO == id) {
if (to->isHidden()) to->show();
if (!cc->isHidden()) cc->hide();
if (!bcc->isHidden()) bcc->hide();
} else if (POPUP_RECV_CC == id) {
if (!to->isHidden()) to->hide();
if (cc->isHidden()) cc->show();
if (!bcc->isHidden()) bcc->hide();
} else if (POPUP_RECV_BCC == id) {
if (!to->isHidden()) to->hide();
if (!cc->isHidden()) cc->hide();
if (bcc->isHidden()) bcc->show();
}
}
void ComposerBase::slotSubjectMenuChanged(int id)
{
if (POPUP_SUBJ_SUBJECT == id) {
if (subject->isHidden()) subject->show();
if (!priority->isHidden()) priority->hide();
} else if (POPUP_SUBJ_PRIORITY == id) {
if (!subject->isHidden()) subject->hide();
if (priority->isHidden()) priority->show();
}
}
diff --git a/noncore/unsupported/mail2/composerbase.h b/noncore/unsupported/mail2/composerbase.h
index 58f1157..2c832d6 100644
--- a/noncore/unsupported/mail2/composerbase.h
+++ b/noncore/unsupported/mail2/composerbase.h
@@ -1,61 +1,61 @@
#ifndef COMPOSERBASE_H
#define COMPOSERBASE_H
#include <qmainwindow.h>
class QMultiLineEdit;
class MailStatusBar;
class ListViewPlus;
class QPopupMenu;
class QPEToolBar;
-class QPEMenuBar;
+class QMenuBar;
class QPopupMenu;
class QComboBox;
class QLineEdit;
class QAction;
class QLabel;
class ComposerBase : public QMainWindow
{
Q_OBJECT
public:
ComposerBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
protected:
static const int POPUP_FROM_FROM = 0;
static const int POPUP_FROM_REPLYTO = 1;
static const int POPUP_RECV_TO = 0;
static const int POPUP_RECV_CC = 1;
static const int POPUP_RECV_BCC = 2;
static const int POPUP_SUBJ_SUBJECT = 0;
static const int POPUP_SUBJ_PRIORITY = 1;
static const int POPUP_PRIO_LOW = 0;
static const int POPUP_PRIO_NORMAL = 1;
static const int POPUP_PRIO_HIGH = 2;
static const int POPUP_ATTACH_RENAME = 0;
static const int POPUP_ATTACH_DESC = 1;
static const int POPUP_ATTACH_REMOVE = 2;
QMultiLineEdit *message;
MailStatusBar *status;
ListViewPlus *attachView;
QMainWindow *attachWindow;
QPopupMenu *attachPopup;
QPEToolBar *toolbar, *attachToolbar;
- QPEMenuBar *menubar;
+ QMenuBar *menubar;
QPopupMenu *mailmenu;
QComboBox *fromBox, *from, *receiversBox, *subjectBox, *priority;
QLineEdit *replyto, *to, *cc, *bcc, *subject;
QAction *sendmail, *queuemail, *attachfile, *addressbook, *abort, *addattach, *delattach;
QLabel *fromLabel;
protected slots:
void slotAttachfileChanged(bool toggled);
void slotFromMenuChanged(int id);
void slotReceiverMenuChanged(int id);
void slotSubjectMenuChanged(int id);
};
#endif
diff --git a/noncore/unsupported/mail2/mainwindowbase.cpp b/noncore/unsupported/mail2/mainwindowbase.cpp
index e35d489..119acfb 100644
--- a/noncore/unsupported/mail2/mainwindowbase.cpp
+++ b/noncore/unsupported/mail2/mainwindowbase.cpp
@@ -1,75 +1,75 @@
#include <qpopupmenu.h>
#include <qaction.h>
#include <qheader.h>
#include <qlabel.h>
#include <qvbox.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include "mainwindowbase.h"
#include "mailstatusbar.h"
#include "folderwidget.h"
#include "mailtable.h"
MainWindowBase::MainWindowBase(QWidget *parent, const char *name, WFlags fl)
: QMainWindow(parent, name, fl)
{
setCaption(tr("E-Mail"));
setToolBarsMovable(false);
toolbar = new QPEToolBar(this);
- menubar = new QPEMenuBar( toolbar );
+ menubar = new QMenuBar( toolbar );
mailmenu = new QPopupMenu( menubar );
servermenu = new QPopupMenu( menubar );
menubar->insertItem( tr( "Mail" ), mailmenu );
menubar->insertItem( tr( "Servers" ), servermenu );
addToolBar(toolbar);
toolbar->setHorizontalStretchable(true);
QLabel *spacer = new QLabel(toolbar);
spacer->setBackgroundMode(QWidget::PaletteButton);
toolbar->setStretchableWidget(spacer);
compose = new QAction(tr("Compose new mail"), QIconSet(Resource::loadPixmap("mail/newmail")), 0, 0, this);
compose->addTo(toolbar);
compose->addTo(mailmenu);
sendQueue = new QAction(tr("Send queued mails"), QIconSet(Resource::loadPixmap("mail/sendqueue")), 0, 0, this);
sendQueue->addTo(toolbar);
sendQueue->addTo(mailmenu);
folders = new QAction(tr("Show/hide folders"), QIconSet(Resource::loadPixmap("mail/folder")), 0, 0, this, 0, true);
folders->addTo(toolbar);
folders->addTo(servermenu);
connect(folders, SIGNAL(toggled(bool)), SLOT(slotFoldersToggled(bool)));
findmails = new QAction(tr("Search mails"), QIconSet(Resource::loadPixmap("mail/find")), 0, 0, this);
findmails->addTo(toolbar);
findmails->addTo(mailmenu);
configure = new QAction(tr("Configuration"), QIconSet(Resource::loadPixmap("mail/configure")), 0, 0, this);
configure->addTo(servermenu);
QVBox *view = new QVBox(this);
setCentralWidget(view);
folderView = new FolderWidget(view);
folderView->setMinimumHeight(90);
folderView->setMaximumHeight(90);
folderView->hide();
mailView = new MailTable(view);
mailView->setMinimumHeight(50);
status = new MailStatusBar(view);
}
void MainWindowBase::slotFoldersToggled(bool toggled)
{
if (folderView->isHidden() && toggled) folderView->show();
if (!folderView->isHidden() && !toggled) folderView->hide();
}
diff --git a/noncore/unsupported/mail2/mainwindowbase.h b/noncore/unsupported/mail2/mainwindowbase.h
index 11c5ea0..b2e1dc5 100644
--- a/noncore/unsupported/mail2/mainwindowbase.h
+++ b/noncore/unsupported/mail2/mainwindowbase.h
@@ -1,37 +1,37 @@
#ifndef MAINWINDOWBASE_H
#define MAINWINDOWBASE_H
#include <qmainwindow.h>
class ServerConnection;
class MailStatusBar;
class FolderWidget;
class QPEToolBar;
-class QPEMenuBar;
+class QMenuBar;
class QPopupMenu;
class MailTable;
class QAction;
class MainWindowBase : public QMainWindow
{
Q_OBJECT
public:
MainWindowBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
protected slots:
void slotFoldersToggled(bool toggled);
protected:
ServerConnection *serverConnection;
MailStatusBar *status;
FolderWidget *folderView;
QPEToolBar *toolbar;
- QPEMenuBar *menubar;
+ QMenuBar *menubar;
QPopupMenu *mailmenu, *servermenu;
MailTable *mailView;
QAction *compose, *sendQueue, *folders, *findmails, *configure;
};
#endif
diff --git a/noncore/unsupported/mail2/viewmailbase.cpp b/noncore/unsupported/mail2/viewmailbase.cpp
index a02f73a..10aa14d 100644
--- a/noncore/unsupported/mail2/viewmailbase.cpp
+++ b/noncore/unsupported/mail2/viewmailbase.cpp
@@ -1,75 +1,75 @@
#include <qtextbrowser.h>
#include <qlistview.h>
#include <qaction.h>
#include <qlabel.h>
#include <qvbox.h>
#include <qpopupmenu.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qpemenubar.h>
#include <qpe/resource.h>
#include "viewmailbase.h"
#include "opendiag.h"
ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
: QMainWindow(parent, name, fl)
{
setCaption(tr("E-Mail by %1"));
setToolBarsMovable(false);
toolbar = new QPEToolBar(this);
- menubar = new QPEMenuBar( toolbar );
+ menubar = new QMenuBar( toolbar );
mailmenu = new QPopupMenu( menubar );
menubar->insertItem( tr( "Mail" ), mailmenu );
toolbar->setHorizontalStretchable(true);
addToolBar(toolbar);
QLabel *spacer = new QLabel(toolbar);
spacer->setBackgroundMode(QWidget::PaletteButton);
toolbar->setStretchableWidget(spacer);
reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this);
reply->addTo(toolbar);
reply->addTo(mailmenu);
forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this);
forward->addTo(toolbar);
forward->addTo(mailmenu);
attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true);
attachbutton->addTo(toolbar);
attachbutton->addTo(mailmenu);
connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool)));
deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this);
deleteMail->addTo(toolbar);
deleteMail->addTo(mailmenu);
QVBox *view = new QVBox(this);
setCentralWidget(view);
attachments = new QListView(view);
attachments->setMinimumHeight(90);
attachments->setMaximumHeight(90);
attachments->setAllColumnsShowFocus(true);
attachments->addColumn("Mime Type", 100);
attachments->addColumn("Filename", 100);
attachments->addColumn("Description", 100);
attachments->hide();
browser = new QTextBrowser(view);
openDiag = new OpenDiag(view);
openDiag->hide();
}
void ViewMailBase::slotChangeAttachview(bool state)
{
if (state) attachments->show();
else attachments->hide();
}
diff --git a/noncore/unsupported/mail2/viewmailbase.h b/noncore/unsupported/mail2/viewmailbase.h
index ba82017..6e55021 100644
--- a/noncore/unsupported/mail2/viewmailbase.h
+++ b/noncore/unsupported/mail2/viewmailbase.h
@@ -1,36 +1,36 @@
#ifndef VIEWMAILBASE_H
#define VIEWMAILBASE_H
#include <qmainwindow.h>
class QAction;
class OpenDiag;
class QListView;
class QPEToolBar;
class QTextBrowser;
-class QPEMenuBar;
+class QMenuBar;
class QPopupMenu;
class ViewMailBase : public QMainWindow
{
Q_OBJECT
public:
ViewMailBase(QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
protected:
QAction *reply, *forward, *attachbutton, *deleteMail;
QListView *attachments;
QPEToolBar *toolbar;
QTextBrowser *browser;
OpenDiag *openDiag;
- QPEMenuBar *menubar;
+ QMenuBar *menubar;
QPopupMenu *mailmenu;
protected slots:
void slotChangeAttachview(bool state);
};
#endif
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 04362d3..6930d60 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -1,278 +1,278 @@
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
// Copyright (C) 2000 Trolltech AS.
// adadpted form qpe/qipkg
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
#include "mainwindow.h"
-#include <qpe/qpemenubar.h>
+#include <qmenubar.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qcopenvelope_qws.h>
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qtoolbutton.h>
#include <qstring.h>
#include <qlabel.h>
#include <qfile.h>
#include <qlistview.h>
#include <qtextview.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include "pksettingsbase.h"
#include "utils.h"
#include "packagelistitem.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) :
QMainWindow( parent, name, f )
// packageListServers( QObject(parent), name ),
// packageListSearch( parent, name ),
// packageListDocLnk( parent, name )
{
setCaption( tr("Package Manager") );
settings = new PackageManagerSettings(this,0,TRUE);
listViewPackages = new PackageListView( this,"listViewPackages",settings );
setCentralWidget( listViewPackages );
listViewPackages->addList( tr("feeds"), &packageListServers );
listViewPackages->addList( tr("ipkgfind&killefiz"), &packageListSearch );
listViewPackages->addList( tr("documents"), &packageListDocLnk );
ipkg = new PmIpkg( settings, this );
packageListServers.setSettings( settings );
packageListSearch.setSettings( settings );
packageListDocLnk.setSettings( settings );
pvDebug(9,"packageListServers.update");
packageListServers.update();
pvDebug(9,"packageListDocLnk.update");
packageListDocLnk.update();
pvDebug(9,"makeMenu");
makeMenu();
makeChannel();
connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
connect( settings->removeLinksButton, SIGNAL( clicked()),
SLOT(removeLinks()) );
connect( settings->createLinksButton, SIGNAL( clicked()),
SLOT(createLinks()) );
pvDebug(9,"displayList");
displayList();
}
void MainWindow::makeMenu()
{
QPEToolBar *toolBar = new QPEToolBar( this );
- QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
+ QMenuBar *menuBar = new QMenuBar( toolBar );
QPopupMenu *srvMenu = new QPopupMenu( menuBar );
QPopupMenu *viewMenu = new QPopupMenu( menuBar );
QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
QPopupMenu *helpMenu = new QPopupMenu( menuBar );
setToolBarsMovable( false );
toolBar->setHorizontalStretchable( true );
menuBar->insertItem( tr( "Package" ), srvMenu );
menuBar->insertItem( tr( "View" ), viewMenu );
menuBar->insertItem( tr( "Settings" ), cfgMenu );
menuBar->insertItem( tr( "Help" ), helpMenu );
// QLabel *spacer;
// spacer = new QLabel( "", toolBar );
// spacer->setBackgroundColor( toolBar->backgroundColor() );
// toolBar->setStretchableWidget( spacer );
runAction = new QAction( tr( "Apply" ),
Resource::loadPixmap( "oipkg/install" ),
QString::null, 0, this, 0 );
connect( runAction, SIGNAL( activated() ),
this, SLOT( runIpkg() ) );
runAction->addTo( toolBar );
runAction->addTo( srvMenu );
srvMenu->insertSeparator();
updateAction = new QAction( tr( "Update" ),
Resource::loadIconSet( "oipkg/update" ),
QString::null, 0, this, 0 );
connect( updateAction, SIGNAL( activated() ),
this , SLOT( updateList() ) );
updateAction->addTo( toolBar );
updateAction->addTo( srvMenu );
QAction *cfgact;
cfgact = new QAction( tr( "Setups" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettingsSetup() ) );
cfgact->addTo( cfgMenu );
cfgact = new QAction( tr( "Servers" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettingsSrv() ) );
cfgact->addTo( cfgMenu );
cfgact = new QAction( tr( "Destinations" ),
QString::null, 0, this, 0 );
connect( cfgact, SIGNAL( activated() ),
SLOT( showSettingsDst() ) );
cfgact->addTo( cfgMenu );
QAction *a;
// SECTIONS
sectionBar = new QPEToolBar( this );
addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
sectionBar->setHorizontalStretchable( true );
QLabel *label = new QLabel( sectionBar, "section" );
// label->setBackgroundMode( NoBackground );
label->font().setPointSize( 8 );
label->setText( tr( "Section:" ) );
sectionBar->setStretchableWidget( label );
section = new QComboBox( false, sectionBar );
section->font().setPointSize( 8 );
label = new QLabel( " / ", sectionBar );
label->font().setPointSize( 8 );
// label->setBackgroundMode( PaletteForeground );
subsection = new QComboBox( false, sectionBar );
subsection->font().setPointSize( 8 );
a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
a->addTo( sectionBar );
setSections();
setSubSections();
sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
sectionAction->setToggleAction( true );
sectionAction->addTo( viewMenu );
// sectionBar->setStretchableWidget( section );
//FIND
findBar = new QPEToolBar(this);
addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
label = new QLabel( tr("Filter: "), findBar );
// label->setBackgroundMode( PaletteForeground );
findBar->setHorizontalStretchable( TRUE );
findEdit = new QLineEdit( findBar, "findEdit" );
findBar->setStretchableWidget( findEdit );
connect( findEdit, SIGNAL( textChanged( const QString & ) ),
this, SLOT( displayList() ) );
a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
a->addTo( findBar );
a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
a->addTo( findBar );
findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
findAction->setToggleAction( true );
findAction->addTo( viewMenu );
//SEARCH
searchBar = new QPEToolBar(this);
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
label = new QLabel( tr("Search: "), searchBar );
// label->setBackgroundMode( PaletteForeground );
searchBar->setHorizontalStretchable( TRUE );
searchEdit = new QLineEdit( searchBar, "seachEdit" );
searchBar->setStretchableWidget( searchEdit );
// connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
// this, SLOT( displayList() ) );
a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
a->addTo( searchBar );
searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
searchCommit->addTo( searchBar );
a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
a->addTo( searchBar );
searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
searchAction->setToggleAction( true );
searchAction->addTo( viewMenu );
//DEST
destBar = new QPEToolBar(this);
addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
label = new QLabel( tr("Destination: "), destBar );
// label->setBackgroundMode( PaletteForeground );
destBar->setHorizontalStretchable( TRUE );
destination = new QComboBox( false, destBar );
destination->insertStringList( settings->getDestinationNames() );
setComboName(destination,settings->getDestinationName());
connect( destination, SIGNAL(activated(int)),
settings, SLOT(activeDestinationChange(int)) );
// space->setBackgroundMode( PaletteForeground );
CheckBoxLink = new QCheckBox( tr("Link"), destBar);
// CheckBoxLink->setBackgroundMode( PaletteForeground );
CheckBoxLink->setChecked( settings->createLinks() );
connect( CheckBoxLink, SIGNAL(toggled(bool)),
settings, SLOT(linkEnabled(bool)) );
destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), SLOT( destClose() ) );
a->addTo( destBar );
destBar->setStretchableWidget( CheckBoxLink );
destAction->setToggleAction( true );
destAction->addTo( viewMenu );
// helpMenu
helpMenu->insertSeparator();
a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 );
a->addTo( helpMenu );
helpMenu->insertSeparator();
a = new QAction( tr( "Install" ),
Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 );
a->addTo( helpMenu );
a = new QAction( tr( "Remove" ),
Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 );
a->addTo( helpMenu );
helpMenu->insertSeparator();
a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 );
a->addTo( helpMenu );
helpMenu->insertSeparator();
a = new QAction( tr( "New version, installed" ),
Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 );
a->addTo( helpMenu );
a = new QAction( tr( "New version, not installed" ),
Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 );
a->addTo( helpMenu );
a = new QAction( tr( "Old version, installed" ),
Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 );
a->addTo( helpMenu );
a = new QAction( tr( "Old version, not installed" ),
Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 );
a->addTo( helpMenu );
a = new QAction( tr( "Old version, new version installed" ),
Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 );
a->addTo( helpMenu );
a = new QAction( tr( "New version, old version installed" ),
Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 );
a->addTo( helpMenu );
// a = new QAction( tr( "" ),
// Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 );
// a->addTo( helpMenu );