summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/cbinfo.cpp116
-rw-r--r--noncore/apps/checkbook/cbinfo.h24
-rw-r--r--noncore/apps/checkbook/cfg.cpp213
-rw-r--r--noncore/apps/checkbook/cfg.h120
-rw-r--r--noncore/apps/checkbook/checkbook.cpp228
-rw-r--r--noncore/apps/checkbook/checkbook.h32
-rw-r--r--noncore/apps/checkbook/checkbook.pro12
-rw-r--r--noncore/apps/checkbook/configuration.cpp107
-rw-r--r--noncore/apps/checkbook/configuration.h18
-rw-r--r--noncore/apps/checkbook/listedit.cpp340
-rw-r--r--noncore/apps/checkbook/listedit.h78
-rw-r--r--noncore/apps/checkbook/main.cpp14
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp119
-rw-r--r--noncore/apps/checkbook/mainwindow.h15
-rw-r--r--noncore/apps/checkbook/tabledef.cpp76
-rw-r--r--noncore/apps/checkbook/tabledef.h99
-rw-r--r--noncore/apps/checkbook/traninfo.cpp54
-rw-r--r--noncore/apps/checkbook/traninfo.h17
-rw-r--r--noncore/apps/checkbook/transaction.cpp40
-rw-r--r--noncore/apps/checkbook/transaction.h6
-rw-r--r--noncore/apps/odict/main.cpp11
-rw-r--r--noncore/apps/odict/odict.cpp34
-rw-r--r--noncore/apps/odict/odict.h4
-rw-r--r--noncore/apps/odict/odict.pro5
-rw-r--r--noncore/apps/opie-console/opie-console.control2
-rw-r--r--noncore/apps/opie-reader/opie-reader.pro7
-rw-r--r--noncore/apps/opie-sheet/main.cpp10
-rw-r--r--noncore/apps/opie-sheet/mainwindow.cpp4
-rw-r--r--noncore/apps/opie-sheet/mainwindow.h3
-rw-r--r--noncore/apps/opie-sheet/opie-sheet.pro4
-rw-r--r--noncore/apps/opie-write/main.cpp13
-rw-r--r--noncore/apps/opie-write/mainwindow.cpp4
-rw-r--r--noncore/apps/opie-write/mainwindow.h4
-rw-r--r--noncore/apps/opie-write/opie-write.pro23
-rw-r--r--noncore/apps/oxygen/main.cpp11
-rw-r--r--noncore/apps/oxygen/oxygen.cpp6
-rw-r--r--noncore/apps/oxygen/oxygen.h15
-rw-r--r--noncore/apps/oxygen/oxygen.pro28
-rw-r--r--noncore/apps/tableviewer/main.cpp11
-rw-r--r--noncore/apps/tableviewer/tableviewer.h1
-rw-r--r--noncore/apps/tableviewer/tableviewer.pro4
-rw-r--r--noncore/apps/tinykate/main.cpp10
-rw-r--r--noncore/apps/tinykate/opie-tinykate.control2
-rw-r--r--noncore/apps/tinykate/tinykate.h2
-rw-r--r--noncore/apps/tinykate/tinykate.pro4
-rw-r--r--noncore/apps/zsafe/.cvsignore3
-rw-r--r--noncore/settings/aqpkg/.cvsignore1
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro26
-rw-r--r--noncore/settings/aqpkg/main.cpp44
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp31
-rw-r--r--noncore/settings/aqpkg/mainwin.h5
-rw-r--r--noncore/settings/sysinfo/main.cpp11
-rw-r--r--noncore/settings/sysinfo/storage.cpp27
-rw-r--r--noncore/settings/sysinfo/sysinfo.h1
-rw-r--r--noncore/settings/sysinfo/sysinfo.pro9
55 files changed, 1595 insertions, 513 deletions
diff --git a/noncore/apps/checkbook/cbinfo.cpp b/noncore/apps/checkbook/cbinfo.cpp
index 9fdc6b2..36dde04 100644
--- a/noncore/apps/checkbook/cbinfo.cpp
+++ b/noncore/apps/checkbook/cbinfo.cpp
@@ -24,171 +24,203 @@
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "cbinfo.h"
#include "traninfo.h"
#include <qpe/config.h>
#include <qfile.h>
+// --- CBInfo -----------------------------------------------------------------
CBInfo::CBInfo()
{
n = "";
fn = "";
pw = QString::null;
t = "";
bn = "";
a = "";
p = "";
nt = "";
sb = 0.0;
+ _sLastTab="";
+ _first=-1;
+ _last=-1;
tl = new TranInfoList();
}
+
+// --- CBInfo -----------------------------------------------------------------
CBInfo::CBInfo( const QString &name, const QString &filename )
{
Config config( filename, Config::File );
config.setGroup( "Account" );
n = name;
fn = filename;
pw = config.readEntryCrypt( "Password", QString::null );
t = config.readEntry( "Type" );
bn = config.readEntry( "Bank", "" );
a = config.readEntryCrypt( "Number", "" );
p = config.readEntryCrypt( "PINNumber", "" );
nt = config.readEntry( "Notes", "" );
+ _sLastTab = config.readEntry("LastTab", "");
+ _first=config.readNumEntry("First", -1);
+ _sSortOrder = config.readEntry( "SortOrder", QWidget::tr("Date") );
bool ok;
sb = config.readEntry( "Balance", "0.0" ).toFloat( &ok );
loadTransactions();
}
+// --- balance ----------------------------------------------------------------
float CBInfo::balance()
{
calcBalance();
return b;
}
+// --- write ------------------------------------------------------------------
void CBInfo::write()
{
QFile f( fn );
if ( f.exists() )
- {
f.remove();
- }
Config *config = new Config(fn, Config::File);
- // Save info
+
+ // fix transaction numbers
+ _first=-1;
+ TranInfo *prev=NULL;
+ for ( TranInfo *tran = tl->first(); tran; tran = tl->next() ) {
+ if( _first<0 ) _first=tran->id();
+ if( prev ) prev->setNext( tran->id() );
+ tran->setNext(-1);
+ prev=tran;
+ }
+
+ // Save transactions
+ for ( TranInfo *tran = tl->first(); tran; tran = tl->next() ) {
+ tran->write(config);
+ }
+
+ // Save info
+ if( _first<0 && _last>=0 ) _first=_last;
config->setGroup( "Account" );
config->writeEntryCrypt( "Password", pw );
config->writeEntry( "Type", t );
config->writeEntry( "Bank", bn );
config->writeEntryCrypt( "Number", a );
config->writeEntryCrypt( "PINNumber", p );
config->writeEntry( "Notes", nt );
+ config->writeEntry( "LastTab", _sLastTab );
QString balstr;
balstr.setNum( sb, 'f', 2 );
config->writeEntry( "Balance", balstr );
+ config->writeEntry( "First", _first );
+ config->writeEntry( "SortOrder", _sSortOrder );
- // Save transactions
- int i = 1;
- for ( TranInfo *tran = tl->first(); tran; tran = tl->next() )
- {
- tran->write( config, i );
- i++;
- }
- config->write();
-
+ config->write();
delete config;
}
-TranInfo *CBInfo::findTransaction( const QString &checknum, const QString &date,
- const QString &desc )
+
+// --- findTransaction --------------------------------------------------------
+TranInfo *CBInfo::findTransaction( const QString &sId )
{
- TranInfo *traninfo = tl->first();
- while ( traninfo )
- {
- if ( traninfo->number() == checknum && traninfo->datestr() == date &&
- traninfo->desc() == desc )
- break;
- traninfo = tl->next();
- }
- return( traninfo );
+ bool bOk;
+ int id=sId.toInt( &bOk );
+ if( !bOk )
+ return(false);
+ TranInfo *traninfo;
+ for(traninfo=tl->first(); traninfo; traninfo=tl->next()) {
+ if( traninfo->id() == id )
+ break;
+ }
+ return(traninfo);
}
void CBInfo::addTransaction( TranInfo *tran )
{
- tl->inSort( tran );
+ tl->append( tran );
calcBalance();
}
void CBInfo::removeTransaction( TranInfo *tran )
{
- tl->remove( tran );
- delete tran;
+ tl->removeRef( tran );
+ delete tran;
calcBalance();
}
+
+// --- loadTransactions -------------------------------------------------------
+// Reads the transactions. Either the old way 1-n or as linked list.
void CBInfo::loadTransactions()
{
TranInfo *tran;
QString trandesc = "";
tl = new TranInfoList();
Config config( fn, Config::File );
-
- for ( int i = 1; trandesc != QString::null; i++ )
- {
- tran = new TranInfo( config, i );
- trandesc = tran->desc();
- if ( trandesc != QString::null )
- {
- tl->inSort( tran );
- }
- else
- {
- delete tran;
- }
- }
-
- calcBalance();
+ int i=_first;
+ bool bOld=false;
+ if( i==-1 ) {
+ i=1;
+ bOld=true;
+ }
+ while( i>=0 ) {
+ _last=i;
+ tran=new TranInfo(config, i);
+ trandesc = tran->desc();
+ if( trandesc==QString::null ) {
+ delete tran;
+ break;
+ }
+ tl->append(tran);
+ i= bOld ? i+1 : tran->getNext();
+ }
+
+ calcBalance();
}
+
+// --- calcBalance ------------------------------------------------------------
void CBInfo::calcBalance()
{
float amount;
b = sb;
for ( TranInfo *tran = tl->first(); tran; tran = tl->next() )
{
b -= tran->fee();
amount = tran->amount();
if ( tran->withdrawal() )
{
amount *= -1;
}
b += amount;
}
}
+
int CBInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 )
{
QString n1 = ((CBInfo *)item1)->name();
QString n2 = ((CBInfo *)item2)->name();
int r = -1;
if ( n1 < n2 )
r = -1;
else if ( n1 == n2 )
r = 0;
else if ( n1 > n2 )
r = 1;
diff --git a/noncore/apps/checkbook/cbinfo.h b/noncore/apps/checkbook/cbinfo.h
index 5e65db2..0b5b818 100644
--- a/noncore/apps/checkbook/cbinfo.h
+++ b/noncore/apps/checkbook/cbinfo.h
@@ -20,24 +20,25 @@
 :     =  ...= . :.=- 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.
*/
#ifndef CBINFO_H
#define CBINFO_H
+#include <qwidget.h>
#include <qlist.h>
#include <qstring.h>
class Config;
class TranInfo;
class TranInfoList;
class CBInfo
{
public:
CBInfo();
CBInfo( const QString &, const QString & );
@@ -54,42 +55,59 @@ class CBInfo
float balance();
void setName( const QString &name ) { n = name; }
void setFilename( const QString &filename ) { fn = filename; }
void setPassword( const QString &password ) { pw = password; }
void setType( const QString &type ) { t = type; }
void setBank( const QString &bank ) { bn = bank; }
void setAccount( const QString &account ) { a = account; }
void setPin( const QString &pin ) { p = pin; }
void setNotes( const QString &notes ) { nt = notes; }
void setStartingBalance( float startbal ) { sb = startbal; }
+ // write
void write();
+ // transactions
TranInfoList *transactions() const { return tl; }
- TranInfo *findTransaction( const QString &, const QString &, const QString & );
- void addTransaction( TranInfo * );
- void removeTransaction( TranInfo * );
+ TranInfo *findTransaction( const QString & );
+ void addTransaction( TranInfo * );
+ void removeTransaction( TranInfo * );
+
+ // lastTab
+ void setLastTab(const QString &sLastTab) { _sLastTab=sLastTab; }
+ QString &getLastTab() { return(_sLastTab); }
+
+ // getNextNumber
+ int getNextNumber() { return( ++_last ); }
+
+ // sortOrder
+ void setSortOrder(const QString &sSortOrder) { _sSortOrder=sSortOrder; }
+ QString &getSortOrder() { return(_sSortOrder); }
private:
QString n;
QString fn;
QString pw;
QString t;
QString bn;
QString a;
QString p;
QString nt;
float sb;
float b;
+ QString _sLastTab;
+ int _first;
+ int _last;
+ QString _sSortOrder;
TranInfoList *tl;
void loadTransactions();
void calcBalance();
};
class CBInfoList : public QList<CBInfo>
{
protected:
int compareItems( QCollection::Item, QCollection::Item );
};
diff --git a/noncore/apps/checkbook/cfg.cpp b/noncore/apps/checkbook/cfg.cpp
new file mode 100644
index 0000000..1e0ec5c
--- a/dev/null
+++ b/noncore/apps/checkbook/cfg.cpp
@@ -0,0 +1,213 @@
+/*
+                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 <stdio.h>
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qwidget.h>
+#include <qpe/resource.h>
+#include <qpe/config.h>
+
+#include "cfg.h"
+
+// --- Cfg --------------------------------------------------------------------
+Cfg::Cfg()
+{
+ _currencySymbol="$";
+ _showLocks=FALSE;
+ _showBalances=FALSE;
+ _pCategories=new CategoryList();
+}
+
+// --- readStringList ---------------------------------------------------------
+// Reads the entries for the control from a configuration file and returns
+// them in a StringList. Later this list can be used to create the control. It
+// is assumed, that the group is already set. Key is used to enumerate the
+// entries.
+void Cfg::readStringList(Config &cfg, const char *sKey, QStringList &lst)
+{
+qDebug( "%s", sKey );
+
+ QString sEntry;
+ int iCount;
+
+ // read count of elements
+ sEntry.sprintf("%s_Count", sKey);
+ iCount=cfg.readNumEntry(sEntry, 0);
+
+ // read entries
+ for(int i=1; i<=iCount; i++) {
+ sEntry.sprintf("%s%d", sKey, i);
+ QString sType=cfg.readEntry(sEntry);
+ if( sType!=NULL )
+ lst.append(sType);
+ }
+}
+
+
+// --- readConfig -------------------------------------------------------------
+// Reads the member data from the given config file. It will also set the group
+// "Config"
+void Cfg::readConfig(Config &config)
+{
+ // set group
+ config.setGroup( "Config" );
+
+ // read scalars
+ _currencySymbol = config.readEntry( "CurrencySymbol", "$" );
+ _showLocks = config.readBoolEntry( "ShowLocks", FALSE );
+ _showBalances = config.readBoolEntry( "ShowBalances", FALSE );
+ _openLastBook = config.readBoolEntry( "OpenLastBook", FALSE );
+ _sLastBook = config.readEntry("LastBook", "");
+ _showLastTab = config.readBoolEntry( "ShowLastTab", FALSE );
+
+ // Account types
+ readStringList(config, "AccType", _AccountTypes);
+ if( _AccountTypes.isEmpty() ) {
+ _AccountTypes+= (const char *)QWidget::tr("Savings");
+ _AccountTypes+= (const char *)QWidget::tr("Checking");
+ _AccountTypes+= (const char *)QWidget::tr("CD");
+ _AccountTypes+= (const char *)QWidget::tr("Money market");
+ _AccountTypes+= (const char *)QWidget::tr("Mutual fund");
+ _AccountTypes+= (const char *)QWidget::tr("Other");
+ writeStringList(config, "AccType", _AccountTypes);
+ config.write();
+ }
+
+ // Read Categories
+ QStringList lst;
+ readStringList(config, "Category", lst);
+ if( lst.isEmpty() ) {
+ QString type=QWidget::tr("Expense");
+ lst += QWidget::tr( "Automobile" )+";"+type;
+ lst += QWidget::tr( "Bills" )+";"+type;
+ lst += QWidget::tr( "CDs" )+";"+type;
+ lst += QWidget::tr( "Clothing" )+";"+type;
+ lst += QWidget::tr( "Computer" )+";"+type;
+ lst += QWidget::tr( "DVDs" )+";"+type;
+ lst += QWidget::tr( "Electronics" )+";"+type;
+ lst += QWidget::tr( "Entertainment" )+";"+type;
+ lst += QWidget::tr( "Food" )+";"+type;
+ lst += QWidget::tr( "Gasoline" )+";"+type;
+ lst += QWidget::tr( "Misc" )+";"+type;
+ lst += QWidget::tr( "Movies" )+";"+type;
+ lst += QWidget::tr( "Rent" )+";"+type;
+ lst += QWidget::tr( "Travel" )+";"+type;
+
+ type=QWidget::tr( "Income" );
+ lst += QWidget::tr( "Work" )+";"+type;
+ lst += QWidget::tr( "Family Member" )+";"+type;
+ lst += QWidget::tr( "Misc. Credit" )+";"+type;
+
+ setCategories(lst);
+ writeStringList(config, "Category", lst);
+ config.write();
+ } else {
+ setCategories(lst);
+ }
+}
+
+
+// --- writeStringList --------------------------------------------------------
+// Writes the entries in the control in a configuration file. It is assumed,
+// that the group is already set. Key is used to enumerate the entries
+void Cfg::writeStringList(Config &cfg, const char *sKey, QStringList &lst)
+{
+ QString sEntry;
+ int iCount=0;
+ QStringList::Iterator itr;
+ for(itr=lst.begin(); itr!=lst.end(); itr++) {
+ sEntry.sprintf("%s%d", sKey, ++iCount);
+ cfg.writeEntry(sEntry, *itr );
+ }
+ sEntry.sprintf("%s_Count", sKey);
+ cfg.writeEntry(sEntry, iCount);
+}
+
+
+// --- writeConfig -----------------------------------------------------------
+// Writes all config data back to the config file. The group will be set to
+// "Config" and the write be commited
+void Cfg::writeConfig(Config &config)
+{
+ // set the group
+ config.setGroup( "Config" );
+
+ // write scalars
+ config.writeEntry( "CurrencySymbol", _currencySymbol );
+ config.writeEntry( "ShowLocks", _showLocks );
+ config.writeEntry( "ShowBalances", _showBalances );
+ config.writeEntry( "OpenLastBook", _openLastBook );
+ config.writeEntry( "LastBook", _sLastBook );
+ config.writeEntry( "ShowLastTab", _showLastTab );
+
+ // write account types
+ writeStringList(config, "AccType", _AccountTypes);
+
+ // write categories
+ QStringList lst=getCategories();
+ writeStringList(config, "Category", lst );
+
+ // commit write
+ config.write();
+}
+
+
+// --- getCategories ----------------------------------------------------------
+QStringList Cfg::getCategories()
+{
+ QStringList ret;
+ for(Category *itr=_pCategories->first(); itr; itr=_pCategories->next() ) {
+ QString sEntry;
+ sEntry.sprintf("%s;%s", (const char *)itr->getName(), (const char *)(itr->isIncome() ? QWidget::tr("Income") : QWidget::tr("Expense")) );
+ ret.append(sEntry);
+ }
+ return(ret);
+}
+
+
+// --- setCategories ----------------------------------------------------------
+void Cfg::setCategories(QStringList &lst)
+{
+ _pCategories->clear();
+ QStringList::Iterator itr;
+ for(itr=lst.begin(); itr!=lst.end(); itr++) {
+ QStringList split=QStringList::split(";", *itr, true);
+ if( split.count()<2 ) continue;
+ bool bIncome= (split[1]==QWidget::tr("Income"));
+ _pCategories->append( new Category(split[0], bIncome) );
+ }
+}
+
+
+// --- CategoryList ------------------------------------------------------------
+CategoryList::CategoryList() : QList<Category>()
+{
+ setAutoDelete(true);
+}
diff --git a/noncore/apps/checkbook/cfg.h b/noncore/apps/checkbook/cfg.h
new file mode 100644
index 0000000..2b69368
--- a/dev/null
+++ b/noncore/apps/checkbook/cfg.h
@@ -0,0 +1,120 @@
+/*
+                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.
+
+*/
+
+#ifndef CFG_H
+#define CFG_H
+
+#include <qstring.h>
+#include <qlist.h>
+#include <qstringlist.h>
+class Config;
+
+// --- Category ---------------------------------------------------------------
+class Category
+{
+ public:
+ // --- Constructor:
+ Category(QString &sName, bool bIncome=false) { _sName=sName; _bIncome=bIncome; }
+
+ // members
+ QString &getName() { return(_sName); }
+ bool isIncome() { return(_bIncome); }
+ void setName(QString &sName) { _sName=sName; }
+ void setIncome(bool bIncome) { _bIncome=bIncome; }
+
+ private:
+ QString _sName;
+ bool _bIncome;
+};
+
+class CategoryList : public QList<Category>
+{
+ public:
+ // --- Constructor
+ CategoryList();
+};
+
+
+// --- Cfg --------------------------------------------------------------------
+class Cfg
+{
+ public:
+ // --- Constructor
+ Cfg();
+
+ // --- members
+ bool getShowLocks() { return(_showLocks); }
+ void setShowLocks(bool n) { _showLocks=n; }
+ bool getShowBalances() { return(_showBalances); }
+ void setShowBalances(bool n) { _showBalances=n; }
+ QString &getCurrencySymbol() { return(_currencySymbol); }
+ void setCurrencySymbol(QString n) {_currencySymbol= n; }
+ void setCurrencySymbol(const char *n) { _currencySymbol=n; }
+ QStringList &getAccountTypes() { return(_AccountTypes); }
+
+ // --- Categories
+ QStringList getCategories();
+ void setCategories(QStringList &lst);
+ CategoryList *getCategoryList() { return(_pCategories); }
+
+ // --- last book
+ void setOpenLastBook(bool openLastBook) { _openLastBook=openLastBook; }
+ bool isOpenLastBook() { return(_openLastBook); }
+ void setLastBook(const QString &lastBook) { _sLastBook=lastBook; }
+ QString &getLastBook() { return(_sLastBook); }
+
+ // --- last tab
+ void setShowLastTab(bool showLastTab) { _showLastTab=showLastTab; }
+ bool isShowLastTab() { return(_showLastTab); }
+
+ // --- reads data from config file
+ void readConfig(Config &cfg);
+
+ // --- writes data to config file
+ void writeConfig(Config &cfg);
+
+ // --- reads list from config file
+ static void readStringList(Config &cfg, const char *sKey, QStringList &lst);
+
+ // --- writes list in configuration file
+ static void writeStringList(Config &cfg, const char *sKey, QStringList &lst);
+
+
+
+ private:
+ QString _currencySymbol;
+ bool _showLocks;
+ bool _showBalances;
+ bool _openLastBook;
+ bool _showLastTab;
+ QString _sLastBook;
+ QStringList _AccountTypes;
+ CategoryList *_pCategories;
+};
+
+#endif
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index 653ee4a..c53e889 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -24,82 +24,98 @@
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "checkbook.h"
#include "cbinfo.h"
#include "transaction.h"
#include "traninfo.h"
#include "graph.h"
#include "graphinfo.h"
#include "password.h"
+#include "mainwindow.h"
+#include "cfg.h"
#include <opie/otabwidget.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
#include <qcheckbox.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
#include <qwhatsthis.h>
-Checkbook::Checkbook( QWidget *parent, CBInfo *i, const QString &symbol )
+#define COL_ID 0
+#define COL_NUM 1
+#define COL_DATE 2
+#define COL_DESC 3
+#define COL_AMOUNT 4
+#define COL_BAL 5
+
+// --- Checkbook --------------------------------------------------------------
+Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg )
: QDialog( parent, 0, TRUE, WStyle_ContextHelp )
{
info = i;
- currencySymbol = symbol;
+ _pCfg=cfg;
+ // Title bar
if ( info->name() != "" )
{
QString tempstr = info->name();
tempstr.append( " - " );
tempstr.append( tr( "Checkbook" ) );
setCaption( tempstr );
}
else
{
setCaption( tr( "New checkbook" ) );
}
+
// Setup layout to make everything pretty
QVBoxLayout *layout = new QVBoxLayout( this );
layout->setMargin( 2 );
layout->setSpacing( 4 );
// Setup tabs for all info
mainWidget = new OTabWidget( this );
layout->addWidget( mainWidget );
-
mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) );
mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) );
mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) );
- mainWidget->setCurrentTab( tr( "Info" ) );
+ if( _pCfg->isShowLastTab() )
+ mainWidget->setCurrentTab( info->getLastTab() );
+ else
+ mainWidget->setCurrentTab( tr( "Info" ) );
+ connect( mainWidget, SIGNAL( currentChanged(QWidget *) ), this, SLOT( slotTab(QWidget *) ) );
// Load checkbook information
loadCheckbook();
}
Checkbook::~Checkbook()
{
}
+// --- initInfo ---------------------------------------------------------------
QWidget *Checkbook::initInfo()
{
- QWidget *control = new QWidget( mainWidget );
+ QWidget *control = new QWidget( mainWidget, tr("Info") );
QVBoxLayout *vb = new QVBoxLayout( control );
QScrollView *sv = new QScrollView( control );
vb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
QGridLayout *layout = new QGridLayout( container );
@@ -119,31 +135,26 @@ QWidget *Checkbook::initInfo()
nameEdit = new QLineEdit( container );
QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) );
connect( nameEdit, SIGNAL( textChanged( const QString & ) ),
this, SLOT( slotNameChanged( const QString & ) ) );
layout->addWidget( nameEdit, 1, 1 );
// Type of account
label = new QLabel( tr( "Type:" ), container );
QWhatsThis::add( label, tr( "Select type of checkbook here." ) );
layout->addWidget( label, 2, 0 );
typeList = new QComboBox( container );
QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) );
- typeList->insertItem( tr( "Savings" ) ); // 0
- typeList->insertItem( tr( "Checking" ) ); // 1
- typeList->insertItem( tr( "CD" ) ); // 2
- typeList->insertItem( tr( "Money market" ) ); // 3
- typeList->insertItem( tr( "Mutual fund" ) ); // 4
- typeList->insertItem( tr( "Other" ) ); // 5
- layout->addWidget( typeList, 2, 1 );
+ typeList->insertStringList( _pCfg->getAccountTypes() );
+ layout->addWidget( typeList, 2, 1 );
// Bank/institution name
label = new QLabel( tr( "Bank:" ), container );
QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) );
layout->addWidget( label, 3, 0 );
bankEdit = new QLineEdit( container );
QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) );
layout->addWidget( bankEdit, 3, 1 );
// Account number
label = new QLabel( tr( "Account number:" ), container );
QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) );
@@ -174,75 +185,96 @@ QWidget *Checkbook::initInfo()
label = new QLabel( tr( "Notes:" ), container );
QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) );
layout->addWidget( label, 7, 0 );
notesEdit = new QMultiLineEdit( container );
QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) );
notesEdit->setMinimumHeight( 25 );
notesEdit->setMaximumHeight( 65 );
layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 );
return control;
}
+
+// --- initTransactions -------------------------------------------------------
QWidget *Checkbook::initTransactions()
{
- QWidget *control = new QWidget( mainWidget );
+ QWidget *control = new QWidget( mainWidget, tr("Transactions") );
QGridLayout *layout = new QGridLayout( control );
layout->setSpacing( 2 );
layout->setMargin( 4 );
- balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ),
- control );
- QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) );
- layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 );
-
- tranTable = new QListView( control );
+ // Sort selector
+ QLabel *label = new QLabel( tr( "Sort by:" ), control );
+ QWhatsThis::add( label, tr( "Select checkbook sorting here." ) );
+ layout->addMultiCellWidget( label, 0, 0, 0, 1 );
+ _cbSortType=new QComboBox( control );
+ _cbSortType->insertItem( tr("Entry Order") );
+ _cbSortType->insertItem( tr("Date") );
+ _cbSortType->insertItem( tr("Number") );
+ layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 );
+ connect( _cbSortType, SIGNAL( activated(const QString &) ), this, SLOT( slotSortChanged( const QString & ) ) );
+
+ // Table
+ tranTable = new QListView( control );
+ QFont fnt(QPEApplication::font());
+ fnt.setPointSize( fnt.pointSize()-1 );
+ tranTable->setFont( fnt );
QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) );
- tranTable->addColumn( tr( "Num" ) );
+ tranTable->addColumn( tr( "Id" ) );
+ tranTable->setColumnWidthMode( COL_ID, QListView::Manual );
+ tranTable->setColumnWidth( COL_ID, 0);
+ tranTable->addColumn( tr( "Num" ) );
tranTable->addColumn( tr( "Date" ) );
//tranTable->addColumn( tr( "Cleared" ) );
tranTable->addColumn( tr( "Description" ) );
- int colnum = tranTable->addColumn( tr( "Amount" ) );
- tranTable->setColumnAlignment( colnum, Qt::AlignRight );
+ int column = tranTable->addColumn( tr( "Amount" ) );
+ tranTable->setColumnAlignment( column, Qt::AlignRight );
+ column=tranTable->addColumn( tr("Balance") );
+ tranTable->setColumnAlignment( column, Qt::AlignRight );
tranTable->setAllColumnsShowFocus( TRUE );
- tranTable->setSorting( 1 );
+ tranTable->setSorting( -1 );
layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 );
QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold );
connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
this, SLOT( slotEditTran() ) );
+ _sortCol=COL_ID;
+ // Buttons
QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control );
QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) );
layout->addWidget( btn, 2, 0 );
btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control );
QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) );
layout->addWidget( btn, 2, 1 );
btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control );
QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) );
layout->addWidget( btn, 2, 2 );
return( control );
}
+
+// --- initCharts -------------------------------------------------------------
QWidget *Checkbook::initCharts()
{
graphInfo = 0x0;
- QWidget *control = new QWidget( mainWidget );
+ QWidget *control = new QWidget( mainWidget, tr("Charts") );
QGridLayout *layout = new QGridLayout( control );
layout->setSpacing( 2 );
layout->setMargin( 4 );
graphWidget = new Graph( control );
QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) );
layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 );
graphList = new QComboBox( control );
QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) );
graphList->insertItem( tr( "Account balance" ) );
@@ -250,91 +282,115 @@ QWidget *Checkbook::initCharts()
graphList->insertItem( tr( "Deposits by category" ) );
layout->addMultiCellWidget( graphList, 1, 1, 0, 1 );
QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control );
QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) );
connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) );
layout->addWidget( btn, 1, 2 );
return control;
}
+// --- loadCheckbook ----------------------------------------------------------
void Checkbook::loadCheckbook()
{
if ( !info )
{
return;
}
tranList = info->transactions();
passwordCB->setChecked( !info->password().isNull() );
nameEdit->setText( info->name() );
QString temptext = info->type();
int i = typeList->count();
while ( i > 0 )
{
i--;
typeList->setCurrentItem( i );
if ( typeList->currentText() == temptext )
{
break;
}
}
+ if( i<=0 ) {
+ typeList->insertItem( temptext, 0 );
+ typeList->setCurrentItem(0);
+ }
bankEdit->setText( info->bank() );
acctNumEdit->setText( info->account() );
pinNumEdit->setText( info->pin() );
temptext.setNum( info->startingBalance(), 'f', 2 );
balanceEdit->setText( temptext );
notesEdit->setText( info->notes() );
// Load transactions
float amount;
- QString stramount;
-
- for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() )
+ QString stramount;
+ for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() )
{
amount = tran->amount();
if ( tran->withdrawal() )
{
amount *= -1;
}
- stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount );
- ( void ) new CBListItem( tranTable, tran->number(), tran->datestr(), tran->desc(), stramount );
+ stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount );
+ ( void ) new CBListItem( tran, tranTable, tran->getIdStr(), tran->number(), tran->datestr(), tran->desc(), stramount );
}
- balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( info->balance(), 0, 'f', 2 ) );
-
- highTranNum = tranList->count();
+ // set sort order
+ bool bOk=false;
+ for(int i=0; i<_cbSortType->count(); i++) {
+ if( _cbSortType->text(i)==info->getSortOrder() ) {
+ _cbSortType->setCurrentItem(i);
+ slotSortChanged( info->getSortOrder() );
+ bOk=true;
+ break;
+ }
+ }
+ if( !bOk ) {
+ _cbSortType->setCurrentItem(0);
+ slotSortChanged( _cbSortType->currentText() );
+ }
+
+ // calc running balance
+ adjustBalance();
}
+// --- adjustBalance ----------------------------------------------------------
void Checkbook::adjustBalance()
{
- balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( info->balance(), 0, 'f', 2 ) );
+ // update running balance in register
+ QString sRunning;
+ float bal=info->startingBalance();
+ for(CBListItem *item=(CBListItem *)tranTable->firstChild(); item; item=(CBListItem *)item->nextSibling() ) {
+ TranInfo *tran=item->getTranInfo();
+ bal=bal + (tran->withdrawal() ? -1 : 1)*tran->amount() - tran->fee();
+ sRunning.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), bal );
+ item->setText( COL_BAL, sRunning);
+ }
}
-TranInfo *Checkbook::findTran( const QString &checknum, const QString &date, const QString &desc )
+// --- resort -----------------------------------------------------------------
+void Checkbook::resort()
{
- TranInfo *traninfo = tranList->first();
- while ( traninfo )
- {
- if ( traninfo->number() == checknum && traninfo->datestr() == date &&
- traninfo->desc() == desc )
- break;
- traninfo = tranList->next();
- }
- return( traninfo );
+ tranTable->setSorting(_sortCol);
+ tranTable->sort();
+ tranTable->setSorting(-1);
}
+
+// --- accept -----------------------------------------------------------------
void Checkbook::accept()
{
info->setName( nameEdit->text() );
info->setType( typeList->currentText() );
info->setBank( bankEdit->text() );
info->setAccount( acctNumEdit->text() );
info->setPin( pinNumEdit->text() );
bool ok;
info->setStartingBalance( balanceEdit->text().toFloat( &ok ) );
info->setNotes( notesEdit->text() );
QDialog::accept();
@@ -389,119 +445,115 @@ void Checkbook::slotNameChanged( const QString &newname )
// TODO - need filedir
// QString namestr = filedir;
// namestr.append( newname );
// namestr.append( ".qcb" );
// info->setFilename( namestr );
QString namestr = newname;
namestr.append( " - " );
namestr.append( tr( "Checkbook" ) );
setCaption( namestr );
}
+
+// ---slotStartingBalanceChanged ----------------------------------------------
void Checkbook::slotStartingBalanceChanged( const QString &newbalance )
{
bool ok;
info->setStartingBalance( newbalance.toFloat( &ok ) );
adjustBalance();
}
+
void Checkbook::slotNewTran()
{
- highTranNum++;
- TranInfo *traninfo = new TranInfo( highTranNum );
+ TranInfo *traninfo = new TranInfo( info->getNextNumber() );
+ if( !_dLastNew.isNull() )
+ traninfo->setDate(_dLastNew);
Transaction *currtran = new Transaction( this, info->name(),
traninfo,
- currencySymbol );
+ _pCfg );
currtran->showMaximized();
if ( currtran->exec() == QDialog::Accepted )
{
// Add to transaction list
info->addTransaction( traninfo );
// Add to transaction table
float amount;
QString stramount;
-
- amount = traninfo->amount();
- if ( traninfo->withdrawal() )
- {
- amount *= -1;
- }
- stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount );
-
- ( void ) new CBListItem( tranTable, traninfo->number(), traninfo->datestr(), traninfo->desc(),
- stramount );
-
+ amount = (traninfo->withdrawal() ? -1 : 1)*traninfo->amount();
+ stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount );
+ ( void ) new CBListItem( traninfo, tranTable, traninfo->getIdStr(),
+ traninfo->number(), traninfo->datestr(), traninfo->desc(),
+ stramount );
+ resort();
adjustBalance();
+
+ // save last date
+ _dLastNew = traninfo->date();
}
else
{
- highTranNum--;
delete traninfo;
}
}
void Checkbook::slotEditTran()
{
QListViewItem *curritem = tranTable->currentItem();
if ( !curritem )
- {
return;
- }
-
- TranInfo *traninfo = info->findTransaction( curritem->text( 0 ), curritem->text( 1 ),
- curritem->text( 2 ) );
+
+ TranInfo *traninfo=info->findTransaction( curritem->text(COL_ID) );
Transaction *currtran = new Transaction( this, info->name(),
traninfo,
- currencySymbol );
+ _pCfg );
currtran->showMaximized();
if ( currtran->exec() == QDialog::Accepted )
{
- curritem->setText( 0, traninfo->number() );
- curritem->setText( 1, traninfo->datestr() );
- curritem->setText( 2, traninfo->desc() );
+ curritem->setText( COL_NUM, traninfo->number() );
+ curritem->setText( COL_DATE, traninfo->datestr() );
+ curritem->setText( COL_DESC, traninfo->desc() );
float amount = traninfo->amount();
if ( traninfo->withdrawal() )
{
amount *= -1;
}
QString stramount;
- stramount.sprintf( "%s%.2f", currencySymbol.latin1(), amount );
- curritem->setText( 3, stramount );
-
- adjustBalance();
+ stramount.sprintf( "%s%.2f", _pCfg->getCurrencySymbol().latin1(), amount );
+ curritem->setText( COL_AMOUNT, stramount );
+ resort();
+ adjustBalance();
}
delete currtran;
}
void Checkbook::slotDeleteTran()
{
QListViewItem *curritem = tranTable->currentItem();
if ( !curritem )
- {
return;
- }
- TranInfo *traninfo = findTran( curritem->text( 0 ), curritem->text( 1 ), curritem->text( 2 ) );
+ TranInfo *traninfo = info->findTransaction( curritem->text(COL_ID) );
if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) )
{
info->removeTransaction( traninfo );
delete curritem;
- adjustBalance();
+ adjustBalance();
}
}
void Checkbook::slotDrawGraph()
{
if ( graphInfo )
{
delete graphInfo;
}
switch ( graphList->currentItem() )
{
@@ -580,29 +632,30 @@ void Checkbook::drawCategoryChart( bool withdrawals )
cat->addToValue( tran->amount() );
}
else
{ // Didn't find category, add category to list
list->append( new DataPointInfo( tran->category(), tran->amount() ) );
}
}
}
graphInfo = new GraphInfo( GraphInfo::PieChart, list );
}
-CBListItem::CBListItem( QListView *parent, QString label1, QString label2,
+CBListItem::CBListItem( TranInfo *pTran, QListView *parent, QString label1, QString label2,
QString label3, QString label4, QString label5, QString label6, QString label7,
QString label8 )
: QListViewItem( parent, label1, label2, label3, label4, label5, label6, label7, label8 )
{
+ _pTran=pTran;
m_known = FALSE;
owner = parent;
}
void CBListItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align )
{
QColorGroup _cg = cg;
const QPixmap *pm = listView()->viewport()->backgroundPixmap();
if ( pm && !pm->isNull() )
{
_cg.setBrush( QColorGroup::Base, QBrush( cg.base(), *pm ) );
p->setBrushOrigin( -listView()->contentsX(), -listView()->contentsY() );
@@ -643,12 +696,35 @@ bool CBListItem::isAltBackground()
while(item)
{
item->m_odd = previous = !previous;
item->m_known = true;
item = (CBListItem *)( item->nextSibling() );
}
}
return m_odd;
}
return false;
}
+
+
+// --- slotTab ----------------------------------------------------------------
+void Checkbook::slotTab(QWidget *tab)
+{
+ if( !tab || !info ) return;
+ info->setLastTab( tab->name() );
+}
+
+
+// --- slotSortChanged ---------------------------------------------------------
+void Checkbook::slotSortChanged( const QString &selc )
+{
+ if( selc==tr("Entry Order") ) {
+ _sortCol=COL_ID;
+ } else if( selc==tr("Number") ) {
+ _sortCol=COL_NUM;
+ } else if( selc==tr("Date") ) {
+ _sortCol=COL_DATE;
+ }
+ info->setSortOrder( selc );
+ resort();
+}
diff --git a/noncore/apps/checkbook/checkbook.h b/noncore/apps/checkbook/checkbook.h
index 4a5011b..1b6a2d3 100644
--- a/noncore/apps/checkbook/checkbook.h
+++ b/noncore/apps/checkbook/checkbook.h
@@ -20,107 +20,123 @@
 :     =  ...= . :.=- 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.
