From a7dc3fe0c963ef8f5f19c04c2806daeb91ba23c8 Mon Sep 17 00:00:00 2001 From: cniehaus Date: Sun, 15 Sep 2002 14:23:06 +0000 Subject: hehe --- diff --git a/noncore/apps/checkbook/calcdlg.ui b/noncore/apps/checkbook/calcdlg.ui new file mode 100644 index 0000000..7637ca8 --- a/dev/null +++ b/noncore/apps/checkbook/calcdlg.ui @@ -0,0 +1,243 @@ + +CalcDlg + + QWidget + + name + CalcDlg + + + geometry + + 0 + 0 + 222 + 274 + + + + caption + Network Time + + + layoutMargin + + + layoutSpacing + + + QTabWidget + + name + TabWidgetMain + + + geometry + + 10 + 0 + 200 + 260 + + + + layoutMargin + + + layoutSpacing + + + QWidget + + name + tabMain + + + title + Molweight + + + QFrame + + name + FrameSystemTime + + + geometry + + 2 + 2 + 180 + 220 + + + + frameShape + StyledPanel + + + frameShadow + Raised + + + QLabel + + name + TextLabel1_4 + + + geometry + + 1 + 1 + 298 + 16 + + + + text + Formula: + + + + QLabel + + name + TextLabel2_4 + + + geometry + + 1 + 86 + 298 + 16 + + + + text + Result: + + + + QLayoutWidget + + name + Layout7 + + + geometry + + 0 + 50 + 175 + 30 + + + + + margin + 0 + + + spacing + 6 + + + QPushButton + + name + calculate + + + text + Calculate + + + + QPushButton + + name + clear_fields + + + text + Clear + + + + + + QLineEdit + + name + formula + + + geometry + + 0 + 20 + 170 + 22 + + + + + QMultiLineEdit + + name + anal_display + + + geometry + + 0 + 130 + 170 + 80 + + + + + QLineEdit + + name + LineEdit2 + + + geometry + + 0 + 100 + 170 + 22 + + + + + + + QWidget + + name + tabNtp + + + title + Nernst + + + + margin + 1 + + + spacing + 2 + + + + + + diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro deleted file mode 100644 index e9e2167..0000000 --- a/noncore/apps/checkbook/checkbook.pro +++ b/dev/null @@ -1,50 +0,0 @@ -TEMPLATE = app -CONFIG = qt warn_on release -HEADERS = config.h \ - qcheckbook.h \ - qcheckdetails.h \ - qcheckentry.h \ - qcheckgraph.h \ - qcheckmainmenu.h \ - qcheckname.h \ - qcheckview.h \ - qrestrictedcombo.h \ - qrestrictedline.h -SOURCES = config.cpp \ - main.cpp \ - qcheckbook.cpp \ - qcheckdetails.cpp \ - qcheckentry.cpp \ - qcheckgraph.cpp \ - qcheckmainmenu.cpp \ - qcheckname.cpp \ - qcheckview.cpp \ - qrestrictedcombo.cpp \ - qrestrictedline.cpp -INTERFACES = qcheckdetailsbase.ui \ - qcheckentrybase.ui \ - qcheckgraphbase.ui \ - qcheckmmbase.ui \ - qchecknamebase.ui \ - qcheckviewbase.ui -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -TARGET = checkbook -DESTDIR = $(OPIEDIR)/bin - -TRANSLATIONS = ../../../i18n/de/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 \ - ../../../i18n/pl/checkbook.ts \ - ../../../i18n/pt/checkbook.ts \ - ../../../i18n/pt_BR/checkbook.ts \ - ../../../i18n/sl/checkbook.ts \ - ../../../i18n/zh_CN/checkbook.ts \ - ../../../i18n/zh_TW/checkbook.ts \ - ../../../i18n/it/checkbook.ts diff --git a/noncore/apps/checkbook/config.cpp b/noncore/apps/checkbook/config.cpp deleted file mode 100644 index e6c6dcc..0000000 --- a/noncore/apps/checkbook/config.cpp +++ b/dev/null @@ -1,560 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -#include -#include -#include -#include -#if QT_VERSION <= 230 && defined(QT_NO_CODECS) -#include -#endif -#include - -#include -#include -#include -#include -#include - -#include "config.h" - - -/*! - \internal -*/ -QString Config::configFilename(const QString& name, Domain d) -{ - switch (d) { - case File: - return name; - case User: { - QDir dir = (QString(getenv("HOME")) + "/Settings"); - if ( !dir.exists() ) - mkdir(dir.path().local8Bit(),0700); - return dir.path() + "/" + name + ".conf"; - } - } - return name; -} - -/*! - \class Config config.h - \brief The Config class provides for saving application cofniguration state. - - You should keep a Config in existence only while you do not want others - to be able to change the state. There is no locking currently, but there - may be in the future. -*/ - -/*! - \enum Config::ConfigGroup - \internal -*/ - -/*! - \enum Config::Domain - - \value File - \value User - - See Config for details. -*/ - -/*! - Constructs a config that will load or create a configuration with the - given \a name in the given \a domain. - - You must call setGroup() before doing much else with the Config. - - In the default Domain, \e User, - the configuration is user-specific. \a name should not contain "/" in - this case, and in general should be the name of the C++ class that is - primarily responsible for maintaining the configuration. - - In the File Domain, \a name is an absolute filename. -*/ -Config::Config( const QString &name, Domain domain ) - : filename( configFilename(name,domain) ) -{ - git = groups.end(); - read(); - - lang = getenv("LANG"); - int i = lang.find("."); - if ( i > 0 ) - lang = lang.left( i ); - i = lang.find( "_" ); - if ( i > 0 ) - glang = lang.left(i); -} - -/*! - Writes any changes to disk and destroys the in-memory object. -*/ -Config::~Config() -{ - if ( changed ) - write(); -} - -/*! - Returns whether the current group has an entry called \a key. -*/ -bool Config::hasKey( const QString &key ) const -{ - if ( groups.end() == git ) - return FALSE; - ConfigGroup::ConstIterator it = ( *git ).find( key ); - return it != ( *git ).end(); -} - -/*! - Sets the current group for subsequent reading and writing of - entries to \a gname. Grouping allows the application to partition the namespace. - - This function must be called prior to any reading or writing - of entries. - - The \a gname must not be empty. -*/ -void Config::setGroup( const QString &gname ) -{ - QMap< QString, ConfigGroup>::Iterator it = groups.find( gname ); - if ( it == groups.end() ) { - git = groups.insert( gname, ConfigGroup() ); - changed = TRUE; - return; - } - git = it; -} - -/*! - Writes a (\a key, \a value) entry to the current group. - - \sa readEntry() -*/ -void Config::writeEntry( const QString &key, const char* value ) -{ - writeEntry(key,QString(value)); -} - -/*! - Writes a (\a key, \a value) entry to the current group. - - \sa readEntry() -*/ -void Config::writeEntry( const QString &key, const QString &value ) -{ - if ( git == groups.end() ) { - qWarning( "no group set" ); - return; - } - if ( (*git)[key] != value ) { - ( *git ).insert( key, value ); - changed = TRUE; - } -} - -/* - Note that the degree of protection offered by the encryption here is - only sufficient to avoid the most casual observation of the configuration - files. People with access to the files can write down the contents and - decrypt it using this source code. - - Conceivably, and at some burden to the user, this encryption could - be improved. -*/ -static QString encipher(const QString& plain) -{ - // mainly, we make it long - QString cipher; - int mix=28730492; - for (int i=0; i<(int)plain.length(); i++) { - int u = plain[i].unicode(); - int c = u ^ mix; - QString x = QString::number(c,36); - cipher.append(QChar('a'+x.length())); - cipher.append(x); - mix *= u; - } - return cipher; -} - -static QString decipher(const QString& cipher) -{ - QString plain; - int mix=28730492; - for (int i=0; i<(int)cipher.length();) { - int l = cipher[i].unicode()-'a'; - QString x = cipher.mid(i+1,l); i+=l+1; - int u = x.toInt(0,36) ^ mix; - plain.append(QChar(u)); - mix *= u; - } - return plain; -} - -/*! - Writes an encrypted (\a key, \a value) entry to the current group. - - Note that the degree of protection offered by the encryption is - only sufficient to avoid the most casual observation of the configuration - files. - - \sa readEntry() -*/ -void Config::writeEntryCrypt( const QString &key, const QString &value ) -{ - if ( git == groups.end() ) { - qWarning( "no group set" ); - return; - } - QString evalue = encipher(value); - if ( (*git)[key] != evalue ) { - ( *git ).insert( key, evalue ); - changed = TRUE; - } -} - -/*! - Writes a (\a key, \a num) entry to the current group. - - \sa readNumEntry() -*/ -void Config::writeEntry( const QString &key, int num ) -{ - QString s; - s.setNum( num ); - writeEntry( key, s ); -} - -#ifdef Q_HAS_BOOL_TYPE -/*! - Writes a (\a key, \a b) entry to the current group. This is equivalent - to writing a 0 or 1 as an integer entry. - - \sa readBoolEntry() -*/ -void Config::writeEntry( const QString &key, bool b ) -{ - QString s; - s.setNum( ( int )b ); - writeEntry( key, s ); -} -#endif - -/*! - Writes a (\a key, \a lst) entry to the current group. The list - is separated by \a sep, so the strings must not contain that character. - - \sa readListEntry() -*/ -void Config::writeEntry( const QString &key, const QStringList &lst, const QChar &sep ) -{ - QString s; - QStringList::ConstIterator it = lst.begin(); - for ( ; it != lst.end(); ++it ) - s += *it + sep; - writeEntry( key, s ); -} - -/*! - Removes the \a key entry from the current group. Does nothing if - there is no such entry. -*/ - -void Config::removeEntry( const QString &key ) -{ - if ( git == groups.end() ) { - qWarning( "no group set" ); - return; - } - ( *git ).remove( key ); - changed = TRUE; -} - -/*! - \fn bool Config::operator == ( const Config & other ) const - - Tests for equality with \a other. Config objects are equal if they refer to the same filename. -*/ - -/*! - \fn bool Config::operator != ( const Config & other ) const - - Tests for inequality with \a other. Config objects are equal if they refer to the same filename. -*/ - -/*! - \fn QString Config::readEntry( const QString &key, const QString &deflt ) const - - Reads a string entry stored with \a key, defaulting to \a deflt if there is no entry. -*/ - -/*! - \internal - For compatibility, non-const version. -*/ -QString Config::readEntry( const QString &key, const QString &deflt ) -{ - QString res = readEntryDirect( key+"["+lang+"]" ); - if ( !res.isNull() ) - return res; - if ( !glang.isEmpty() ) { - res = readEntryDirect( key+"["+glang+"]" ); - if ( !res.isNull() ) - return res; - } - return readEntryDirect( key, deflt ); -} - -/*! - \fn QString Config::readEntryCrypt( const QString &key, const QString &deflt ) const - - Reads an encrypted string entry stored with \a key, defaulting to \a deflt if there is no entry. -*/ - -/*! - \internal - For compatibility, non-const version. -*/ -QString Config::readEntryCrypt( const QString &key, const QString &deflt ) -{ - QString res = readEntryDirect( key+"["+lang+"]" ); - if ( res.isNull() && glang.isEmpty() ) - res = readEntryDirect( key+"["+glang+"]" ); - if ( res.isNull() ) - res = readEntryDirect( key, QString::null ); - if ( res.isNull() ) - return deflt; - return decipher(res); -} - -/*! - \fn QString Config::readEntryDirect( const QString &key, const QString &deflt ) const - \internal -*/ - -/*! - \internal - For compatibility, non-const version. -*/ -QString Config::readEntryDirect( const QString &key, const QString &deflt ) -{ - if ( git == groups.end() ) { - //qWarning( "no group set" ); - return deflt; - } - ConfigGroup::ConstIterator it = ( *git ).find( key ); - if ( it != ( *git ).end() ) - return *it; - else - return deflt; -} - -/*! - \fn int Config::readNumEntry( const QString &key, int deflt ) const - Reads a numeric entry stored with \a key, defaulting to \a deflt if there is no entry. -*/ - -/*! - \internal - For compatibility, non-const version. -*/ -int Config::readNumEntry( const QString &key, int deflt ) -{ - QString s = readEntry( key ); - if ( s.isEmpty() ) - return deflt; - else - return s.toInt(); -} - -/*! - \fn bool Config::readBoolEntry( const QString &key, bool deflt ) const - Reads a bool entry stored with \a key, defaulting to \a deflt if there is no entry. -*/ - -/*! - \internal - For compatibility, non-const version. -*/ -bool Config::readBoolEntry( const QString &key, bool deflt ) -{ - QString s = readEntry( key ); - if ( s.isEmpty() ) - return deflt; - else - return (bool)s.toInt(); -} - -/*! - \fn QStringList Config::readListEntry( const QString &key, const QChar &sep ) const - Reads a string list entry stored with \a key, and with \a sep as the separator. -*/ - -/*! - \internal - For compatibility, non-const version. -*/ - -/*! - Removes all entries from the current group. -*/ -void Config::clearGroup() -{ - if ( git == groups.end() ) { - qWarning( "no group set" ); - return; - } - if ( !(*git).isEmpty() ) { - ( *git ).clear(); - changed = TRUE; - } -} - -void Config::removeGroup() -{ - if ( git == groups.end() ) { - qWarning( "no group set" ); - return; - } - - groups.remove(git); - changed = TRUE; -} - -/*! - \internal -*/ -void Config::write( const QString &fn ) -{ - QString strNewFile; - if ( !fn.isEmpty() ) - filename = fn; - strNewFile = filename + ".new"; - - QFile f( strNewFile ); - if ( !f.open( IO_WriteOnly|IO_Raw ) ) { - qWarning( "could not open for writing `%s'", strNewFile.latin1() ); - git = groups.end(); - return; - } - - QString str; - QCString cstr; - QMap< QString, ConfigGroup >::Iterator g_it = groups.begin(); - - for ( ; g_it != groups.end(); ++g_it ) { - str += "[" + g_it.key() + "]\n"; - ConfigGroup::Iterator e_it = ( *g_it ).begin(); - for ( ; e_it != ( *g_it ).end(); ++e_it ) - str += e_it.key() + " = " + *e_it + "\n"; - } - cstr = str.utf8(); - - int total_length; - total_length = f.writeBlock( cstr.data(), cstr.length() ); - if ( total_length != int(cstr.length()) ) { - QMessageBox::critical( 0, QObject::tr("Out of Space"), - QObject::tr("There was a problem creating\nConfiguration Information \nfor this program.\n\nPlease free up some space and\ntry again.") ); - f.close(); - QFile::remove( strNewFile ); - return; - } - - f.close(); - // now rename the file... - if ( rename( strNewFile, filename ) < 0 ) { - qWarning( "problem renaming the file %s to %s", strNewFile.latin1(), - filename.latin1() ); - QFile::remove( strNewFile ); - } -} - -/*! - Returns whether the Config is in a valid state. -*/ -bool Config::isValid() const -{ - return groups.end() != git; -} - -/*! - \internal -*/ -void Config::read() -{ - changed = FALSE; - - if ( !QFileInfo( filename ).exists() ) { - git = groups.end(); - return; - } - - QFile f( filename ); - if ( !f.open( IO_ReadOnly ) ) { - git = groups.end(); - return; - } - - QTextStream s( &f ); -#if QT_VERSION <= 230 && defined(QT_NO_CODECS) - // The below should work, but doesn't in Qt 2.3.0 - s.setCodec( QTextCodec::codecForMib( 106 ) ); -#else - s.setEncoding( QTextStream::UnicodeUTF8 ); -#endif - - QStringList list = QStringList::split('\n', s.read() ); - f.close(); - - for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { - if ( !parse( *it ) ) { - git = groups.end(); - return; - } - } -} - -/*! - \internal -*/ -bool Config::parse( const QString &l ) -{ - QString line = l.stripWhiteSpace(); - if ( line[ 0 ] == QChar( '[' ) ) { - QString gname = line; - gname = gname.remove( 0, 1 ); - if ( gname[ (int)gname.length() - 1 ] == QChar( ']' ) ) - gname = gname.remove( gname.length() - 1, 1 ); - git = groups.insert( gname, ConfigGroup() ); - } else if ( !line.isEmpty() ) { - if ( git == groups.end() ) - return FALSE; - int eq = line.find( '=' ); - if ( eq == -1 ) - return FALSE; - QString key = line.left(eq).stripWhiteSpace(); - QString value = line.mid(eq+1).stripWhiteSpace(); - ( *git ).insert( key, value ); - } - return TRUE; -} diff --git a/noncore/apps/checkbook/config.h b/noncore/apps/checkbook/config.h deleted file mode 100644 index b3a8561..0000000 --- a/noncore/apps/checkbook/config.h +++ b/dev/null @@ -1,99 +0,0 @@ -/********************************************************************** -** Copyright (C) 2000 Trolltech AS. All rights reserved. -** -** This file is part of Qtopia Environment. -** -** This file may be distributed and/or modified under the terms of the -** GNU General Public License version 2 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. -** -** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -** -** See http://www.trolltech.com/gpl/ for GPL licensing information. -** -** Contact info@trolltech.com if any conditions of this licensing are -** not clear to you. -** -**********************************************************************/ - -#ifndef CONFIG_H -#define CONFIG_H - -// ##### could use QSettings with Qt 3.0 - -#include -#include - -class ConfigPrivate; -class Config -{ -public: - typedef QMap< QString, QString > ConfigGroup; - - enum Domain { File, User }; - Config( const QString &name, Domain domain=User ); - ~Config(); - - bool operator == ( const Config & other ) const { return (filename == other.filename); } - bool operator != ( const Config & other ) const { return (filename != other.filename); } - - bool isValid() const; - bool hasKey( const QString &key ) const; - - void setGroup( const QString &gname ); - void writeEntry( const QString &key, const char* value ); - void writeEntry( const QString &key, const QString &value ); - void writeEntryCrypt( const QString &key, const QString &value ); - void writeEntry( const QString &key, int num ); -#ifdef Q_HAS_BOOL_TYPE - void writeEntry( const QString &key, bool b ); -#endif - void writeEntry( const QString &key, const QStringList &lst, const QChar &sep ); - void removeEntry( const QString &key ); - - QString readEntry( const QString &key, const QString &deflt = QString::null ) const; - QString readEntryCrypt( const QString &key, const QString &deflt = QString::null ) const; - QString readEntryDirect( const QString &key, const QString &deflt = QString::null ) const; - int readNumEntry( const QString &key, int deflt = -1 ) const; - bool readBoolEntry( const QString &key, bool deflt = FALSE ) const; - - // For compatibility, non-const versions. - QString readEntry( const QString &key, const QString &deflt ); - QString readEntryCrypt( const QString &key, const QString &deflt ); - QString readEntryDirect( const QString &key, const QString &deflt ); - int readNumEntry( const QString &key, int deflt ); - bool readBoolEntry( const QString &key, bool deflt ); - - void clearGroup(); - void removeGroup(); - - void write( const QString &fn = QString::null ); - -protected: - void read(); - bool parse( const QString &line ); - - QMap< QString, ConfigGroup > groups; - QMap< QString, ConfigGroup >::Iterator git; - QString filename; - QString lang; - QString glang; - bool changed; - ConfigPrivate *d; - static QString configFilename(const QString& name, Domain); -}; - -inline QString Config::readEntry( const QString &key, const QString &deflt ) const -{ return ((Config*)this)->readEntry(key,deflt); } -inline QString Config::readEntryCrypt( const QString &key, const QString &deflt ) const -{ return ((Config*)this)->readEntryCrypt(key,deflt); } -inline QString Config::readEntryDirect( const QString &key, const QString &deflt ) const -{ return ((Config*)this)->readEntryDirect(key,deflt); } -inline int Config::readNumEntry( const QString &key, int deflt ) const -{ return ((Config*)this)->readNumEntry(key,deflt); } -inline bool Config::readBoolEntry( const QString &key, bool deflt ) const -{ return ((Config*)this)->readBoolEntry(key,deflt); } - -#endif diff --git a/noncore/apps/checkbook/qcheckbook.cpp b/noncore/apps/checkbook/qcheckbook.cpp deleted file mode 100644 index bb7a5ac..0000000 --- a/noncore/apps/checkbook/qcheckbook.cpp +++ b/dev/null @@ -1,147 +0,0 @@ -#include "qcheckbook.h" - -#include -#include -#include -#include -#include -#include - -QCheckBook::QCheckBook() - : QMainWindow(), - m_view(), - m_view2(), - m_view3() -{ - initCheck = false; - initMM = false; - setCaption("Checking"); - statusBar()->hide(); - menuBar()->hide(); - - bar = new QToolBar(this); - bar->setHorizontalStretchable( TRUE ); - - addToolBar(bar); - - Config config("qcheckbook"); - config.setGroup("Global"); - QString lastCheck = config.readEntry("LastCheckBook", QString("")); - - QString checkdirname = QDir::homeDirPath(); - checkdirname.append("/.checkbooks/"); - checkdirname.append(lastCheck); - QFile f(checkdirname); - - - if (lastCheck.isEmpty() == false && lastCheck != "" && f.exists() == true) - { - newCheck(lastCheck); - } else { - initMainMenus(); - } - - setToolBarsMovable( FALSE ); -} - -void QCheckBook::newCheck(const QString &filename) -{ - if (filename.isEmpty() == false) - { - initCheck = true; - if (m_view != 0) - { - m_view=0; - delete m_view; - } - m_view = new QCheckView(this, filename); - m_view->hide(); - connect(m_view, SIGNAL(reload(const QString &)), this, SLOT(newCheck(const QString &))); - if (initMM == true) - { - delete nb1; - } - bar->clear(); - mbar = new QMenuBar(bar); - mbar->setMargin(0); - - QPixmap newIcon = Resource::loadPixmap( "new" ); - nb2 = new QToolButton( newIcon, "New", QString::null, m_view, SLOT(newClicked()), bar, "new item" ); - QPixmap pixmap = Resource::loadPixmap( "pixmap" ); - m_filename = filename; - nb3 = new QToolButton( pixmap, "Graph", QString::null, this, SLOT(newGraph()), bar, "new graph" ); - - QPixmap closeIcon = Resource::loadPixmap( "close" ); - nb4 = new QToolButton( closeIcon, "Close", QString::null, this, SLOT(initMainMenus()), bar, "close graph" ); - - popup = new QPopupMenu(m_view); - popup->insertItem("&New Entry", m_view, SLOT(newClicked())); - popup->insertItem("&Graph Checkbook", this, SLOT(newGraph())); - popup->insertItem("&Close Checkbook", this, SLOT(initMainMenus())); - popup->insertItem("&Exit", this, SLOT(close())); - mbar->insertItem("&File", popup); - - setCentralWidget(m_view); - m_view->show(); - - Config config("qcheckbook"); - config.setGroup("Global"); - config.writeEntry("LastCheckBook", filename); - initMM = false; - } -} - -void QCheckBook::close() -{ - QApplication::exit(); -} - -void QCheckBook::newGraph() -{ - if (m_filename.isEmpty() == false) - { - m_view2 = new QCheckGraph(m_filename); - m_view2->showMaximized(); - } -} - -void QCheckBook::initMainMenus() -{ - Config config("qcheckbook"); - config.setGroup("Global"); - config.writeEntry("LastCheckBook", QString("")); - initMM = true; - m_filename = ""; - if (m_view3 != 0) - { - delete m_view3; - } - m_view3 = new QCheckMainMenu(this); - m_view3->hide(); - - if (initCheck == true) - { - delete nb2; - delete nb3; - delete nb4; - } - - bar->clear(); - - mbar = new QMenuBar(bar); - mbar->setMargin(0); - - QPixmap newIcon = Resource::loadPixmap( "new" ); - nb1 = new QToolButton( newIcon, "New", QString::null, m_view3, SLOT(newClicked()), bar, "new book" ); - - popup = new QPopupMenu(); - popup->insertItem("&New", m_view3, SLOT(newClicked())); - popup->insertItem("&Exit", this, SLOT(close())); - mbar->insertItem("&File", popup); - - setCentralWidget(m_view3); - m_view3->show(); - - connect(m_view3, SIGNAL(itemSelected(const QString &)), this, SLOT(newCheck(const QString &))); - initCheck = false; -} diff --git a/noncore/apps/checkbook/qcheckdetails.cpp b/noncore/apps/checkbook/qcheckdetails.cpp deleted file mode 100644 index 19a5e82..0000000 --- a/noncore/apps/checkbook/qcheckdetails.cpp +++ b/dev/null @@ -1,119 +0,0 @@ -#include "qcheckdetails.h" - -QCheckDetails::QCheckDetails(int row, int col, const QStringList item) - : QMainWindow(), - m_view() -{ - m_view = new QCheckDetailsBase(this); - setCentralWidget(m_view); - - m_row = row; - m_col = col; - - QToolBar *bar = new QToolBar(this); - bar->setHorizontalStretchable( TRUE ); - - QPixmap newIcon = Resource::loadPixmap( "edit" ); - QPixmap trashIcon = Resource::loadPixmap( "trash" ); - QToolButton *nb1 = new QToolButton( newIcon, "Edit", QString::null, this, SLOT(editCheck()), bar, "edit transaction" ); - QToolButton *nb2 = new QToolButton( trashIcon, "Delete", QString::null, this, SLOT(deleteCheck()), bar, "delete transaction" ); - addToolBar(bar); - - QString text = ""; - if (item[0] == "true") - { - text.append("Payment to "); - text.append(item[1]); - } - if (item[0] == "false") - { - text.append("Deposit from "); - text.append(item[1]); - } - text.append(" on "); - text.append(item[7]); - text.append(" for "); - text.append(QString("$" + item[5])); - - text.append(", to make your balance $"); - text.append(item[9]); - text.append("."); - - text.append("