*/
#ifndef CHECKBOOK_H
#define CHECKBOOK_H
+#include <qdatetime.h>
#include <qdialog.h>
#include <qlistview.h>
class OTabWidget;
class CBInfo;
class Graph;
class GraphInfo;
class QCheckBox;
class QComboBox;
class QLabel;
class QLineEdit;
class QListView;
class QMultiLineEdit;
class QString;
class TranInfo;
class TranInfoList;
+class Cfg;
+
+// --- Checkbook --------------------------------------------------------------
class Checkbook : public QDialog
{
Q_OBJECT
public:
- Checkbook( QWidget * = 0x0, CBInfo * = 0x0, const QString & = "$" );
+ Checkbook( QWidget *, CBInfo *, Cfg *cfg );
~Checkbook();
+ // resort
+ void resort();
+
private:
- CBInfo *info;
+ CBInfo *info;
TranInfoList *tranList;
- QString currencySymbol;
- int highTranNum;
+ Cfg *_pCfg;
OTabWidget *mainWidget;
void loadCheckbook();
void adjustBalance();
- TranInfo *findTran( const QString &, const QString &, const QString & );
// Info tab
QWidget *initInfo();
QCheckBox *passwordCB;
QLineEdit *nameEdit;
QComboBox *typeList;
QLineEdit *bankEdit;
QLineEdit *acctNumEdit;
QLineEdit *pinNumEdit;
QLineEdit *balanceEdit;
QMultiLineEdit *notesEdit;
+ int _sortCol;
// Transactions tab
- QWidget *initTransactions();
+ QWidget *initTransactions();
QListView *tranTable;
- QLabel *balanceLabel;
+ QComboBox *_cbSortType;
+ QDate _dLastNew;
// Charts tab
QWidget *initCharts();
GraphInfo *graphInfo;
QComboBox *graphList;
Graph *graphWidget;
void drawBalanceChart();
void drawCategoryChart( bool = TRUE );
+
protected slots:
void accept();
+ void slotTab(QWidget *tab);
private slots:
void slotPasswordClicked();
void slotNameChanged( const QString & );
void slotStartingBalanceChanged( const QString & );
void slotNewTran();
void slotEditTran();
void slotDeleteTran();
void slotDrawGraph();
+ void slotSortChanged( const QString & );
};
+// --- CBListItem -------------------------------------------------------------
class CBListItem : public QListViewItem
{
//Q_OBJECT
public:
- CBListItem( QListView *, QString = QString::null, QString = QString::null,
+ CBListItem( TranInfo *, QListView *, QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null, QString = QString::null );
void paintCell( QPainter *, const QColorGroup &, int, int, int );
+ // --- members
+ TranInfo *getTranInfo() { return(_pTran); }
+
private:
+ TranInfo *_pTran;
QListView *owner;
bool m_known;
bool m_odd;
bool isAltBackground();
};
+
#endif
diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro
index 9a16a56..c574aff 100644
--- a/noncore/apps/checkbook/checkbook.pro
+++ b/noncore/apps/checkbook/checkbook.pro
@@ -1,38 +1,42 @@
-TEMPLATE = app
-CONFIG = qt warn_on release
+CONFIG = qt warn_on release quick-app
HEADERS = mainwindow.h \
cbinfo.h \
traninfo.h \
graphinfo.h \
configuration.h \
password.h \
checkbook.h \
transaction.h \
+ tabledef.h \
+ listedit.h \
+ cfg.h \
graph.h
SOURCES = main.cpp \
mainwindow.cpp \
cbinfo.cpp \
traninfo.cpp \
graphinfo.cpp \
configuration.cpp \
password.cpp \
checkbook.cpp \
- transaction.cpp \
+ transaction.cpp \
+ tabledef.cpp \
+ listedit.cpp \
+ cfg.cpp \
graph.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
TARGET = checkbook
-DESTDIR = $(OPIEDIR)/bin
TRANSLATIONS = ../../../i18n/de/checkbook.ts \
../../../i18n/nl/checkbook.ts \
../../../i18n/da/checkbook.ts \
../../../i18n/xx/checkbook.ts \
../../../i18n/en/checkbook.ts \
../../../i18n/es/checkbook.ts \
../../../i18n/fr/checkbook.ts \
../../../i18n/hu/checkbook.ts \
../../../i18n/ja/checkbook.ts \
../../../i18n/ko/checkbook.ts \
../../../i18n/no/checkbook.ts \
diff --git a/noncore/apps/checkbook/configuration.cpp b/noncore/apps/checkbook/configuration.cpp
index 7731cf3..3f5662d 100644
--- a/noncore/apps/checkbook/configuration.cpp
+++ b/noncore/apps/checkbook/configuration.cpp
@@ -18,57 +18,144 @@
..}^=.=       =       ; 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 "configuration.h"
+#include "mainwindow.h"
+#include "listedit.h"
+#include "tabledef.h"
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qwhatsthis.h>
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qtabwidget.h>
+#include <qpe/resource.h>
-Configuration::Configuration( QWidget *parent, const QString &cs, bool sl, bool sb )
+Configuration::Configuration( QWidget *parent, Cfg &cfg )
: QDialog( parent, 0, TRUE, WStyle_ContextHelp )
{
setCaption( tr( "Configure Checkbook" ) );
- QFontMetrics fm = fontMetrics();
+ // Setup layout to make everything pretty
+ QVBoxLayout *layout = new QVBoxLayout( this );
+ layout->setMargin( 2 );
+ layout->setSpacing( 4 );
+
+ // Setup tabs for all info
+ _mainWidget = new QTabWidget( this );
+ layout->addWidget( _mainWidget );
+
+ // Settings tab
+ _mainWidget->addTab( initSettings(cfg), tr( "&Settings" ) );
+
+ // Account Types tab
+ ColumnDef *d;
+ _listEditTypes=new ListEdit(_mainWidget, "TYPES" );
+ d=new ColumnDef( tr("Type"), (ColumnDef::ColumnType)(ColumnDef::typeString | ColumnDef::typeUnique), tr("New Account Type"));
+ _listEditTypes->addColumnDef( d );
+ _listEditTypes->addData( cfg.getAccountTypes() );
+ _mainWidget->addTab( _listEditTypes, tr( "&Account Types" ) );
+
+ // Categories tab
+ _listEditCategories=new ListEdit(_mainWidget, "CATEGORIES" );
+ _listEditCategories->addColumnDef( new ColumnDef( tr("Category"), (ColumnDef::ColumnType)(ColumnDef::typeString | ColumnDef::typeUnique), tr("New Category")) );
+ d=new ColumnDef( tr("Type"), ColumnDef::typeList, tr("Expense") );
+ d->addColumnValue( tr("Expense") );
+ d->addColumnValue( tr("Income") );
+ _listEditCategories->addColumnDef( d );
+ QStringList lst=cfg.getCategories();
+ _listEditCategories->addData( lst );
+ _mainWidget->addTab( _listEditCategories, tr( "&Categories" ) );
+}
+
+Configuration::~Configuration()
+{
+}
+
+// ---- initSettings ----------------------------------------------------------
+QWidget *Configuration::initSettings(Cfg &cfg)
+{
+ QWidget *control = new QWidget( _mainWidget );
+
+ QFontMetrics fm = fontMetrics();
int fh = fm.height();
- QGridLayout *layout = new QGridLayout( this );
+ QVBoxLayout *vb = new QVBoxLayout( control );
+
+ QScrollView *sv = new QScrollView( control );
+ vb->addWidget( sv, 0, 0 );
+ sv->setResizePolicy( QScrollView::AutoOneFit );
+ sv->setFrameStyle( QFrame::NoFrame );
+
+ QWidget *container = new QWidget( sv->viewport() );
+ sv->addChild( container );
+
+ QGridLayout *layout = new QGridLayout( container );
layout->setSpacing( 4 );
layout->setMargin( 4 );
- QLabel *label = new QLabel( tr( "Enter currency symbol:" ), this );
+ QLabel *label = new QLabel( tr( "Enter currency symbol:" ), container );
QWhatsThis::add( label, tr( "Enter your local currency symbol here." ) );
label->setMaximumHeight( fh + 3 );
layout->addWidget( label, 0, 0 );
- symbolEdit = new QLineEdit( cs, this );
+ symbolEdit = new QLineEdit( cfg.getCurrencySymbol(), container );
QWhatsThis::add( symbolEdit, tr( "Enter your local currency symbol here." ) );
symbolEdit->setMaximumHeight( fh + 5 );
symbolEdit->setFocus();
layout->addWidget( symbolEdit, 0, 1 );
- lockCB = new QCheckBox( tr( "Show whether checkbook is password\nprotected" ), this );
+ lockCB = new QCheckBox( tr( "Show whether checkbook is password\nprotected" ), container );
QWhatsThis::add( lockCB, tr( "Click here to select whether or not the main window will display that the checkbook is protected with a password." ) );
- lockCB->setChecked( sl );
+ lockCB->setChecked( cfg.getShowLocks() );
layout->addMultiCellWidget( lockCB, 1, 1, 0, 1 );
- balCB = new QCheckBox( tr( "Show checkbook balances" ), this );
+ balCB = new QCheckBox( tr( "Show checkbook balances" ), container );
QWhatsThis::add( balCB, tr( "Click here to select whether or not the main window will display the current balance for each checkbook." ) );
balCB->setMaximumHeight( fh + 5 );
- balCB->setChecked( sb );
+ balCB->setChecked( cfg.getShowBalances() );
layout->addMultiCellWidget( balCB, 2, 2, 0, 1 );
+
+ openLastBookCB = new QCheckBox( tr("Open last checkbook" ), container );
+ QWhatsThis::add( openLastBookCB, tr("Click here to select whether the last open checkbook will be opened at startup.") );
+ openLastBookCB->setMaximumHeight(fh+5);
+ openLastBookCB->setChecked( cfg.isOpenLastBook() );
+ layout->addMultiCellWidget( openLastBookCB, 3, 3, 0, 1 );
+
+ lastTabCB = new QCheckBox( tr("Show last checkbook tab" ), container );
+ QWhatsThis::add( lastTabCB, tr("Click here to select whether the last tab in a checkbook should be displayed.") );
+ lastTabCB->setMaximumHeight(fh+5);
+ lastTabCB->setChecked( cfg.isShowLastTab() );
+ layout->addMultiCellWidget( lastTabCB, 4, 4, 0, 1 );
+
+ return(control);
}
-Configuration::~Configuration()
+// --- saveConfig -------------------------------------------------------------
+void Configuration::saveConfig(Cfg &cfg)
{
+ // Settings
+ cfg.setCurrencySymbol( symbolEdit->text() );
+ cfg.setShowLocks( lockCB->isChecked() );
+ cfg.setShowBalances( balCB->isChecked() );
+ cfg.setOpenLastBook( openLastBookCB->isChecked() );
+ cfg.setShowLastTab( lastTabCB->isChecked() );
+
+ // Typelist
+ _listEditTypes->storeInList( cfg.getAccountTypes() );
+
+ // Category list
+ QStringList lst;
+ _listEditCategories->storeInList( lst );
+ cfg.setCategories( lst );
}
diff --git a/noncore/apps/checkbook/configuration.h b/noncore/apps/checkbook/configuration.h
index 9a8de02..5893502 100644
--- a/noncore/apps/checkbook/configuration.h
+++ b/noncore/apps/checkbook/configuration.h
@@ -21,31 +21,47 @@
 -.   .:....=;==+<; 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.
*/
#ifndef CONFIGURATION_H
#define CONFIGURATION_H
#include <qdialog.h>
+#include "cfg.h"
class QCheckBox;
class QLineEdit;
class QString;
+class QTabWidget;
+class ListEdit;
class Configuration : public QDialog
{
Q_OBJECT
public:
- Configuration( QWidget * = 0x0, const QString & = "$", bool = FALSE, bool = FALSE );
+ // Constructor
+ Configuration( QWidget *, Cfg &cfg);
~Configuration();
QLineEdit *symbolEdit;
QCheckBox *lockCB;
QCheckBox *balCB;
+ QCheckBox *openLastBookCB;
+ QCheckBox *lastTabCB;
+ QTabWidget *_mainWidget;
+ ListEdit *_listEditTypes;
+ ListEdit *_listEditCategories;
+
+ // saves settings in config struct
+ void saveConfig(Cfg &cfg);
+
+ protected:
+ // creates settings tap from configuration
+ QWidget *initSettings(Cfg &cfg);
};
#endif
diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp
new file mode 100644
index 0000000..99a6531
--- a/dev/null
+++ b/noncore/apps/checkbook/listedit.cpp
@@ -0,0 +1,340 @@
+/*
+                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 "listedit.h"
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qlistview.h>
+#include <qwidgetstack.h>
+#include <qcombobox.h>
+#include <qpushbutton.h>
+#include <qpe/resource.h>
+
+
+// --- ListEdit ---------------------------------------------------------------
+ListEdit::ListEdit( QWidget *parent, const char *sName )
+ : QWidget(parent, sName), TableDef(sName)
+{
+ // get font height
+ int fh = fontMetrics().height();
+
+ // create layout
+ QGridLayout *layout=new QGridLayout(this);
+ layout->setSpacing( 2 );
+ layout->setMargin( 4 );
+
+ // type table
+ _typeTable = new QListView( this );
+ ColumnDef *def=first();
+ while( def ) {
+ _typeTable->addColumn( def->getName() );
+ def=next();
+ }
+ connect( _typeTable, SIGNAL( clicked(QListViewItem *, const QPoint &, int) ), this, SLOT( slotClick(QListViewItem *, const QPoint &, int ) ) );
+ layout->addMultiCellWidget(_typeTable, 0,4,0,4);
+ _currentItem=NULL;
+
+ // edit field
+ _stack=new QWidgetStack( this );
+ _stack->setMaximumHeight(fh+5);
+ layout->addMultiCellWidget(_stack, 5,5,0,2);
+ _typeEdit = new QLineEdit( _stack );
+ _stack->raiseWidget(_typeEdit );
+ connect( _typeEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( slotEditChanged(const QString &) ) );
+
+ // combo box
+ _box=new QComboBox( _stack );
+ connect( _box, SIGNAL( activated(const QString &) ), this, SLOT( slotActivated(const QString &) ) );
+
+
+ // add button
+ QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this );
+ connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) );
+ layout->addWidget( btn, 5, 3 );
+
+ // delete button
+ btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this );
+ connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) );
+ layout->addWidget( btn, 5, 4 );
+}
+
+// --- ~ListEdit --------------------------------------------------------------
+ListEdit::~ListEdit()
+{
+}
+
+
+// --- slotEditTypeChanged ----------------------------------------------------
+void ListEdit::slotEditChanged(const QString &str)
+{
+ if( !_currentItem || _currentColumn<0 ) return;
+ _currentItem->setText(_currentColumn, str);
+}
+
+// --- slotAddType ------------------------------------------------------------
+void ListEdit::slotAdd()
+{
+ // construct new row
+ QString args[8];
+ ColumnDef *pCol=this->first();
+ int i=0;
+ while( pCol && i<8 ) {
+ args[i++]=pCol->getNewValue();
+ pCol=this->next();
+ }
+ _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] );
+
+ // fix uniques
+ fixTypes();
+
+ // display col 0 of new value
+ QPoint pnt;
+ slotClick(_currentItem, pnt, 0);
+ _typeTable->setSelected( _currentItem, true );
+}
+
+// --- slotDel -------------------------------------------------------------
+void ListEdit::slotDel()
+{
+ if( !_currentItem ) return;
+ delete _currentItem;
+ _currentItem=NULL;
+ _typeEdit->setText("");
+ _stack->raiseWidget(_typeEdit);
+}
+
+
+// --- fixTypes ----------------------------------------------------------------
+// Makes sure all entries have a unique name and empty entries are replaced
+// by a generic string. The first version performs the operation on a particular
+// column, whereas the 2nd does it for all unique columns.
+class ColMap {
+ public:
+ ColMap(QString sValue, QListViewItem *pEntry) {
+ _sValue=sValue;
+ _pEntry=pEntry;
+ }
+ QString &getValue() { return(_sValue); }
+ QListViewItem *getItem() { return(_pEntry); }
+
+ protected:
+ QString _sValue;
+ QListViewItem *_pEntry;
+};
+
+class ColList : public QList<QString>
+{
+ public:
+ ColList() : QList<QString>() { }
+
+ protected:
+ int compareItems(QCollection::Item, QCollection::Item);
+};
+
+int ColList::compareItems(QCollection::Item i1, QCollection::Item i2) {
+ return( ((QString *)i1)->compare(*(QString *)i2) );
+}
+
+void ListEdit::fixTypes(int iColumn)
+{
+ // get column def
+ ColumnDef *pDef=this->at(iColumn);
+
+ // create map of entries
+ if( !_typeTable->childCount() ) return;
+ ColMap **colMap=new (ColMap *)[_typeTable->childCount()];
+ QListViewItem *cur=_typeTable->firstChild();
+ ColList lst;
+ for(int i=0; i<_typeTable->childCount(); i++) {
+ colMap[i]=new ColMap(cur->text(iColumn), cur);
+ lst.append( &(colMap[i]->getValue()) );
+ cur=cur->nextSibling();
+ }
+
+ // fix empty entries
+ int i=0;
+ for(QString *ptr=lst.first(); ptr; ptr=lst.next()) {
+ *ptr=ptr->stripWhiteSpace();
+ if( ptr->isEmpty() ) {
+ i++;
+ if( i==1 ) *ptr=pDef->getNewValue();
+ else ptr->sprintf("%s %d", (const char *)pDef->getNewValue(), i);
+ }
+ }
+
+ // fix dups
+ lst.sort();
+ QString repl;
+ for(uint iCur=0; iCur<lst.count()-1; iCur++) {
+ QString *current=lst.at(iCur);
+ for(uint iNext=iCur+1; iNext<lst.count(); iNext++ ) {
+ if( *current!=*lst.at(iNext) ) continue;
+ for(int i=2; ; i++) {
+ repl.sprintf("%s %d", (const char *)*current, i);
+ bool bDup=false;
+ uint iChk=iNext+1;
+ while( iChk<lst.count() ) {
+ QString *chk=lst.at(iChk);
+ if( !chk->startsWith(*current) ) break;
+ if( *chk==repl ) {
+ bDup=true;
+ break;
+ }
+ iChk++;
+ }
+ if( !bDup ) {
+ *lst.at(iNext)=repl;
+ break;
+ }
+ }
+ }
+ }
+ lst.sort();
+
+ // copy back clean up col map
+ for(int i=0; i<_typeTable->childCount(); i++) {
+ colMap[i]->getItem()->setText(iColumn, colMap[i]->getValue());
+ delete colMap[i];
+ }
+ delete colMap;
+}
+
+void ListEdit::fixTypes()
+{
+ int i;
+ ColumnDef *pDef;
+ for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) {
+ if( pDef->hasFlag(ColumnDef::typeUnique) )
+ fixTypes(i);
+ }
+ _typeTable->sort();
+}
+
+
+// --- storeInList ------------------------------------------------------------
+void ListEdit::storeInList(QStringList &lst)
+{
+ // delete old content
+ lst.clear();
+
+ // add new one
+ fixTypes();
+ QListViewItem *itm=_typeTable->firstChild();
+ while( itm ) {
+ int i=0;
+ QString sAdd;
+ ColumnDef *pDef;
+ for(pDef=this->first(), i=0; pDef; pDef=this->next(), i++) {
+ if( i>=1 ) sAdd+=";";
+ sAdd += itm->text(i);
+ }
+ lst.append( sAdd );
+ itm=itm->nextSibling();
+ }
+}
+
+
+// --- slotClicked ------------------------------------------------------------
+void ListEdit::slotClick(QListViewItem *itm, const QPoint &pnt, int col)
+{
+ (void)pnt; // get rid of unused warning;
+
+ // save values
+ _currentItem=itm;
+ _currentColumn=col;
+ if( itm==NULL ) {
+ _typeEdit->setText("");
+ _stack->raiseWidget(_typeEdit);
+ return;
+ }
+
+ // display value
+ if( _currentColumn<0 ) _currentColumn=0;
+ ColumnDef *pDef=this->at(_currentColumn);
+ if( pDef->isType(ColumnDef::typeString) ) {
+ _typeEdit->setText( _currentItem->text(_currentColumn) );
+ _stack->raiseWidget(_typeEdit);
+ } else if( pDef->isType(ColumnDef::typeList) ){
+ _box->clear();
+ _box->insertStringList( pDef->getValueList() );
+ QStringList::Iterator itr;
+ int i=0;
+ for(itr=pDef->getValueList().begin(); itr!=pDef->getValueList().end(); itr++) {
+ if( (*itr)==_currentItem->text(_currentColumn) ) {
+ _box->setCurrentItem(i);
+ i=-1;
+ break;
+ }
+ i++;
+ }
+ if( i>=0 ) {
+ _box->insertItem( _currentItem->text(_currentColumn) );
+ _box->setCurrentItem(i);
+ }
+ _stack->raiseWidget(_box);
+ } else {
+ qDebug( "Unsupported column type for column %s", (const char *)pDef->getName() );
+ _typeEdit->setText("");
+ _stack->raiseWidget(_typeEdit);
+ }
+}
+
+
+// --- addColumnDef -----------------------------------------------------------
+void ListEdit::addColumnDef(ColumnDef *pDef)
+{
+ _typeTable->addColumn( pDef->getName() );
+ _vColumns.append(pDef);
+}
+
+// --- addData ----------------------------------------------------------------
+void ListEdit::addData(QStringList &lst)
+{
+ // run through list
+ QStringList::Iterator itr;
+ for(itr=lst.begin(); itr!=lst.end(); itr++) {
+ QStringList split=QStringList::split(";", *itr, true);
+ QStringList::Iterator entry;
+ QString args[8];
+ int i=0;
+ for(entry=split.begin(); entry!=split.end() && i<8; entry++, i++) {
+ args[i]= (*entry);
+ }
+ while(i<8) {
+ args[i++]="";
+ }
+ new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
+ }
+}
+
+// --- slotActivated ----------------------------------------------------------
+void ListEdit::slotActivated(const QString &str)
+{
+ if( _currentItem==NULL || _currentColumn<0 ) return;
+ _currentItem->setText(_currentColumn, str);
+}
diff --git a/noncore/apps/checkbook/listedit.h b/noncore/apps/checkbook/listedit.h
new file mode 100644
index 0000000..d2135ea
--- a/dev/null
+++ b/noncore/apps/checkbook/listedit.h
@@ -0,0 +1,78 @@
+/*
+                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.
+
+*/
+
+#ifndef LISTEDIT_H
+#define LISTEDIT_H
+
+#include <qwidget.h>
+#include "tabledef.h"
+class QListView;
+class QLineEdit;
+class QListViewItem;
+class QPoint;
+class QWidgetStack;
+class QComboBox;
+
+class ListEdit : public QWidget, public TableDef
+{
+ Q_OBJECT
+
+ public:
+ ListEdit( QWidget *, const char *sName);
+ virtual ~ListEdit();
+
+ QListView *_typeTable;
+ QLineEdit *_typeEdit;
+ QWidgetStack *_stack;
+ QComboBox *_box;
+ QListViewItem *_currentItem;
+ int _currentColumn;
+
+ // resolves dups and empty entries
+ void fixTypes();
+ void fixTypes(int iColumn);
+
+ // stores content in string list
+ void storeInList(QStringList &lst);
+
+ // adds a column definition
+ virtual void addColumnDef(ColumnDef *pDef);
+
+ // adds data to table
+ void addData(QStringList &lst);
+
+
+ public slots:
+ void slotClick(QListViewItem *, const QPoint &pnt, int col);
+ void slotEditChanged(const QString &);
+ void slotAdd();
+ void slotDel();
+ void slotActivated(const QString &);
+};
+
+#endif
diff --git a/noncore/apps/checkbook/main.cpp b/noncore/apps/checkbook/main.cpp
index abfa633..dcaab4a 100644
--- a/noncore/apps/checkbook/main.cpp
+++ b/noncore/apps/checkbook/main.cpp
@@ -17,26 +17,18 @@
  _.=:.       :    :=>`: 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 <qpe/qpeapplication.h>
+#include <opie/oapplicationfactory.h>
-int main(int argc, char **argv)
-{
- QPEApplication app(argc, argv);
-
- MainWindow *cb = new MainWindow();
- app.setMainWidget(cb);
- cb->showMaximized();
+#include "mainwindow.h"
- return app.exec();
-}
+OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index 6d1d7b9..8d64cad 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -22,53 +22,54 @@
  -_. . .   )=.  = 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()
- : QMainWindow( 0x0, 0x0, WStyle_ContextHelp )
+
+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" );
- config.setGroup( "Config" );
- currencySymbol = config.readEntry( "CurrencySymbol", "$" );
- showLocks = config.readBoolEntry( "ShowLocks", FALSE );
- showBalances = config.readBoolEntry( "ShowBalances", FALSE );
+qDebug( "Reading config" );
+ _cfg.readConfig( config );
+
// Build menu and tool bars
setToolBarsMovable( FALSE );
QPEToolBar *bar = new QPEToolBar( this );
bar->setHorizontalStretchable( TRUE );
QPEMenuBar *mb = new QPEMenuBar( 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 );
@@ -116,220 +117,244 @@ MainWindow::MainWindow()
{
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()
{
-// config.write();
+ writeConfig();
}
+
+// --- buildList --------------------------------------------------------------
void MainWindow::buildList()
{
if ( cbList )
- {
- delete cbList;
- }
+ delete cbList;
cbList = new QListView( this );
QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) );
- if ( showLocks )
+ if ( _cfg.getShowLocks() )
{
cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 );
posName = 1;
}
else
{
posName = 0;
}
cbList->addColumn( tr( "Checkbook Name" ) );
- if ( showBalances )
+ 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 ( showLocks && !cb->password().isNull() )
+ if ( _cfg.getShowLocks() && !cb->password().isNull() )
{
lvi->setPixmap( 0, lockIcon );
}
lvi->setText( posName, cb->name() );
- if ( showBalances )
+ if ( _cfg.getShowBalances() )
{
QString balance;
- balance.sprintf( "%s%.2f", currencySymbol.latin1(), cb->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, currencySymbol );
+ 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;
- }
- QString currname = curritem->text( posName );
+ openBook( curritem );
+}
- CBInfo *cb = checkbooks->first();
- while ( cb )
- {
+
+// --- 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;
- }
+ if ( !cb ) return;
+ //
buildFilename( currname );
float currbalance = cb->balance();
bool currlock = !cb->password().isNull();
if ( currlock )
{
Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) );
if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() )
{
delete pw;
return;
}
delete pw;
}
- Checkbook *currcb = new Checkbook( this, cb, currencySymbol );
+ _cfg.setLastBook( currname );
+ Checkbook *currcb = new Checkbook( this, cb, &_cfg );
currcb->showMaximized();
if ( currcb->exec() == QDialog::Accepted )
{
QString newname = cb->name();
if ( currname != newname )
{
// Update name if changed
- curritem->setText( posName, newname );
- cbList->sort();
+ if( curritem ) {
+ curritem->setText( posName, newname );
+ cbList->sort();
+ }
+ _cfg.setLastBook( newname );
// Remove old file
QFile f( tempFilename );
if ( f.exists() )
- {
f.remove();
- }
// Get new filename
buildFilename( newname );
cb->setFilename( tempFilename );
}
cb->write();
// Update lock if changed
- if ( showLocks && !cb->password().isNull() != currlock )
+ if ( _cfg.getShowLocks() && !cb->password().isNull() != currlock )
{
if ( !cb->password().isNull() )
curritem->setPixmap( 0, lockIcon );
else
curritem->setPixmap( 0, nullIcon );
}
// Update balance if changed
- if ( showBalances && cb->balance() != currbalance )
+ if ( _cfg.getShowBalances() && cb->balance() != currbalance )
{
QString tempstr;
- tempstr.sprintf( "%s%.2f", currencySymbol.latin1(), cb->balance() );
+ tempstr.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() );
curritem->setText( posName + 1, tempstr );
}
}
delete currcb;
}
+// --- slotDelete -------------------------------------------------------------
void MainWindow::slotDelete()
{
QString currname = cbList->currentItem()->text( posName );
if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), currname ) )
{
buildFilename( currname );
QFile f( tempFilename );
if ( f.exists() )
{
f.remove();
}
delete cbList->currentItem();
}
}
+// --- slotConfigure ----------------------------------------------------------
void MainWindow::slotConfigure()
{
- Configuration *cfgdlg = new Configuration( this, currencySymbol, showLocks, showBalances );
+ Configuration *cfgdlg = new Configuration( this, _cfg );
cfgdlg->showMaximized();
if ( cfgdlg->exec() == QDialog::Accepted )
{
- currencySymbol = cfgdlg->symbolEdit->text();
- showLocks = cfgdlg->lockCB->isChecked();
- showBalances = cfgdlg->balCB->isChecked();
-
- Config config( "checkbook" );
- config.setGroup( "Config" );
- config.writeEntry( "CurrencySymbol", currencySymbol );
- config.writeEntry( "ShowLocks", showLocks );
- config.writeEntry( "ShowBalances", showBalances );
- config.write();
-
+ // read data from config dialog & save it
+ cfgdlg->saveConfig( _cfg );
+ writeConfig();
buildList();
}
delete cfgdlg;
}
+
+
+// --- writeConfig --------------------------------------------------------------
+void MainWindow::writeConfig()
+{
+ Config config("checkbook");
+ _cfg.writeConfig( config );
+}
diff --git a/noncore/apps/checkbook/mainwindow.h b/noncore/apps/checkbook/mainwindow.h
index 2bc70b3..6275f94 100644
--- a/noncore/apps/checkbook/mainwindow.h
+++ b/noncore/apps/checkbook/mainwindow.h
@@ -22,48 +22,55 @@
  -_. . .   )=.  = see the file COPYING. If not, write to the
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <qmainwindow.h>
#include <qpixmap.h>
+#include "cfg.h"
class CBInfo;
class CBInfoList;
class QAction;
class QListView;
class QString;
+class QListViewItem;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
- MainWindow();
+ MainWindow(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~MainWindow();
+ static QString appName() { return QString::fromLatin1("checkbook"); };
+
+ // safe config
+ void writeConfig();
+
+ // open a check book
+ void openBook(QListViewItem *curr);
private:
QListView *cbList;
QString cbDir;
QAction *actionOpen;
QAction *actionDelete;
- QString currencySymbol;
- bool showLocks;
- bool showBalances;
+ Cfg _cfg;
int posName;
CBInfoList *checkbooks;
QString tempFilename;
QPixmap lockIcon;
QPixmap nullIcon;
void buildList();
void addCheckbook( CBInfo * );
void buildFilename( const QString & );
private slots:
diff --git a/noncore/apps/checkbook/tabledef.cpp b/noncore/apps/checkbook/tabledef.cpp
new file mode 100644
index 0000000..13edded
--- a/dev/null
+++ b/noncore/apps/checkbook/tabledef.cpp
@@ -0,0 +1,76 @@
+/*
+                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 "tabledef.h"
+
+#include <qstring.h>
+#include <qpe/resource.h>
+
+// --- ColumnDef --------------------------------------------------------------
+ColumnDef::ColumnDef(const char *sName, ColumnType type, const char *sNewValue)
+{
+ _sName=sName;
+ _type=type;
+ _sNewValue=sNewValue;
+}
+
+
+// --- addColumnValue ---------------------------------------------------------
+void ColumnDef::addColumnValue(const QString &sValue)
+{
+ if( (_type & 0x00ffffff) !=typeList )
+ qDebug("Column %s is not a list", (const char *)_sName);
+ else
+ _valueList.append(sValue);
+}
+void ColumnDef::addColumnValue(const char *sValue)
+{
+ if( (_type & 0x00ffffff)!=typeList )
+ qDebug("Column %s is not a list", (const char *)_sName);
+ else
+ _valueList.append(sValue);
+}
+
+// --- TableDef ---------------------------------------------------------------
+TableDef::TableDef(const char *sName)
+{
+ _sName=sName;
+ _vColumns.setAutoDelete(TRUE);
+}
+
+
+// --- ~TableDef --------------------------------------------------------------
+TableDef::~TableDef()
+{
+}
+
+// --- addColumnDef -----------------------------------------------------------
+void TableDef::addColumnDef(ColumnDef *pDef)
+{
+ _vColumns.append(pDef);
+}
diff --git a/noncore/apps/checkbook/tabledef.h b/noncore/apps/checkbook/tabledef.h
new file mode 100644
index 0000000..5891ad7
--- a/dev/null
+++ b/noncore/apps/checkbook/tabledef.h
@@ -0,0 +1,99 @@
+/*
+                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.
+
+*/
+
+#ifndef TABLEDEF_H
+#define TABLEDEF_H
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qlist.h>
+
+
+
+// --- ColumnDef -------------------------------------------------------------
+class ColumnDef
+{
+ public:
+ enum ColumnType {
+ typeString=0x1,
+ typeList=0x2,
+ typeUnique=0x80000000
+ };
+
+ // Constructor
+ ColumnDef(const char *sName, ColumnType type, const char *sNewValue);
+
+ // add column value
+ void addColumnValue(const QString &Value);
+ void addColumnValue(const char *sValue);
+
+ // member functions
+ const QString getName() { return(_sName); }
+ const QString getNewValue() { return(_sNewValue); }
+
+ // test for type
+ int isType(ColumnType x) { return( (_type & 0x00ffffff)==x ); }
+ int hasFlag(ColumnType x) { return( (_type & x) ); }
+
+ // get value list
+ QStringList &getValueList() { return(_valueList); }
+
+ private:
+ QString _sName;
+ QString _sNewValue;
+ enum ColumnType _type;
+ QStringList _valueList;
+};
+
+typedef QList<ColumnDef> ColumnDefList;
+
+
+// --- TableDef ---------------------------------------------------------------
+class TableDef
+{
+ public:
+ // Constructor & Destructor
+ TableDef(const char *sName);
+ virtual ~TableDef();
+
+ // adds a column definition
+ virtual void addColumnDef(ColumnDef *pDef);
+
+ // movement operators
+ ColumnDef *first() { return(_vColumns.first() ); }
+ ColumnDef *last() { return(_vColumns.last() ); }
+ ColumnDef *next() { return(_vColumns.next() ); }
+ ColumnDef *prev() { return(_vColumns.prev() ); }
+ ColumnDef *at(int i) { return(_vColumns.at(i)); }
+
+ protected:
+ QString _sName;
+ ColumnDefList _vColumns;
+};
+
+#endif
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp
index 65c190c..d880bb4 100644
--- a/noncore/apps/checkbook/traninfo.cpp
+++ b/noncore/apps/checkbook/traninfo.cpp
@@ -25,36 +25,37 @@
Boston, MA 02111-1307, USA.
*/
#include "traninfo.h"
#include <qpe/config.h>
QString tempstr;
TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal,
const QString &type, const QString &category, float amount,
- float fee, const QString &number, const QString &notes )
+ float fee, const QString &number, const QString &notes, int next )
{
i = id;
d = desc;
td = date;
w = withdrawal;
t = type;
c = category;
a = amount;
f = fee;
cn = number;
n = notes;
+ _next=next;
}
TranInfo::TranInfo( Config config, int entry )
{
config.setGroup( QString::number( entry ) );
QString desc = config.readEntry( "Description", "Not Found" );
if ( desc != "Not Found" )
{
// ID
i = entry;
// Description
@@ -102,50 +103,55 @@ TranInfo::TranInfo( Config config, int entry )
// Category
c = config.readEntry( "Category", "" );
// Transaction amount
QString stramount = config.readEntry( "Amount", "0.00" );
bool ok;
a = stramount.toFloat( &ok );
// Transaction fee
stramount = config.readEntry( "TransactionFee", "0.00" );
f = stramount.toFloat( &ok );
- // Transaction number
+ // Transaction number
cn = config.readEntry( "CheckNumber", "" );
// Notes
n = config.readEntry( "Comments", "" );
+
+ // next
+ _next = config.readNumEntry("Next", -1);
}
}
+// --- datestr ----------------------------------------------------------------
const QString &TranInfo::datestr()
{
- tempstr = QString::number( td.year() );
- tempstr.append( '/' );
- int tempfield = td.month();
- if ( tempfield < 10 ) tempstr.append( '0' );
- tempstr.append( QString::number( tempfield ) );
- tempstr.append( '/' );
- tempfield = td.day();
- if ( tempfield < 10 ) tempstr.append( '0' );
- tempstr.append( QString::number( tempfield ) );
+ int y=td.year();
+ y= y>=2000 && y<=2099 ? y-2000 : y;
+ tempstr.sprintf( "%02d/%02d/%02d", y ,td.month(), td.day() );
+ return( tempstr );
+}
- return( tempstr );
+// --- getIdStr ---------------------------------------------------------------
+const QString &TranInfo::getIdStr()
+{
+ tempstr.sprintf("%04d", i);
+ return( tempstr );
}
-void TranInfo::write( Config *config, int entry )
+// --- write ------------------------------------------------------------------
+void TranInfo::write( Config *config )
{
- config->setGroup( QString::number( entry ) );
+ config->setGroup( QString::number( id() ) );
config->writeEntry( "Description", d );
tempstr = QString::number( td.month() );
tempstr.append( '/' );
tempstr.append( QString::number( td.day() ) );
tempstr.append( '/' );
tempstr.append( QString::number( td.year() ) );
config->writeEntry( "Date", tempstr );
w ? tempstr = "true"
: tempstr = "false";
@@ -160,31 +166,47 @@ void TranInfo::write( Config *config, int entry )
else if ( t == "Credit Card" || t == "Cash" )
tempstr = "3";
config->writeEntry( "Type", tempstr );
config->writeEntry( "Category", c );
tempstr.setNum( a, 'f', 2 );
config->writeEntry( "Amount", tempstr );
tempstr.setNum( f, 'f', 2 );
config->writeEntry( "TransactionFee", tempstr );
- config->writeEntry( "CheckNumber", cn );
-
+ config->writeEntry( "CheckNumber", cn );
config->writeEntry( "Comments", n );
+ config->writeEntry( "Next", _next );
}
+
int TranInfoList::compareItems( QCollection::Item item1, QCollection::Item item2 )
{
QDate d1 = ((TranInfo *)item1)->date();
QDate d2 = ((TranInfo *)item2)->date();
int r = -1;
if ( d1 < d2 )
r = -1;
else if ( d1 == d2 )
r = 0;
else if ( d1 > d2 )
r = 1;
return( r );
}
+
+// --- toString ---------------------------------------------------------------
+QString TranInfo::toString()
+{
+ QString ret;
+ ret.sprintf("(%4d) %10s %4s %-10s %5.2f %5.2f",
+ id(),
+ (const char *)datestr(),
+ (const char *)number(),
+ (const char *)desc(),
+ (withdrawal() ? -1 : 1) * amount(),
+ fee()
+ );
+ return(ret);
+}
diff --git a/noncore/apps/checkbook/traninfo.h b/noncore/apps/checkbook/traninfo.h
index f6c5cae..0abdc61 100644
--- a/noncore/apps/checkbook/traninfo.h
+++ b/noncore/apps/checkbook/traninfo.h
@@ -31,59 +31,70 @@
#include <qdatetime.h>
#include <qlist.h>
class Config;
class TranInfo
{
public:
TranInfo( int = 0, const QString & = 0x0, const QDate & = QDate::currentDate(),
bool = TRUE, const QString & = 0x0, const QString & = 0x0,
float = 0.0, float = 0.0,
- const QString & = 0x0, const QString & = 0x0 );
+ const QString & = 0x0, const QString & = 0x0, int =-1 );
TranInfo( Config, int );
+ // getters
int id() const { return i; }
+ const QString &getIdStr();
+
const QString &desc() const { return d; }
const QDate &date() const { return td; }
const QString &datestr();
bool withdrawal() const { return w; }
const QString &type() const { return t; }
const QString &category() const { return c; }
float amount() const { return a; }
float fee() const { return f; }
const QString &number() const { return cn; }
const QString &notes() const { return n; }
+ int getNext() { return(_next); }
- void setDesc( const QString &desc ) { d = desc; }
+ // setters
+ void setDesc( const QString &desc ) { d = desc; }
void setDate( const QDate &date ) { td = date; }
void setWithdrawal( bool withdrawal ) { w = withdrawal; }
void setType( const QString &type ) { t = type; }
void setCategory( const QString &cat ) { c = cat; }
void setAmount( float amount ) { a = amount; }
void setFee( float fee ) { f = fee; }
void setNumber( const QString &num ) { cn = num; }
void setNotes( const QString &notes ) { n = notes; }
+ void setNext(int next) { _next=next; }
+
+ // write
+ void write( Config * );
- void write( Config *, int );
+ // toString
+ QString toString();
private:
int i;
QString d;
QDate td;
bool w;
QString t;
QString c;
float a;
float f;
QString cn;
QString n;
+ int _next;
};
class TranInfoList : public QList<TranInfo>
{
protected:
int compareItems( QCollection::Item, QCollection::Item );
};
#endif
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp
index c94b989..138d0e6 100644
--- a/noncore/apps/checkbook/transaction.cpp
+++ b/noncore/apps/checkbook/transaction.cpp
@@ -19,46 +19,47 @@
++=   -.     .`     .:
 :     =  ...= . :.=- 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 "transaction.h"