"); - text.append("Category: "); - text.append(item[2]); - text.append("
"); - text.append("Type: "); - - QString type = "No Type"; - if (item[0] == "true") - { - if(item[3] == "0") - { - type = "Debit Charge"; - } - if(item[3] == "1") - { - type = "Written Check"; - } - if(item[3] == "2") - { - type = "Transfer"; - } - if(item[3] == "3") - { - type = "Credit Card"; - } - } - - if (item[0] == "false") - { - if(item[3] == "0") - { - type = "Written Check"; - } - if(item[3] == "1") - { - type = "Automatic Payment"; - } - if(item[3] == "2") - { - type = "Transfer"; - } - if(item[3] == "3") - { - type = "Cash"; - } - } - - text.append(type); - text.append("
"); - if (item[4] != "0") - { - text.append("Check Number: "); - text.append(item[4]); - text.append("
"); - } - if (item[6] != ".00") - { - text.append("Extra Fee: "); - text.append(QString("$" + item[6])); - m_view->checkDetails->setText(text); - } - if (item[8] != "") - { - text.append("
Additional Comments: "); - text.append(item[8]); - } - m_view->checkDetails->setText(text); -} - -void QCheckDetails::editCheck() -{ - emit editClicked(m_row, m_col); -} - -void QCheckDetails::deleteCheck() -{ - emit deleteClicked(m_row, m_col); -} diff --git a/noncore/apps/checkbook/qcheckdetails.h b/noncore/apps/checkbook/qcheckdetails.h deleted file mode 100644 index fe5fe1a..0000000 --- a/noncore/apps/checkbook/qcheckdetails.h +++ b/dev/null @@ -1,27 +0,0 @@ -#include "qcheckdetailsbase.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class QCheckDetails : public QMainWindow -{ - Q_OBJECT - public: - QCheckDetails(int row, int col, const QStringList item); - signals: - void editClicked(int, int); - void deleteClicked(int, int); - public slots: - void editCheck(); - void deleteCheck(); - private: - int m_row; - int m_col; - QCheckDetailsBase *m_view; -}; diff --git a/noncore/apps/checkbook/qcheckdetailsbase.ui b/noncore/apps/checkbook/qcheckdetailsbase.ui deleted file mode 100644 index d94ba5e..0000000 --- a/noncore/apps/checkbook/qcheckdetailsbase.ui +++ b/dev/null @@ -1,62 +0,0 @@ - -QCheckDetailsBase - - QWidget - - name - QCheckDetailsBase - - - geometry - - 0 - 0 - 240 - 265 - - - - caption - Transaction Details - - - - margin - 4 - - - spacing - 0 - - - QTextView - - name - checkDetails - - - - - - - QWidget -
qwidget.h
- - -1 - -1 - - 0 - - 5 - 5 - - image0 -
-
- - - image0 - 789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753 - - -
diff --git a/noncore/apps/checkbook/qcheckentry.cpp b/noncore/apps/checkbook/qcheckentry.cpp deleted file mode 100644 index 2e8da1c..0000000 --- a/noncore/apps/checkbook/qcheckentry.cpp +++ b/dev/null @@ -1,256 +0,0 @@ -#include "qcheckentry.h" - -QCheckEntry::QCheckEntry() - : QCheckEntryBase() -{ - connect(transAmount, SIGNAL(textChanged(const QString &)), this, SLOT(amountChanged(const QString &))); - connect(transFee, SIGNAL(textChanged(const QString &)), this, SLOT(transFeeChanged(const QString &))); - connect(payment, SIGNAL(clicked()), this, SLOT(paymentClicked())); - connect(deposit, SIGNAL(clicked()), this, SLOT(depositClicked())); - - QString todaysdate = QString::number(QDate::currentDate().month()); - todaysdate.append("/"); - todaysdate.append(QString::number(QDate::currentDate().day())); - todaysdate.append("/"); - todaysdate.append(QString::number(QDate::currentDate().year())); - dateEdit->setText(todaysdate); - - descriptionCombo->setFocus(); - - dateEdit->setValidChars("0123456789./-"); - dateEdit->setMaxLength(10); - - descriptionCombo->lineEdit()->setMaxLength(30); - - checkNumber->setValidChars("0123456789-"); - checkNumber->setMaxLength(10); - - transAmount->setValidChars("0123456789."); - - transFee->setMaxLength(5); - transFee->setValidChars("0123456789."); - setTabOrder(transType,checkNumber); - setTabOrder(checkNumber,transAmount); - setTabOrder(transAmount,transFee); - setTabOrder(transFee,dateEdit); - setTabOrder(dateEdit, additionalNotes ); -} - -void QCheckEntry::paymentClicked() -{ - cmbCategory->clear(); - cmbCategory->insertItem( tr( "Automobile" ) ); - cmbCategory->insertItem( tr( "Bills" ) ); - cmbCategory->insertItem( tr( "CDs" ) ); - cmbCategory->insertItem( tr( "Clothing" ) ); - cmbCategory->insertItem( tr( "Computer" ) ); - cmbCategory->insertItem( tr( "DVDs" ) ); - cmbCategory->insertItem( tr( "Eletronics" ) ); - cmbCategory->insertItem( tr( "Entertainment" ) ); - cmbCategory->insertItem( tr( "Food" ) ); - cmbCategory->insertItem( tr( "Gasoline" ) ); - cmbCategory->insertItem( tr( "Misc" ) ); - cmbCategory->insertItem( tr( "Movies" ) ); - cmbCategory->insertItem( tr( "Rent" ) ); - cmbCategory->insertItem( tr( "Travel" ) ); - cmbCategory->setCurrentItem( 0 ); - transType->clear(); - transType->insertItem( tr( "Debit Charge" ) ); - transType->insertItem( tr( "Written Check" ) ); - transType->insertItem( tr( "Transfer" ) ); - transType->insertItem( tr( "Credit Card" ) ); -} - -void QCheckEntry::depositClicked() -{ - cmbCategory->clear(); - cmbCategory->insertItem( tr( "Work" ) ); - cmbCategory->insertItem( tr( "Family Member" ) ); - cmbCategory->insertItem( tr( "Misc. Credit" ) ); - cmbCategory->setCurrentItem( 0 ); - transType->clear(); - transType->insertItem( tr( "Written Check" ) ); - transType->insertItem( tr( "Automatic Payment" ) ); - transType->insertItem( tr( "Transfer" ) ); - transType->insertItem( tr( "Cash" ) ); -} - -QStringList QCheckEntry::popupEntry(const QStringList &originaldata) -{ - QCheckEntry qce; - - // This is how the list looks: - // 0: true or false, true == payment, false == deposit - // 1: description of the transaction - // 2: category name - // 3: transaction type (stores the integer value of the index of the combobox) - // 4: check number of the transaction (if any) - // 5: transaction amount - // 6: transaction fee (e.g. service charge, or ATM charge). - // 7: date of the transaction - // 8: additional notes - // 9: recently used descriptions - if (originaldata.count() > 1) - { - if (originaldata[0] == "true") - { - qce.payment->setChecked(true); - qce.paymentClicked(); - } else { - if (originaldata[0] == "false") - { - qce.deposit->setChecked(true); - qce.depositClicked(); - } - } - qce.descriptionCombo->lineEdit()->setText(originaldata[1]); - qce.cmbCategory->lineEdit()->setText(originaldata[2]); - qce.transType->setCurrentItem(originaldata[3].toInt()); - qce.checkNumber->setText(originaldata[4]); - qce.transAmount->setText(originaldata[5]); - qce.transFee->setText(originaldata[6]); - qce.dateEdit->setText(originaldata[7]); - qce.additionalNotes->setText(originaldata[8]); - QStringList recentlist; - if (!originaldata[9].isEmpty()) - { - recentlist = QStringList::split(',', originaldata[9], false); - } - if (!recentlist.isEmpty()) - { - qce.descriptionCombo->insertStringList(recentlist); - } - } else { - QStringList recentlist; - if (!originaldata[0].isEmpty()) - { - recentlist = QStringList::split(',', originaldata[0], false); - } - if (!recentlist.isEmpty()) - { - qce.descriptionCombo->insertStringList(recentlist); - } - } - - qce.setWFlags(Qt::WType_Modal); - qce.showMaximized(); - - qce.descriptionCombo->lineEdit()->clear(); - - if (qce.exec() == QDialog::Accepted) - { - // Validate that the user has inputed a valid dollar amount - if (qce.transFee->text().contains('.') == 0) - { - QString text = qce.transFee->text(); - text.append(".00"); - qce.transFee->setText(text); - } else { - QString tmp = qce.transFee->text(); - if (tmp.mid(tmp.find('.'), tmp.length()).length() == 1) - { - tmp.append("00"); - qce.transFee->setText(tmp); - } else { - if (tmp.mid(tmp.find('.'), tmp.length()).length() == 2) - { - tmp.append("0"); - qce.transFee->setText(tmp); - } - } - } - if (qce.transAmount->text().contains('.') == 0) - { - QString text = qce.transAmount->text(); - text.append(".00"); - qce.transAmount->setText(text); - } else { - QString tmp = qce.transAmount->text(); - if (tmp.mid(tmp.find('.'), tmp.length()).length() == 1) - { - tmp.append("00"); - qce.transAmount->setText(tmp); - } else { - if (tmp.mid(tmp.find('.'), tmp.length()).length() == 2) - { - tmp.append("0"); - qce.transAmount->setText(tmp); - } - } - } - - QString recent; - if (qce.descriptionCombo->count() != 0) - { - QStringList recentlist = QStringList::split(',', originaldata[9], false); - if (recentlist.count() >= 10) - { - recentlist.remove(recentlist.last()); - } - recentlist.prepend(qce.descriptionCombo->lineEdit()->text()); - recent = recentlist.join(","); - } else { - recent = qce.descriptionCombo->lineEdit()->text(); - } - - QString checkNumberString = qce.checkNumber->text(); - if (checkNumberString.isEmpty() == true) - { - checkNumberString = "0"; - } - - QString paymentChecked = "true"; - if (qce.payment->isChecked() == false) - { - paymentChecked = "false"; - } - QStringList returnvalue; - returnvalue << paymentChecked << qce.descriptionCombo->lineEdit()->text() << qce.cmbCategory->lineEdit()->text() << QString::number(qce.transType->currentItem()) << checkNumberString << qce.transAmount->text() << qce.transFee->text() << qce.dateEdit->text() << qce.additionalNotes->text() << recent; - return returnvalue; - } else { - QStringList blank; - return blank; - } -} - -void QCheckEntry::transFeeChanged(const QString &input) -{ - QString tmpinput = input; - if (tmpinput.contains('.') > 1) - { - int first = tmpinput.find('.'); - tmpinput = tmpinput.remove(tmpinput.find('.', (first + 1)), 1); - } - if (tmpinput.contains(QRegExp("\\.[0-9][0-9]{2}$")) >= 1) - { - tmpinput = tmpinput.remove((tmpinput.length() - 1), 1); - } - transFee->setText(tmpinput); -} - -void QCheckEntry::amountChanged(const QString &input) -{ - QString tmpinput = input; - if (tmpinput.contains('.') > 1) - { - int first = tmpinput.find('.'); - tmpinput = tmpinput.remove(tmpinput.find('.', (first + 1)), 1); - } - if (tmpinput.contains(QRegExp("\\.[0-9][0-9]{2}$")) >= 1) - { - tmpinput = tmpinput.remove((tmpinput.length() - 1), 1); - } - transAmount->setText(tmpinput); -} - -void QCheckEntry::accept() -{ - // Does the description combo not have any text in it? Do something if it doesn't! - if (descriptionCombo->lineEdit()->text().isEmpty() == true) - { - QMessageBox::critical(this, "Field Missing.", "You didn't enter a description for this transaction. Please fill out the \"Transaction Description\" field and try again."); - descriptionCombo->setFocus(); - return; - } - QDialog::accept(); -} diff --git a/noncore/apps/checkbook/qcheckentry.h b/noncore/apps/checkbook/qcheckentry.h deleted file mode 100644 index f361bbf..0000000 --- a/noncore/apps/checkbook/qcheckentry.h +++ b/dev/null @@ -1,31 +0,0 @@ -#include -#include -#include "qrestrictedline.h" -#include -#include -#include -#include -#include "qcheckentrybase.h" -#include -#include -#include -#include -#include -#include -#include -#include "config.h" - -class QCheckEntry : public QCheckEntryBase -{ - Q_OBJECT - public: - QCheckEntry(); - static QStringList popupEntry(const QStringList &originaldata); - private slots: - void amountChanged(const QString &); - void transFeeChanged(const QString &); - void paymentClicked(); - void depositClicked(); - protected slots: - virtual void accept(); -}; diff --git a/noncore/apps/checkbook/qchecknamebase.ui b/noncore/apps/checkbook/qchecknamebase.ui deleted file mode 100644 index b9bda19..0000000 --- a/noncore/apps/checkbook/qchecknamebase.ui +++ b/dev/null @@ -1,136 +0,0 @@ - -QCheckNameBase - - QDialog - - name - QCheckNameBase - - - geometry - - 0 - 0 - 228 - 108 - - - - caption - Check Book Name - - - QLabel - - name - TextLabel3 - - - geometry - - 10 - 5 - 70 - 16 - - - - font - - BDF-helvetica - 19 - 1 - - - - text - Name... - - - - QLabel - - name - TextLabel4 - - - geometry - - 10 - 25 - 210 - 25 - - - - text - Please name your check book (limit: 15 characters): - - - alignment - WordBreak|AlignVCenter|AlignLeft - - - wordwrap - - - - QPushButton - - name - cmdDone - - - geometry - - 75 - 80 - 75 - 25 - - - - text - &Done - - - - QRestrictedLine - - name - leText - - - geometry - - 5 - 51 - 216 - 25 - - - - - - - QRestrictedLine -
qrestrictedline.h
- - -1 - -1 - - 0 - - 5 - 5 - - image0 -
-
- - - image0 - 789c6dd23b0ec2300c00d03da7b0e22d42e9476c88232031222186c80c3074813220c4dd214dddd84dac0e759fe2386e1a07a7e3015c639e6318ef04740b0f70d7d730bccf97fdc7d8be87f8406737c62210606869dbb531f531a57f4a299d03a7e06c11cca1055508412c2889acc2ef425423b34840a645f28244936860d2c265d7923bae8b2f05cb35a91739002d2b5727d535cbe954a43ad1e22f700755caf7407cf4799fe286c47dbe3bf303014167a2 - - -
diff --git a/noncore/apps/checkbook/qcheckview.h b/noncore/apps/checkbook/qcheckview.h deleted file mode 100644 index 840dc8b..0000000 --- a/noncore/apps/checkbook/qcheckview.h +++ b/dev/null @@ -1,33 +0,0 @@ -#include "qcheckviewbase.h" -#include "qrestrictedline.h" -#include "qcheckentry.h" -#include "qcheckdetails.h" - -#include -#include "config.h" -#include -#include -#include - -class QCheckView : public QCheckViewBase -{ - Q_OBJECT - public: - QCheckView(QWidget *, QString filename); - void load(const QString filename); - private: - Config *config; - QString calculator(QString largervalue, QString smallervalue, bool subtract); - int lastSortCol; - bool ascend; - QCheckDetails *qcd; - QString m_filename; - private slots: -// void entryActivated(int); - void newClicked(); - void tableClicked(int, int, int, const QPoint &mousePos); - void editClicked(int, int); - void deleteClicked(int, int); - signals: - void reload(const QString &filename); -}; -- cgit v0.9.0.2