#include "traninfo.h"
+#include "cfg.h"
#include <qpe/datebookmonth.h>
#include <qbuttongroup.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qradiobutton.h>
#include <qwhatsthis.h>
Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info,
- const QString &symbol )
+ Cfg *pCfg )
: QDialog( parent, 0, TRUE, WStyle_ContextHelp )
{
QString tempstr = tr( "Transaction for " );
tempstr.append( acctname );
setCaption( tempstr );
tran = info;
- currencySymbol = symbol;
+ _pCfg=pCfg;
QVBoxLayout *vb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
vb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
QGridLayout *layout = new QGridLayout( container );
@@ -214,60 +215,55 @@ Transaction::~Transaction()
void Transaction::accept()
{
tran->setDesc( descEdit->text() );
tran->setDate( datePicker->selectedDate() );
tran->setWithdrawal( withBtn->isChecked() );
tran->setType( typeList->currentText() );
tran->setCategory( catList->currentText() );
bool ok;
tran->setAmount( amtEdit->text().toFloat( &ok ) );
tran->setFee( feeEdit->text().toFloat( &ok ) );
tran->setNumber( numEdit->text() );
tran->setNotes( noteEdit->text() );
-
+
QDialog::accept();
}
void Transaction::slotWithdrawalClicked()
{
catList->clear();
- catList->insertItem( tr( "Automobile" ) );
- catList->insertItem( tr( "Bills" ) );
- catList->insertItem( tr( "CDs" ) );
- catList->insertItem( tr( "Clothing" ) );
- catList->insertItem( tr( "Computer" ) );
- catList->insertItem( tr( "DVDs" ) );
- catList->insertItem( tr( "Electronics" ) );
- catList->insertItem( tr( "Entertainment" ) );
- catList->insertItem( tr( "Food" ) );
- catList->insertItem( tr( "Gasoline" ) );
- catList->insertItem( tr( "Misc" ) );
- catList->insertItem( tr( "Movies" ) );
- catList->insertItem( tr( "Rent" ) );
- catList->insertItem( tr( "Travel" ) );
- catList->setCurrentItem( 0 );
+ CategoryList *pCatList=_pCfg->getCategoryList();
+ for(Category *pCat=pCatList->first(); pCat; pCat=pCatList->next()) {
+ if( !pCat->isIncome() )
+ catList->insertItem( pCat->getName() );
+ }
+ catList->setCurrentItem(0);
+
typeList->clear();
typeList->insertItem( tr( "Debit Charge" ) );
typeList->insertItem( tr( "Written Check" ) );
typeList->insertItem( tr( "Transfer" ) );
typeList->insertItem( tr( "Credit Card" ) );
}
void Transaction::slotDepositClicked()
{
catList->clear();
- catList->insertItem( tr( "Work" ) );
- catList->insertItem( tr( "Family Member" ) );
- catList->insertItem( tr( "Misc. Credit" ) );
- catList->setCurrentItem( 0 );
+ CategoryList *pCatList=_pCfg->getCategoryList();
+ for(Category *pCat=pCatList->first(); pCat; pCat=pCatList->next()) {
+ if( pCat->isIncome() )
+ catList->insertItem( pCat->getName() );
+ }
+ catList->setCurrentItem( 0 );
+
typeList->clear();
typeList->insertItem( tr( "Written Check" ) );
typeList->insertItem( tr( "Automatic Payment" ) );
typeList->insertItem( tr( "Transfer" ) );
typeList->insertItem( tr( "Cash" ) );
}
void Transaction::slotDateChanged( int y, int m, int d )
{
QDate date;
date.setYMD( y, m, d );
dateBtn->setText( TimeString::shortDate( date ) );
diff --git a/noncore/apps/checkbook/transaction.h b/noncore/apps/checkbook/transaction.h
index 000aee7..fbe9cd3 100644
--- a/noncore/apps/checkbook/transaction.h
+++ b/noncore/apps/checkbook/transaction.h
@@ -31,38 +31,38 @@
#include <qdialog.h>
class DateBookMonth;
class QComboBox;
class QLineEdit;
class QMultiLineEdit;
class QPushButton;
class QRadioButton;
class QString;
class QWidget;
class TranInfo;
+class Cfg;
class Transaction : public QDialog
{
Q_OBJECT
public:
- Transaction( QWidget * = 0x0, const QString & = 0x0, TranInfo * = 0x0,
- const QString & = "$" );
+ Transaction( QWidget *, const QString &, TranInfo *, Cfg *);
~Transaction();
private:
TranInfo *tran;
- QString currencySymbol;
+ Cfg *_pCfg;
QRadioButton *withBtn;
QRadioButton *depBtn;
QPushButton *dateBtn;
DateBookMonth *datePicker;
QLineEdit *numEdit;
QLineEdit *descEdit;
QComboBox *catList;
QComboBox *typeList;
QLineEdit *amtEdit;
QLineEdit *feeEdit;
QMultiLineEdit *noteEdit;
diff --git a/noncore/apps/odict/main.cpp b/noncore/apps/odict/main.cpp
index c68253f..0642022 100644
--- a/noncore/apps/odict/main.cpp
+++ b/noncore/apps/odict/main.cpp
@@ -8,22 +8,17 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include <qpe/qpeapplication.h>
+#include <opie/oapplicationfactory.h>
#include "odict.h"
-int main(int argc, char **argv)
-{
- QPEApplication app(argc, argv);
- ODict *odict= new ODict();
- app.setMainWidget(odict);
- odict->showMaximized();
- return app.exec();
-}
+
+OPIE_EXPORT_APP( OApplicationFactory<ODict> )
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp
index 010545e..9718c5c 100644
--- a/noncore/apps/odict/odict.cpp
+++ b/noncore/apps/odict/odict.cpp
@@ -27,68 +27,68 @@
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qmainwindow.h>
#include <qstring.h>
#include <qaction.h>
#include <qtextbrowser.h>
#include <qcombobox.h>
#include <qpe/resource.h>
#include <qpe/config.h>
-ODict::ODict() : QMainWindow()
+ODict::ODict(QWidget* parent, const char* name, WFlags fl ) : QMainWindow(parent, name, fl )
{
activated_name = QString::null;
-
+
vbox = new QVBox( this );
setCaption( tr( "Opie-Dictionary" ) );
setupMenus();
QHBox *hbox = new QHBox( vbox );
- QLabel* query_label = new QLabel( tr( "Query:" ) , hbox );
+ QLabel* query_label = new QLabel( tr( "Query:" ) , hbox );
query_label->show();
query_le = new QLineEdit( hbox );
query_co = new QComboBox( hbox );
connect( query_co , SIGNAL( activated(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) );
ok_button = new QPushButton( tr( "&Ok" ), hbox );
connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) );
-
+
top_name = new QLabel( vbox );
top_name->setAlignment( AlignHCenter );
browser_top = new QTextBrowser( vbox );
bottom_name = new QLabel( vbox );
bottom_name->setAlignment( AlignHCenter );
browser_bottom = new QTextBrowser( vbox );
ding = new DingWidget();
loadConfig();
setCentralWidget( vbox );
}
void ODict::loadConfig()
{
/*
* the name of the last used dictionary
*/
QString lastname;
-
+
Config cfg ( "odict" );
cfg.setGroup( "generalsettings" );
casesens = cfg.readEntry( "casesens" ).toInt();
QString lastDict = cfg.readEntry( "lastdict" );
int i = 0, e = 0;
-
+
QStringList groupListCfg = cfg.groupList().grep( "Method_" );
query_co->clear();
for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it )
{
QString name;
cfg.setGroup( *it );
name = cfg.readEntry( "Name" );
query_co->insertItem( name );
/*
* this check is to look up what dictionary has been used the
* last time
@@ -108,65 +108,65 @@ void ODict::loadConfig()
ding->loadDict( lastname );
ding->loadValues();
query_co->setCurrentItem( e );
top_name->setText( top_name_content );
bottom_name->setText( bottom_name_content );
}
void ODict::lookupLanguageNames( QString dictname )
{
Config cfg ( "odict" );
cfg.setGroup( "Method_"+dictname );
- top_name_content = cfg.readEntry( "Lang1" );
- bottom_name_content = cfg.readEntry( "Lang2" );
+ top_name_content = cfg.readEntry( "Lang1" );
+ bottom_name_content = cfg.readEntry( "Lang2" );
}
void ODict::saveConfig()
{
Config cfg ( "odict" );
cfg.setGroup( "generalsettings" );
cfg.writeEntry( "casesens" , casesens );
cfg.writeEntry( "lastdict" , query_co->currentText() );
}
void ODict::slotStartQuery()
{
QString querystring = query_le->text();
if ( !querystring.isEmpty() )
{
/*
* if the user has not yet defined a dictionary
*/
if ( !query_co->currentText() )
{
switch ( QMessageBox::information( this, tr( "OPIE-Dictionary" ),
tr( "No dictionary defined" ),
- tr( "&Define one" ),
+ tr( "&Define one" ),
tr( "&Cancel" ),
0, // Define a dict
1 ) ) // Cancel choosen
- {
+ {
case 0:
slotSettings();
break;
case 1: // stop here
return;
}
- }
+ }
/*
* ok, the user has defined a dict
*/
- ding->setCaseSensitive( casesens );
+ ding->setCaseSensitive( casesens );
BroswerContent test = ding->setText( querystring );
browser_top->setText( test.top );
browser_bottom->setText( test.bottom );
}
}
void ODict::slotSettings()
{
ConfigDlg dlg( this, "Config" , true);
if ( dlg.exec() == QDialog::Accepted )
@@ -180,41 +180,41 @@ void ODict::slotSetParameter( int count )
if ( casesens )
casesens = false;
else
casesens = true;
}
saveConfig();
}
void ODict::slotMethodChanged( const QString& methodnumber )
{
activated_name = methodnumber;
-
+
if ( activated_name != ding->loadedDict() )
{
ding->loadDict(activated_name);
-
+
lookupLanguageNames( activated_name );
top_name->setText( top_name_content );
bottom_name->setText( bottom_name_content );
}
}
void ODict::setupMenus()
{
menu = new QMenuBar( this );
-
+
settings = new QPopupMenu( menu );
setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
setting_a->addTo( settings );
setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 );
-
+
parameter = new QPopupMenu( menu );
connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) );
parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 );
parameter->insertSeparator();
-
+
menu->insertItem( tr( "Settings" ) , settings );
menu->insertItem( tr( "Parameter" ) , parameter );
}
diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h
index be2a532..68a8f95 100644
--- a/noncore/apps/odict/odict.h
+++ b/noncore/apps/odict/odict.h
@@ -20,30 +20,30 @@ class QAction;
class QVBoxLayout;
class QActionGroup;
class DingWidget;
class QTextBrowser;
class QComboBox;
class DingWidget;
class ODict : public QMainWindow
{
Q_OBJECT
public:
- ODict();
+ ODict(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
QVBox *vbox;
QTextBrowser *browser_top,
*browser_bottom;
DingWidget *ding;
-
+ static QString appName() { return QString::fromLatin1("odict"); }
private:
QPopupMenu *help, *settings, *parameter;
QMenuBar *menu;
QHBox *hbox;
QLineEdit *query_le;
QComboBox *query_co;
QPushButton *ok_button;
QVBoxLayout *vbox_layout;
QAction *setting_a, *setting_b;
diff --git a/noncore/apps/odict/odict.pro b/noncore/apps/odict/odict.pro
index 82f6a41..4ad287b 100644
--- a/noncore/apps/odict/odict.pro
+++ b/noncore/apps/odict/odict.pro
@@ -1,30 +1,27 @@
-TEMPLATE = app
-CONFIG = qt warn_on debug
-#CONFIG = qt warn_on release
+CONFIG = qt warn_on release quick-app
HEADERS = odict.h \
searchmethoddlg.h \
configdlg.h \
dingwidget.h
SOURCES = main.cpp \
odict.cpp \
searchmethoddlg.cpp \
configdlg.cpp \
dingwidget.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lstdc++ -lopie
TARGET = odict
-DESTDIR = $(OPIEDIR)/bin
TRANSLATIONS = ../../../i18n/de/odict.ts \
../../../i18n/nl/odict.ts \
../../../i18n/xx/odict.ts \
../../../i18n/en/odict.ts \
../../../i18n/es/odict.ts \
../../../i18n/fr/odict.ts \
../../../i18n/hu/odict.ts \
../../../i18n/ja/odict.ts \
../../../i18n/ko/odict.ts \
../../../i18n/no/odict.ts \
../../../i18n/pl/odict.ts \
diff --git a/noncore/apps/opie-console/opie-console.control b/noncore/apps/opie-console/opie-console.control
index 3934fa1..504de85 100644
--- a/noncore/apps/opie-console/opie-console.control
+++ b/noncore/apps/opie-console/opie-console.control
@@ -1,11 +1,11 @@
Package: opie-console
-Files: plugins/application/libopie-console.so* bin/opie-console apps/Applications/opie-console.desktop pics/console/*
+Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/*
Priority: optional
Section: opie/applications
Maintainer: Opie team <opie@handhelds.org>
Architecture: arm
Version: 0.6-$SUB_VERSION
Depends: qpe-base, libopie1, opie-console-help-en, lrzsz, opie-keytabs
License: GPL
Description: Opie terminal app
diff --git a/noncore/apps/opie-reader/opie-reader.pro b/noncore/apps/opie-reader/opie-reader.pro
index 62113c3..686f083 100644
--- a/noncore/apps/opie-reader/opie-reader.pro
+++ b/noncore/apps/opie-reader/opie-reader.pro
@@ -1,13 +1,12 @@
-TEMPLATE = app
CONFIG = qt warn_on release
HEADERS = Aportis.h \
Bkmks.h \
BuffDoc.h \
CAnnoEdit.h \
CBuffer.h \
CDrawBuffer.h \
CEncoding.h \
CEncoding_tables.h \
CExpander.h \
CFilter.h \
CloseDialog.h \
@@ -72,22 +71,22 @@ SOURCES = Aportis.cpp \
arith_d.cpp \
fileBrowser.cpp \
infowin.cpp \
main.cpp \
pdb.cpp \
plucker.cpp \
plucker_base.cpp \
ppm.cpp \
ppm_expander.cpp \
version.cpp \
ztxt.cpp
-INTERFACES =
-DESTDIR = $(OPIEDIR)/bin
+DESTDIR = $(OPIEDIR)/bin
+TARGET = reader
+
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-TARGET = reader
LIBS += -lqpe
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/opie-sheet/main.cpp b/noncore/apps/opie-sheet/main.cpp
index e42b4a5..d0a2995 100644
--- a/noncore/apps/opie-sheet/main.cpp
+++ b/noncore/apps/opie-sheet/main.cpp
@@ -7,22 +7,16 @@
* *
***************************************************************************/
/*
* Opie Sheet (formerly Sheet/Qt)
* by Serdar Ozler <sozler@sitebest.com>
*/
#include <qpe/qpeapplication.h>
#include "mainwindow.h"
-int main(int argc, char **argv)
-{
- QPEApplication application(argc, argv);
+#include <opie/oapplicationfactory.h>
- MainWindow windowMain;
- windowMain.setHelpFile(application.qpeDir()+"/help/html/"+QString(argv[0])+".html");
- application.showMainDocumentWidget(&windowMain);
+OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
- return application.exec();
-}
diff --git a/noncore/apps/opie-sheet/mainwindow.cpp b/noncore/apps/opie-sheet/mainwindow.cpp
index 43e5131..3915e52 100644
--- a/noncore/apps/opie-sheet/mainwindow.cpp
+++ b/noncore/apps/opie-sheet/mainwindow.cpp
@@ -34,26 +34,26 @@
#include "func-divide.xpm"
#include "func-paran-open.xpm"
#include "func-paran-close.xpm"
#include "func-comma.xpm"
#include "func-func.xpm"
#include "func-equal.xpm"
#include "cell-select.xpm"
#define DEFAULT_NUM_ROWS 199
#define DEFAULT_NUM_COLS (26*3)
#define DEFAULT_NUM_SHEETS 3
-MainWindow::MainWindow()
- :QMainWindow()
+MainWindow::MainWindow(QWidget *parent, const char* n, WFlags fl)
+ :QMainWindow(parent, n, fl)
{
// initialize variables
documentModified=FALSE;
// construct objects
currentDoc=0;
fileSelector=new FileSelector("application/sheet-qt", this, QString::null);
connect(fileSelector, SIGNAL(closeMe()), this, SLOT(selectorHide()));
connect(fileSelector, SIGNAL(newSelected(const DocLnk &)), this, SLOT(selectorFileNew(const DocLnk &)));
connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), this, SLOT(selectorFileOpen(const DocLnk &)));
listSheets.setAutoDelete(TRUE);
diff --git a/noncore/apps/opie-sheet/mainwindow.h b/noncore/apps/opie-sheet/mainwindow.h
index 10d6650..370d82e 100644
--- a/noncore/apps/opie-sheet/mainwindow.h
+++ b/noncore/apps/opie-sheet/mainwindow.h
@@ -111,22 +111,23 @@ class MainWindow: public QMainWindow
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:
- MainWindow();
+ 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/opie-sheet/opie-sheet.pro b/noncore/apps/opie-sheet/opie-sheet.pro
index 1435af6..acd5fa0 100644
--- a/noncore/apps/opie-sheet/opie-sheet.pro
+++ b/noncore/apps/opie-sheet/opie-sheet.pro
@@ -1,15 +1,13 @@
-TEMPLATE = app
-CONFIG = qt warn_on release
-DESTDIR = $(OPIEDIR)/bin
+CONFIG = qt warn_on release quick-app
HEADERS = mainwindow.h sheet.h cellformat.h finddlg.h numberdlg.h sortdlg.h textdlg.h
SOURCES = main.cpp mainwindow.cpp sheet.cpp cellformat.cpp finddlg.cpp numberdlg.cpp sortdlg.cpp textdlg.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
TARGET = sheetqt
TRANSLATIONS = ../../../i18n/de/sheetqt.ts \
../../../i18n/nl/sheetqt.ts \
../../../i18n/da/sheetqt.ts \
../../../i18n/xx/sheetqt.ts \
../../../i18n/en/sheetqt.ts \
diff --git a/noncore/apps/opie-write/main.cpp b/noncore/apps/opie-write/main.cpp
index 027af38..2cdfa55 100644
--- a/noncore/apps/opie-write/main.cpp
+++ b/noncore/apps/opie-write/main.cpp
@@ -11,27 +11,18 @@
** THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
** PURPOSE.
**
** email sales@trolltech.com for information about Qtopia License
** Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qpe/qpeapplication.h>
-#include <qpe/fileselector.h>
+#include <opie/oapplicationfactory.h>
#include "mainwindow.h"
-int main( int argc, char ** argv )
-{
- QPEApplication a( argc, argv );
+OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
- MainWindow e;
- a.showMainDocumentWidget(&e);
- QObject::connect( &a, SIGNAL( lastWindowClosed() ),
- &a, SLOT( quit() ) );
-
- a.exec();
-}
diff --git a/noncore/apps/opie-write/mainwindow.cpp b/noncore/apps/opie-write/mainwindow.cpp
index 4a49abf..6bb524f 100644
--- a/noncore/apps/opie-write/mainwindow.cpp
+++ b/noncore/apps/opie-write/mainwindow.cpp
@@ -91,26 +91,26 @@ protected:
virtual void drawButtonLabel( QPainter *p ) {
p->translate( -4, 0 );
QToolButton::drawButtonLabel( p );
p->translate( 4, 0 );
}
private:
int current;
};
//===========================================================================
-MainWindow::MainWindow( QWidget *parent, const char *name )
- : QMainWindow( parent, name ),
+MainWindow::MainWindow( QWidget *parent, const char *name, WFlags fl )
+ : QMainWindow( parent, name, fl ),
doc( 0 )
{
setRightJustification(TRUE);
editorStack = new QWidgetStack( this );
fileSelector = new FileSelector( "text/html",
editorStack, "fileselector" );
fileSelector->setCloseVisible( FALSE );
editorStack->addWidget( fileSelector, 0 );
diff --git a/noncore/apps/opie-write/mainwindow.h b/noncore/apps/opie-write/mainwindow.h
index 565ad05..17713d8 100644
--- a/noncore/apps/opie-write/mainwindow.h
+++ b/noncore/apps/opie-write/mainwindow.h
@@ -36,27 +36,29 @@ class ButtonMenu;
namespace Qt3 {
class QTextEdit;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
- MainWindow( QWidget *parent = 0, const char *name = 0 );
+ MainWindow( QWidget *parent = 0, const char *name = 0 , WFlags fl = 0);
~MainWindow();
+ static QString appName() { return QString::fromLatin1("opie-write"); }
+
protected:
void closeEvent( QCloseEvent *e );
private slots:
// new file functions
void fileOpen();
void fileRevert();
void fileNew();
void editUndo();
void editRedo();
void editCut();
diff --git a/noncore/apps/opie-write/opie-write.pro b/noncore/apps/opie-write/opie-write.pro
index 21a3c3a..bbaacd3 100644
--- a/noncore/apps/opie-write/opie-write.pro
+++ b/noncore/apps/opie-write/opie-write.pro
@@ -1,46 +1,27 @@
-TEMPLATE = app
-CONFIG += qt warn_on release
-DESTDIR = $(OPIEDIR)/bin
+CONFIG += qt warn on release quick-app
+
HEADERS = qcleanuphandler.h \
qcomplextext_p.h \
qrichtext_p.h \
qstylesheet.h \
qtextedit.h \
mainwindow.h
SOURCES = qcomplextext.cpp \
qstylesheet.cpp \
qrichtext_p.cpp \
qrichtext.cpp \
qtextedit.cpp \
main.cpp \
mainwindow.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
TARGET = opie-write
-TRANSLATIONS = ../../../i18n/de/opie-write.ts \
- ../../../i18n/nl/opie-write.ts \
- ../../../i18n/da/opie-write.ts \
- ../../../i18n/xx/opie-write.ts \
- ../../../i18n/en/opie-write.ts \
- ../../../i18n/es/opie-write.ts \
- ../../../i18n/fr/opie-write.ts \
- ../../../i18n/hu/opie-write.ts \
- ../../../i18n/ja/opie-write.ts \
- ../../../i18n/ko/opie-write.ts \
- ../../../i18n/no/opie-write.ts \
- ../../../i18n/pl/opie-write.ts \
- ../../../i18n/pt/opie-write.ts \
- ../../../i18n/pt_BR/opie-write.ts \
- ../../../i18n/sl/opie-write.ts \
- ../../../i18n/zh_CN/opie-write.ts \
- ../../../i18n/zh_TW/opie-write.ts
-
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/oxygen/main.cpp b/noncore/apps/oxygen/main.cpp
index c8fcdb4..ac992aa 100644
--- a/noncore/apps/oxygen/main.cpp
+++ b/noncore/apps/oxygen/main.cpp
@@ -8,22 +8,17 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include <qpe/qpeapplication.h>
+#include <opie/oapplicationfactory.h>
#include "oxygen.h"
-int main(int argc, char **argv)
-{
- QPEApplication app(argc, argv);
- Oxygen *oxi = new Oxygen();
- app.setMainWidget(oxi);
- oxi->showMaximized();
- return app.exec();
-}
+
+OPIE_EXPORT_APP( OApplicationFactory<Oxygen> )
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp
index 5999cb0..5bdc2aa 100644
--- a/noncore/apps/oxygen/oxygen.cpp
+++ b/noncore/apps/oxygen/oxygen.cpp
@@ -16,33 +16,33 @@
**************************************************************************/
#include "oxygen.h"
#include <qapplication.h>
#include <qtabwidget.h>
#include "calcdlg.h"
#include "calcdlgui.h"
#include "datawidgetui.h"
#include "psewidget.h"
-Oxygen::Oxygen() : QMainWindow()
+Oxygen::Oxygen( QWidget *parent, const char *name, WFlags f) : QMainWindow( parent, name, f )
{
loadNames();
calcDlgUI *CalcDlgUI = new calcDlgUI();
PSEWidget *pse = new PSEWidget(names);
dataWidgetUI *DataWidgetUI = new dataWidgetUI(names);
-
+
setCaption( tr( "Oxygen" ) );
-
+
QTabWidget *tabw = new QTabWidget( this , "qtab" );
tabw->addTab( pse, tr( "PSE" ));
tabw->addTab( DataWidgetUI , tr( "Data" ) );
tabw->addTab( CalcDlgUI, tr( "Calculations" ) );
setCentralWidget( tabw );
}
void Oxygen::loadNames()
{
names.clear();
names.append( tr("Hydrogen") );
names.append( tr("Helium") );
diff --git a/noncore/apps/oxygen/oxygen.h b/noncore/apps/oxygen/oxygen.h
index 57fe9fe..c59662d 100644
--- a/noncore/apps/oxygen/oxygen.h
+++ b/noncore/apps/oxygen/oxygen.h
@@ -4,21 +4,22 @@
* 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. *
* *
**************************************************************************/
class QStringList;
#include <qmainwindow.h>
class Oxygen : public QMainWindow
{
- Q_OBJECT
+ Q_OBJECT
- public:
- Oxygen();
-
- private:
- void loadNames();
- QStringList names;
+ public:
+ Oxygen(QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+ static QString appName() { return QString::fromLatin1("oxygen"); }
+
+ private:
+ void loadNames();
+ QStringList names;
};
diff --git a/noncore/apps/oxygen/oxygen.pro b/noncore/apps/oxygen/oxygen.pro
index a41bf7b..71d4dac 100644
--- a/noncore/apps/oxygen/oxygen.pro
+++ b/noncore/apps/oxygen/oxygen.pro
@@ -1,49 +1,27 @@
-TEMPLATE = app
-CONFIG = qt warn_on release
+CONFIG = qt warn_on release quick-app
HEADERS = oxygen.h \
kmolcalc.h \
kmolelements.h \
calcdlgui.h \
dataTable.h \
psewidget.h \
oxyframe.h \
datawidgetui.h
SOURCES = main.cpp \
oxygen.cpp \
kmolcalc.cpp \
calcdlgui.cpp \
kmolelements.cpp \
dataTable.cpp \
psewidget.cpp \
oxyframe.cpp \
datawidgetui.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lstdc++
+LIBS += -lqpe
INTERFACES = calcdlg.ui
-TARGET = oxygen
-DESTDIR = $(OPIEDIR)/bin
-
-TRANSLATIONS = ../../../i18n/de/oxygen.ts \
- ../../../i18n/nl/oxygen.ts \
- ../../../i18n/xx/oxygen.ts \
- ../../../i18n/en/oxygen.ts \
- ../../../i18n/es/oxygen.ts \
- ../../../i18n/fr/oxygen.ts \
- ../../../i18n/hu/oxygen.ts \
- ../../../i18n/ja/oxygen.ts \
- ../../../i18n/ko/oxygen.ts \
- ../../../i18n/no/oxygen.ts \
- ../../../i18n/pl/oxygen.ts \
- ../../../i18n/pt/oxygen.ts \
- ../../../i18n/pt_BR/oxygen.ts \
- ../../../i18n/sl/oxygen.ts \
- ../../../i18n/zh_CN/oxygen.ts \
- ../../../i18n/zh_TW/oxygen.ts \
- ../../../i18n/it/oxygen.ts \
- ../../../i18n/da/oxygen.ts
-
+TARGET = oxygen
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/tableviewer/main.cpp b/noncore/apps/tableviewer/main.cpp
index d17ee65..ce39c84 100644
--- a/noncore/apps/tableviewer/main.cpp
+++ b/noncore/apps/tableviewer/main.cpp
@@ -10,23 +10,16 @@
**
** 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 "tableviewer.h"
#include <qpe/qpeapplication.h>
+#include <opie/oapplicationfactory.h>
-int main( int argc, char ** argv )
-{
- QPEApplication a( argc, argv );
+OPIE_EXPORT_APP( OApplicationFactory<TableViewerWindow> )
- TableViewerWindow mw;
- mw.setCaption( TableViewerWindow::tr("Table Viewer") );
- a.showMainWidget(&mw);
-
- return a.exec();
-}
diff --git a/noncore/apps/tableviewer/tableviewer.h b/noncore/apps/tableviewer/tableviewer.h
index 817db21..f56a460 100644
--- a/noncore/apps/tableviewer/tableviewer.h
+++ b/noncore/apps/tableviewer/tableviewer.h
@@ -31,24 +31,25 @@ class QMenuBar;
class TVListView;
class TVBrowseView;
class TVFilterView;
class TVEditView;
class DBStore;
class TableViewerWindow: public QMainWindow
{
Q_OBJECT
public:
+ static QString appName() { return QString::fromLatin1("tableviewer"); }
TableViewerWindow( QWidget *parent = 0,
const char *name = 0, WFlags f = 0 );
~TableViewerWindow();
public slots:
void selectDocument();
void newDocument();
void saveDocument();
void setDocument(const QString &);
void openDocument(const DocLnk &);
diff --git a/noncore/apps/tableviewer/tableviewer.pro b/noncore/apps/tableviewer/tableviewer.pro
index f047e0b..c6d9e68 100644
--- a/noncore/apps/tableviewer/tableviewer.pro
+++ b/noncore/apps/tableviewer/tableviewer.pro
@@ -1,15 +1,13 @@
-TEMPLATE = app
-CONFIG = qt warn_on debug
-DESTDIR = $(OPIEDIR)/bin
+CONFIG = qt warn_on debug quick-app
SUBDIRS = db ui
HEADERS = tableviewer.h \
xmlencodeattr.h \
ui/commonwidgets.h \
ui/tvbrowseview.h \
ui/tvlistview.h \
ui/tvfilterview.h \
ui/tveditview.h \
ui/browsekeyentry.h \
ui/filterkeyentry.h \
ui/tvkeyedit.h \
db/datacache.h \
diff --git a/noncore/apps/tinykate/main.cpp b/noncore/apps/tinykate/main.cpp
index e06668a..e21c040 100644
--- a/noncore/apps/tinykate/main.cpp
+++ b/noncore/apps/tinykate/main.cpp
@@ -4,25 +4,19 @@
begin : November 2002
copyright : (C) 2002 by Joseph Wenninger <jowenn@kde.org>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation. *
* ONLY VERSION 2 OF THE LICENSE IS APPLICABLE *
* *
***************************************************************************/
-#include <qpe/qpeapplication.h>
#include <qmainwindow.h>
#include "tinykate.h"
+#include <opie/oapplicationfactory.h>
-int main( int argc, char ** argv )
-{
- QPEApplication a( argc, argv );
+OPIE_EXPORT_APP( OApplicationFactory<TinyKate> )
- TinyKate m;
- a.showMainWidget(&m );
- return a.exec();
-}
diff --git a/noncore/apps/tinykate/opie-tinykate.control b/noncore/apps/tinykate/opie-tinykate.control
index 1fde467..9bc0130 100644
--- a/noncore/apps/tinykate/opie-tinykate.control
+++ b/noncore/apps/tinykate/opie-tinykate.control
@@ -1,9 +1,9 @@
Package: opie-tinykate
-Files: plugins/application/libtinykate.so* bin/tinykate apps/Applications/tinykate.desktop pics/tinykate $OPIEDIR/lib/libtinykate.so.1.0.0 $OPIEDIR/lib/libtinykate.so.1.0 $OPIEDIR/lib/libtinykate.so.1
+Files: plugins/application/libkate.so* bin/kate apps/Applications/tinykate.desktop pics/tinykate $OPIEDIR/lib/libtinykate.so.1.0.0 $OPIEDIR/lib/libtinykate.so.1.0 $OPIEDIR/lib/libtinykate.so.1
Priority: optional
Section: opie/applications
Maintainer: Opie Team <opie@handhelds.org>
Architecture: arm
Depends: task-opie-minimal
Description: Kate for opie
Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/apps/tinykate/tinykate.h b/noncore/apps/tinykate/tinykate.h
index 2bf4de6..a5ee9b9 100644
--- a/noncore/apps/tinykate/tinykate.h
+++ b/noncore/apps/tinykate/tinykate.h
@@ -24,24 +24,26 @@
#include <ktexteditor.h>
class QToolButton;
class QAction;
class QPopupMenu;
class TinyKate : public QMainWindow
{
Q_OBJECT
public:
TinyKate( QWidget *parent=0, const char *name=0, WFlags f = 0);
~TinyKate( );
+ static QString appName() { return QString::fromLatin1( "kate" ); };
+
public slots:
void slotNew();
void setDocument(const QString& fileref);
protected slots:
void slotOpen();
void slotClose();
void slotCurrentChanged(QWidget *);
void slotSave();
void slotSaveAs();
protected:
diff --git a/noncore/apps/tinykate/tinykate.pro b/noncore/apps/tinykate/tinykate.pro
index 632bd49..91d4230 100644
--- a/noncore/apps/tinykate/tinykate.pro
+++ b/noncore/apps/tinykate/tinykate.pro
@@ -1,22 +1,22 @@
TEMPLATE = app
-CONFIG = qt warn_on release
+CONFIG = qt warn_on release quick-app
DESTDIR = $(OPIEDIR)/bin
HEADERS = tinykate.h
SOURCES = tinykate.cpp main.cpp
INTERFACES =
INCLUDEPATH += $(OPIEDIR)/include \
$(OPIEDIR)/noncore/apps/tinykate/libkate \
$(OPIEDIR)/noncore/apps/tinykate/libkate/microkde \
$(OPIEDIR)/noncore/apps/tinykate/libkate/document \
$(OPIEDIR)/noncore/apps/tinykate/libkate/view \
$(OPIEDIR)/noncore/apps/tinykate/libkate/interfaces \
$(OPIEDIR)/noncore/apps/tinykate/libkate/ktexteditor \
$(OPIEDIR)/noncore/apps/tinykate/libkate/qt3back
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -ltinykate -lopie
-TARGET = tinykate
+TARGET = kate
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/zsafe/.cvsignore b/noncore/apps/zsafe/.cvsignore
new file mode 100644
index 0000000..2f8556e
--- a/dev/null
+++ b/noncore/apps/zsafe/.cvsignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+moc*
diff --git a/noncore/settings/aqpkg/.cvsignore b/noncore/settings/aqpkg/.cvsignore
index 2888d4a..4183697 100644
--- a/noncore/settings/aqpkg/.cvsignore
+++ b/noncore/settings/aqpkg/.cvsignore
@@ -1,2 +1,3 @@
Makefile*
moc*
+.moc*
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index d241d1b..882cfd4 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -1,14 +1,13 @@
-TEMPLATE = app
-CONFIG = qt warn_on release
+CONFIG = qt warn_on release quick-app
HEADERS = global.h \
mainwin.h \
datamgr.h \
settingsimpl.h \
ipkg.h \
packagewin.h \
package.h \
installdlgimpl.h \
instoptionsimpl.h \
destination.h \
utils.h \
server.h \
@@ -23,40 +22,19 @@ SOURCES = mainwin.cpp \
main.cpp \
packagewin.cpp \
package.cpp \
installdlgimpl.cpp \
instoptionsimpl.cpp \
destination.cpp \
utils.cpp \
server.cpp \
letterpushbutton.cpp \
inputdlg.cpp \
version.cpp \
categoryfilterimpl.cpp
-INTERFACES =
TARGET = aqpkg
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie -lstdc++
-DESTDIR = $(OPIEDIR)/bin
-
-TRANSLATIONS = ../../../i18n/de/aqpkg.ts \
- ../../../i18n/nl/aqpkg.ts \
- ../../../i18n/xx/aqpkg.ts \
- ../../../i18n/en/aqpkg.ts \
- ../../../i18n/es/aqpkg.ts \
- ../../../i18n/fr/aqpkg.ts \
- ../../../i18n/hu/aqpkg.ts \
- ../../../i18n/ja/aqpkg.ts \
- ../../../i18n/ko/aqpkg.ts \
- ../../../i18n/no/aqpkg.ts \
- ../../../i18n/pl/aqpkg.ts \
- ../../../i18n/pt/aqpkg.ts \
- ../../../i18n/pt_BR/aqpkg.ts \
- ../../../i18n/sl/aqpkg.ts \
- ../../../i18n/zh_CN/aqpkg.ts \
- ../../../i18n/zh_TW/aqpkg.ts \
- ../../../i18n/it/aqpkg.ts \
- ../../../i18n/da/aqpkg.ts
-
include ( $(OPIEDIR)/include.pro )
+
diff --git a/noncore/settings/aqpkg/main.cpp b/noncore/settings/aqpkg/main.cpp
index b7f8b7b..179f8b7 100644
--- a/noncore/settings/aqpkg/main.cpp
+++ b/noncore/settings/aqpkg/main.cpp
@@ -18,61 +18,21 @@
  _.=:.       :    :=>`: 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.
*/
-#ifdef QWS
-#include <qpe/qpeapplication.h>
-#include <qpe/qcopenvelope_qws.h>
-#else
-#include <qapplication.h>
-#endif
-
-#include <qobjectdefs.h>
-
#include "mainwin.h"
-#include "server.h"
-
-#include "global.h"
+#include <opie/oapplicationfactory.h>
/* be less intrusive for translation -zecke */
extern QString LOCAL_SERVER;
extern QString LOCAL_IPKGS;
-int main(int argc, char *argv[])
-{
-#ifdef QWS
- QPEApplication a( argc, argv );
-#else
- QApplication a( argc, argv );
-#endif
-
-#ifdef QWS
- // Disable suspend mode
- QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
-#endif
-
- LOCAL_SERVER = QObject::tr( "Installed packages" );
- LOCAL_IPKGS = QObject::tr( "Local packages" );
-
- MainWindow *win = new MainWindow();
- a.setMainWidget(win);
- win->showMaximized();
-
- a.exec();
-
-#ifdef QWS
- // Reenable suspend mode
- QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
-#endif
- #ifdef _DEBUG
- DumpUnfreed();
- #endif
-}
+OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 42093cf..dbe694e 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -1,15 +1,15 @@
/*
                This file is part of the OPIE Project
-
+
=. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk>
             .=l. Dan Williams <drw@handhelds.org>
           .>+-=
 _;:,     .>    :=|. This file is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This file is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
@@ -57,27 +57,33 @@
#include "global.h"
#include "inputdlg.h"
#include "ipkg.h"
#include "installdlgimpl.h"
#include "letterpushbutton.h"
#include "mainwin.h"
#include "packagewin.h"
#include "settingsimpl.h"
#include "utils.h"
extern int compareVersions( const char *v1, const char *v2 );
-MainWindow :: MainWindow()
- : QMainWindow( 0x0, 0x0, WStyle_ContextHelp )
+MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
+ : QMainWindow( parent, name, fl || WStyle_ContextHelp )
{
+ // Disable suspend mode
+ QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
+
+ LOCAL_SERVER = QObject::tr( "Installed packages" );
+ LOCAL_IPKGS = QObject::tr( "Local packages" );
+
setCaption( tr( "AQPkg - Package Manager" ) );
// Create UI widgets
initMainWidget();
initProgressWidget();
// Build menu and tool bars
setToolBarsMovable( FALSE );
QToolBar *bar = new QToolBar( this );
bar->setHorizontalStretchable( TRUE );
QMenuBar *mb = new QMenuBar( bar );
@@ -225,24 +231,27 @@ MainWindow :: MainWindow()
stack->addWidget( progressWindow, 2 );
stack->addWidget( networkPkgWindow, 1 );
setCentralWidget( stack );
stack->raiseWidget( progressWindow );
// Delayed call to finish initialization
QTimer::singleShot( 100, this, SLOT( init() ) );
}
MainWindow :: ~MainWindow()
{
delete mgr;
+
+ // Reenable suspend mode
+ QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
void MainWindow :: initMainWidget()
{
networkPkgWindow = new QWidget( this );
QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow );
serversList = new QComboBox( networkPkgWindow );
connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) );
QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) );
@@ -1003,25 +1012,24 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
QString dest = "root";
if ( !p->isInstalled() )
{
InstallData *newitem = new InstallData();
newitem->option = "I";
newitem->packageName = name;
return newitem;
}
else
{
InstallData *newitem = new InstallData();
newitem->option = "D";
-
// If local file, remove using package name, not filename
if ( p->isPackageStoredLocally() )
name = item->text();
if ( !p->isPackageStoredLocally() )
newitem->packageName = p->getInstalledPackageName();
else
newitem->packageName = name;
if ( p->getInstalledTo() )
{
newitem->destination = p->getInstalledTo();
@@ -1037,25 +1045,24 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
// If the version requested is older and user selected a local ipk file, then reinstall the file
if ( p->isPackageStoredLocally() && val == -1 )
val = 0;
if ( val == -2 )
{
// Error - should handle
}
else if ( val == -1 )
{
// Version available is older - remove only
newitem->option = "D";
-
// If local file, remove using package name, not filename
if ( p->isPackageStoredLocally() )
name = item->text();
}
else
{
QString caption;
QString text;
QString secondButton;
QString secondOption;
if ( val == 0 )
{
@@ -1180,54 +1187,54 @@ void MainWindow :: letterPushed( QString t )
void MainWindow :: slotDisplayPackage( QListViewItem *item )
{
QString itemstr( ((QCheckListItem*)item)->text() );
PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) );
p->showMaximized();
}
QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn )
: QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog )
{
setCaption( caption );
resize( 175, 100 );
-
+
QGridLayout *layout = new QGridLayout( this );
-
+
QLabel *l = new QLabel( text, this );
l->setAlignment( AlignCenter | WordBreak );
layout->addMultiCellWidget( l, 0, 0, 0, 1 );
-
+
btn1 = new QPushButton( tr( "Remove" ), this );
connect( btn1, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) );
layout->addWidget( btn1, 1, 0 );
-
+
btn2 = new QPushButton( secondbtn, this );
connect( btn2, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) );
layout->addWidget( btn2, 1, 1 );
-
+
executing = FALSE;
}
int QuestionDlg::exec()
{
show();
if ( !executing )
{
executing = TRUE;
qApp->enter_loop();
}
-
+
return buttonpressed;
}
void QuestionDlg::slotButtonPressed()
{
if ( sender() == btn1 )
buttonpressed = 1;
else if ( sender() == btn2 )
buttonpressed = 2;
else
buttonpressed = 0;
-
+
qApp->exit_loop();
}
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index 615ff8b..b8e1c98 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -42,29 +42,30 @@ class QCheckListItem;
class QComboBox;
class QLabel;
class QLineEdit;
class QListView;
class QListViewItem;
class QToolBar;
class QProgressBar;
class QPushButton;
class QWidgetStack;
class MainWindow :public QMainWindow
{
- Q_OBJECT
+ Q_OBJECT
public:
- MainWindow();
+ MainWindow( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~MainWindow();
+ static QString appName() { return QString::fromLatin1( "aqpkg" ); };
protected:
void closeEvent( QCloseEvent* e );
private:
DataManager *mgr;
QWidgetStack *stack;
QToolBar *findBar;
QToolBar *jumpBar;
QLineEdit *findEdit;
diff --git a/noncore/settings/sysinfo/main.cpp b/noncore/settings/sysinfo/main.cpp
index 6e889db..02b1098 100644
--- a/noncore/settings/sysinfo/main.cpp
+++ b/noncore/settings/sysinfo/main.cpp
@@ -12,23 +12,16 @@
** 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 "sysinfo.h"
#include <qpe/qpeapplication.h>
+#include <opie/oapplicationfactory.h>
-int main( int argc, char *argv[] )
-{
- QPEApplication a( argc, argv );
-
- SystemInfo *si = new SystemInfo();
- a.showMainWidget( si );
-
- return a.exec();
-}
+OPIE_EXPORT_APP( OApplicationFactory<SystemInfo> )
diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp
index c4474d5..4ef7122 100644
--- a/noncore/settings/sysinfo/storage.cpp
+++ b/noncore/settings/sysinfo/storage.cpp
@@ -41,75 +41,67 @@ FileSysInfo::FileSysInfo( QWidget *parent, const char *name )
{
QVBoxLayout *tmpvb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
tmpvb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
container = new QWidget( sv->viewport() );
sv->addChild( container );
vb = 0x0;
storage = new StorageInfo( this );
connect( storage, SIGNAL( disksChanged() ), this, SLOT( disksChanged() ) );
-
+
lines.setAutoDelete(TRUE);
rebuildDisks = TRUE;
updateMounts();
startTimer( 5000 );
}
+
void FileSysInfo::timerEvent(QTimerEvent*)
{
updateMounts();
}
void FileSysInfo::updateMounts()
{
storage->update();
-
+
if ( rebuildDisks )
{
- // Cannot auto delete QDict<MountInfo> disks because it seems to delete
- // the filesystem object as well causing a segfault
- MountInfo *mi;
- for ( QDictIterator<MountInfo> delit(disks); delit.current(); ++delit )
- {
- mi = delit.current();
- mi->fs = 0x0;
- delete mi;
- }
disks.clear();
lines.clear();
-
+
delete vb;
vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ );
bool frst=TRUE;
-
+
FileSystem *fs;
for ( QListIterator<FileSystem> it(storage->fileSystems()); it.current(); ++it )
{
fs = it.current();
-
+
if ( !frst )
{
QFrame *f = new QFrame( container );
vb->addWidget(f);
f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
lines.append(f);
f->show();
}
frst = FALSE;
-
+
MountInfo *mi = new MountInfo( fs, container );
vb->addWidget( mi );
disks.insert( fs->path(), mi );
mi->show();
QString tempstr = fs->name().left( 2 );
if ( tempstr == tr( "CF" ) )
QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) );
else if ( tempstr == tr( "Ha" ) )
QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) );
else if ( tempstr == tr( "SD" ) )
QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) );
else if ( tempstr == tr( "SC" ) )
@@ -117,62 +109,61 @@ void FileSysInfo::updateMounts()
else if ( tempstr == tr( "In" ) )
QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the built-in memory (i.e. Flash memory) on this handheld device." ) );
else if ( tempstr == tr( "RA" ) )
QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) );
}
vb->addStretch();
}
else
{
for (QDictIterator<MountInfo> i(disks); i.current(); ++i)
i.current()->updateData();
}
-
+
rebuildDisks = FALSE;
}
void FileSysInfo::disksChanged()
{
rebuildDisks = TRUE;
}
MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name )
: QWidget( parent, name )
{
QVBoxLayout *vb = new QVBoxLayout( this, 3 );
totalSize = new QLabel( this );
vb->addWidget( totalSize );
fs = filesys;
title = fs->name();
-
+
data = new GraphData();
graph = new BarGraph( this );
graph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
vb->addWidget( graph, 1 );
graph->setData( data );
legend = new GraphLegend( this );
legend->setOrientation(Horizontal);
vb->addWidget( legend );
legend->setData( data );
updateData();
}
MountInfo::~MountInfo()
{
delete data;
- delete fs;
}
void MountInfo::updateData()
{
long mult = fs->blockSize() / 1024;
long div = 1024 / fs->blockSize();
if ( !mult ) mult = 1;
if ( !div ) div = 1;
long total = fs->totalBlocks() * mult / div;
long avail = fs->availBlocks() * mult / div;
long used = total - avail;
totalSize->setText( title + tr(" : %1 kB").arg( total ) );
diff --git a/noncore/settings/sysinfo/sysinfo.h b/noncore/settings/sysinfo/sysinfo.h
index d69346a..94c3876 100644
--- a/noncore/settings/sysinfo/sysinfo.h
+++ b/noncore/settings/sysinfo/sysinfo.h
@@ -20,14 +20,15 @@
**
** Enhancements by: Dan Williams, <williamsdr@acm.org>
**
**********************************************************************/
#include <qwidget.h>
class SystemInfo : public QWidget
{
Q_OBJECT
public:
SystemInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+ static QString appName() { return QString::fromLatin1("sysinfo"); }
};
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro
index 2582ea2..2322989 100644
--- a/noncore/settings/sysinfo/sysinfo.pro
+++ b/noncore/settings/sysinfo/sysinfo.pro
@@ -1,39 +1,38 @@
-TEMPLATE = app
-CONFIG = qt warn_on release
-DESTDIR = $(OPIEDIR)/bin
+CONFIG = qt warn_on release quick-app
HEADERS = memory.h \
graph.h \
load.h \
storage.h \
processinfo.h \
modulesinfo.h \
detail.h \
versioninfo.h \
sysinfo.h
SOURCES = main.cpp \
memory.cpp \
graph.cpp \
load.cpp \
storage.cpp \
processinfo.cpp \
modulesinfo.cpp \
detail.cpp \
versioninfo.cpp \
sysinfo.cpp
-INTERFACES =
+
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
-TARGET = sysinfo
+
+TARGET = sysinfo
TRANSLATIONS = ../../../i18n/de/sysinfo.ts \
../../../i18n/nl/sysinfo.ts \
../../../i18n/xx/sysinfo.ts \
../../../i18n/en/sysinfo.ts \
../../../i18n/es/sysinfo.ts \
../../../i18n/fr/sysinfo.ts \
../../../i18n/hu/sysinfo.ts \
../../../i18n/ja/sysinfo.ts \
../../../i18n/ko/sysinfo.ts \
../../../i18n/no/sysinfo.ts \
../../../i18n/pl/sysinfo.ts \