summaryrefslogtreecommitdiff
authorchicken <chicken>2004-03-01 19:44:43 (UTC)
committer chicken <chicken>2004-03-01 19:44:43 (UTC)
commit18ea562480a63f504f4dc8e3f46c1db9d2cd6276 (patch) (side-by-side diff)
treede22b70f1da5adeb072f0c30517bd92e9c7a839b
parent8ac7ec5e055dacd8c92d5a28336257cfe3e716e5 (diff)
downloadopie-18ea562480a63f504f4dc8e3f46c1db9d2cd6276.zip
opie-18ea562480a63f504f4dc8e3f46c1db9d2cd6276.tar.gz
opie-18ea562480a63f504f4dc8e3f46c1db9d2cd6276.tar.bz2
fix includes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-write/qcomplextext.cpp3
-rw-r--r--noncore/apps/opie-write/qrichtext.cpp15
-rw-r--r--noncore/apps/opie-write/qstylesheet.cpp2
-rw-r--r--noncore/apps/opie-write/qtextedit.cpp20
-rw-r--r--noncore/apps/oxygen/calcdlgui.cpp1
-rw-r--r--noncore/apps/oxygen/dataTable.cpp3
-rw-r--r--noncore/apps/oxygen/datawidgetui.cpp5
-rw-r--r--noncore/apps/oxygen/kmolcalc.cpp3
-rw-r--r--noncore/apps/oxygen/oxyframe.cpp2
-rw-r--r--noncore/apps/oxygen/oxygen.cpp2
-rw-r--r--noncore/apps/oxygen/psewidget.cpp2
-rwxr-xr-xnoncore/apps/qashmoney/account.cpp2
-rwxr-xr-xnoncore/apps/qashmoney/accountdisplay.cpp2
-rwxr-xr-xnoncore/apps/qashmoney/budgetdisplay.cpp3
-rwxr-xr-xnoncore/apps/qashmoney/newaccount.cpp3
-rwxr-xr-xnoncore/apps/qashmoney/newtransaction.cpp2
-rwxr-xr-xnoncore/apps/qashmoney/preferencedialogs.cpp1
-rwxr-xr-xnoncore/apps/qashmoney/transactiondisplay.cpp3
-rwxr-xr-xnoncore/apps/qashmoney/transferdialog.cpp2
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp1
20 files changed, 0 insertions, 77 deletions
diff --git a/noncore/apps/opie-write/qcomplextext.cpp b/noncore/apps/opie-write/qcomplextext.cpp
index e8b94da..473f184 100644
--- a/noncore/apps/opie-write/qcomplextext.cpp
+++ b/noncore/apps/opie-write/qcomplextext.cpp
@@ -1,138 +1,135 @@
/****************************************************************************
** $Id$
**
** Implementation of some internal classes
**
** Created :
**
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of the kernel module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** 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.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** 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/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** 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 "qcomplextext_p.h"
#include "qrichtext_p.h"
-#include "qfontmetrics.h"
-#include "qrect.h"
#include <stdlib.h>
using namespace Qt3;
// -----------------------------------------------------
/* a small helper class used internally to resolve Bidi embedding levels.
Each line of text caches the embedding level at the start of the line for faster
relayouting
*/
QBidiContext::QBidiContext( uchar l, QChar::Direction e, QBidiContext *p, bool o )
: level(l) , override(o), dir(e)
{
if ( p )
p->ref();
parent = p;
count = 0;
}
QBidiContext::~QBidiContext()
{
if( parent && parent->deref() )
delete parent;
}
/*
Arabic shaping obeys a number of rules according to the joining classes (see Unicode book, section on
arabic).
Each unicode char has a joining class (right, dual (left&right), center (joincausing) or transparent).
transparent joining is not encoded in QChar::joining(), but applies to all combining marks and format marks.
Right join-causing: dual + center
Left join-causing: dual + right + center
Rules are as follows (for a string already in visual order, as we have it here):
R1 Transparent characters do not affect joining behaviour.
R2 A right joining character, that has a right join-causing char on the right will get form XRight
(R3 A left joining character, that has a left join-causing char on the left will get form XLeft)
Note: the above rule is meaningless, as there are no pure left joining characters defined in Unicode
R4 A dual joining character, that has a left join-causing char on the left and a right join-causing char on
the right will get form XMedial
R5 A dual joining character, that has a right join causing char on the right, and no left join causing char on the left
will get form XRight
R6 A dual joining character, that has a left join causing char on the left, and no right join causing char on the right
will get form XLeft
R7 Otherwise the character will get form XIsolated
Additionally we have to do the minimal ligature support for lam-alef ligatures:
L1 Transparent characters do not affect ligature behaviour.
L2 Any sequence of Alef(XRight) + Lam(XMedial) will form the ligature Alef.Lam(XLeft)
L3 Any sequence of Alef(XRight) + Lam(XLeft) will form the ligature Alef.Lam(XIsolated)
The two functions defined in this class do shaping in visual and logical order. For logical order just replace right with
previous and left with next in the above rules ;-)
*/
/*
Two small helper functions for arabic shaping. They get the next shape causing character on either
side of the char in question. Implements rule R1.
leftChar() returns true if the char to the left is a left join-causing char
rightChar() returns true if the char to the right is a right join-causing char
*/
static inline const QChar *prevChar( const QString &str, int pos )
{
//qDebug("leftChar: pos=%d", pos);
pos--;
const QChar *ch = str.unicode() + pos;
while( pos > -1 ) {
if( !ch->isMark() )
return ch;
pos--;
ch--;
}
return &QChar::replacement;
}
static inline const QChar *nextChar( const QString &str, int pos)
{
pos++;
int len = str.length();
const QChar *ch = str.unicode() + pos;
while( pos < len ) {
//qDebug("rightChar: %d isLetter=%d, joining=%d", pos, ch.isLetter(), ch.joining());
if( !ch->isMark() )
return ch;
// assume it's a transparent char, this might not be 100% correct
pos++;
ch++;
}
return &QChar::replacement;
}
diff --git a/noncore/apps/opie-write/qrichtext.cpp b/noncore/apps/opie-write/qrichtext.cpp
index 3b044c3..b77a0fc 100644
--- a/noncore/apps/opie-write/qrichtext.cpp
+++ b/noncore/apps/opie-write/qrichtext.cpp
@@ -1,153 +1,138 @@
/****************************************************************************
** $Id$
**
** Implementation of the internal Qt classes dealing with rich text
**
** Created : 990101
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the kernel module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** 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.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** 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/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** 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 "qrichtext_p.h"
-#include "qstringlist.h"
-#include "qfont.h"
-#include "qtextstream.h"
-#include "qfile.h"
-#include "qapplication.h"
-#include "qmap.h"
-#include "qfileinfo.h"
-#include "qstylesheet.h"
-#include "qmime.h"
-#include "qimage.h"
#include "qdragobject.h"
#include "qpaintdevicemetrics.h"
-#include "qpainter.h"
#include "qdrawutil.h"
-#include "qcursor.h"
-#include "qstack.h"
-#include "qstyle.h"
-#include "qcomplextext_p.h"
#include "qcleanuphandler.h"
#include <stdlib.h>
using namespace Qt3;
static QTextCursor* richTextExportStart = 0;
static QTextCursor* richTextExportEnd = 0;
static QTextFormatCollection *qFormatCollection = 0;
const int border_tolerance = 2;
#ifdef Q_WS_WIN
#include "qt_windows.h"
#endif
#define QChar_linesep QChar(0x2028U)
static inline bool is_printer( QPainter *p )
{
if ( !p || !p->device() )
return FALSE;
return p->device()->devType() == QInternal::Printer;
}
static inline int scale( int value, QPainter *painter )
{
if ( is_printer( painter ) ) {
QPaintDeviceMetrics metrics( painter->device() );
#if defined(Q_WS_X11)
value = value * metrics.logicalDpiY() / QPaintDevice::x11AppDpiY();
#elif defined (Q_WS_WIN)
HDC hdc = GetDC( 0 );
int gdc = GetDeviceCaps( hdc, LOGPIXELSY );
if ( gdc )
value = value * metrics.logicalDpiY() / gdc;
ReleaseDC( 0, hdc );
#elif defined (Q_WS_MAC)
value = value * metrics.logicalDpiY() / 75; // ##### FIXME
#elif defined (Q_WS_QWS)
value = value * metrics.logicalDpiY() / 75;
#endif
}
return value;
}
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void QTextCommandHistory::addCommand( QTextCommand *cmd )
{
if ( current < (int)history.count() - 1 ) {
QPtrList<QTextCommand> commands;
commands.setAutoDelete( FALSE );
for( int i = 0; i <= current; ++i ) {
commands.insert( i, history.at( 0 ) );
history.take( 0 );
}
commands.append( cmd );
history.clear();
history = commands;
history.setAutoDelete( TRUE );
} else {
history.append( cmd );
}
if ( (int)history.count() > steps )
history.removeFirst();
else
++current;
}
QTextCursor *QTextCommandHistory::undo( QTextCursor *c )
{
if ( current > -1 ) {
QTextCursor *c2 = history.at( current )->unexecute( c );
--current;
return c2;
}
return 0;
}
QTextCursor *QTextCommandHistory::redo( QTextCursor *c )
{
if ( current > -1 ) {
if ( current < (int)history.count() - 1 ) {
++current;
return history.at( current )->execute( c );
}
} else {
if ( history.count() > 0 ) {
++current;
return history.at( current )->execute( c );
}
diff --git a/noncore/apps/opie-write/qstylesheet.cpp b/noncore/apps/opie-write/qstylesheet.cpp
index 67cd828..ca634f7 100644
--- a/noncore/apps/opie-write/qstylesheet.cpp
+++ b/noncore/apps/opie-write/qstylesheet.cpp
@@ -1,138 +1,136 @@
/****************************************************************************
** $Id$
**
** Implementation of the QStyleSheet class
**
** Created : 990101
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the kernel module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** 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.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** 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/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** 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 "qstylesheet.h"
#include "qrichtext_p.h"
-#include "qlayout.h"
-#include "qpainter.h"
#include "qcleanuphandler.h"
#include <stdio.h>
using namespace Qt3;
namespace Qt3 {
class QStyleSheetItemData
{
public:
QStyleSheetItem::DisplayMode disp;
int fontitalic;
int fontunderline;
int fontstrikeout;
int fontweight;
int fontsize;
int fontsizelog;
int fontsizestep;
int lineSpacing;
QString fontfamily;
QStyleSheetItem *parentstyle;
QString stylename;
int ncolumns;
QColor col;
bool anchor;
int align;
QStyleSheetItem::VerticalAlignment valign;
int margin[5];
QStyleSheetItem::ListStyle list;
QStyleSheetItem::WhiteSpaceMode whitespacemode;
QString contxt;
bool selfnest;
QStyleSheet* sheet;
};
}
/*!
\class QStyleSheetItem qstylesheet.h
\brief The QStyleSheetItem class provides an encapsulation of a set of text styles.
\ingroup text
A style sheet item consists of a name and a set of attributes that
specifiy its font, color, etc. When used in a \link QStyleSheet
style sheet\endlink (see styleSheet()), items define the name() of
a rich text tag and the display property changes associated with
it.
The \link QStyleSheetItem::DisplayMode display mode\endlink
attribute indicates whether the item is a block, an inline element
or a list element; see setDisplayMode(). The treatment of
whitespace is controlled by the \link
QStyleSheetItem::WhiteSpaceMode white space mode\endlink; see
setWhiteSpaceMode(). An item's margins are set with setMargin(),
In the case of list items, the list style is set with
setListStyle(). An item may be a hypertext link anchor; see
setAnchor(). Other attributes are set with setAlignment(),
setVerticalAlignment(), setFontFamily(), setFontSize(),
setFontWeight(), setFontItalic(), setFontUnderline(),
setFontStrikeOut and setColor().
*/
/*! \enum QStyleSheetItem::AdditionalStyleValues
\internal
*/
/*!
\enum QStyleSheetItem::WhiteSpaceMode
This enum defines the ways in which QStyleSheet can treat
whitespace.
\value WhiteSpaceNormal any sequence of whitespace (including
line-breaks) is equivalent to a single space.
\value WhiteSpacePre whitespace must be output exactly as given
in the input.
\value WhiteSpaceNoWrap multiple spaces are collapsed as with
WhiteSpaceNormal, but no automatic line-breaks occur. To break
lines manually, use the \c{<br>} tag.
*/
/*!
\enum QStyleSheetItem::Margin
\value MarginLeft left margin
\value MarginRight right margin
\value MarginTop top margin
\value MarginBottom bottom margin
\value MarginAll all margins (left, right, top and bottom)
\value MarginVertical top and bottom margins
\value MarginHorizontal left and right margins
diff --git a/noncore/apps/opie-write/qtextedit.cpp b/noncore/apps/opie-write/qtextedit.cpp
index 82401c6..27dd515 100644
--- a/noncore/apps/opie-write/qtextedit.cpp
+++ b/noncore/apps/opie-write/qtextedit.cpp
@@ -1,158 +1,138 @@
/****************************************************************************
** $Id$
**
** Implementation of the QTextEdit class
**
** Created : 990101
**
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
**
** This file is part of the widgets module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** 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.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** 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/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** 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 "qtextedit.h"
#include "qrichtext_p.h"
-#include "qpainter.h"
-#include "qpen.h"
-#include "qbrush.h"
-#include "qpixmap.h"
-#include "qfont.h"
-#include "qcolor.h"
-#include "qstyle.h"
-#include "qsize.h"
-#include "qevent.h"
-#include "qtimer.h"
-#include "qapplication.h"
#include "qlistbox.h"
-#include "qvbox.h"
-#include "qapplication.h"
#include "qclipboard.h"
-#include "qcolordialog.h"
-#include "qfontdialog.h"
-#include "qstylesheet.h"
-#include "qdragobject.h"
-#include "qurl.h"
-#include "qcursor.h"
-#include "qregexp.h"
#include "qpopupmenu.h"
#define ACCEL_KEY(k) "\t" + QString("Ctrl+" #k)
using namespace Qt3;
static bool qt_enable_richtext_copy = FALSE;
struct QUndoRedoInfoPrivate
{
QTextString text;
};
namespace Qt3 {
class QTextEditPrivate
{
public:
QTextEditPrivate()
:preeditStart(-1),preeditLength(-1),ensureCursorVisibleInShowEvent(FALSE)
{
for ( int i=0; i<7; i++ )
id[i] = 0;
}
int id[ 7 ];
int preeditStart;
int preeditLength;
bool ensureCursorVisibleInShowEvent;
QString scrollToAnchor; // used to deferr scrollToAnchor() until the show event when we are resized
};
}
static bool block_set_alignment = FALSE;
/*!
\class QTextEdit qtextedit.h
\brief The QTextEdit widget provides a powerful single-page rich text editor.
\ingroup basic
\ingroup text
\mainclass
\tableofcontents
\section1 Introduction and Concepts
QTextEdit is an advanced WYSIWYG viewer/editor supporting rich
text formatting using HTML-style tags. It is optimized to handle
large documents and to respond quickly to user input.
QTextEdit has three modes of operation:
\table
\header \i Mode \i Command \i Notes
\row \i Plain Text Editor \i setTextFormat(PlainText)
\i Set text with setText(); text() returns plain text. Text
attributes (e.g. colors) can be set, but plain text is always
returned.<sup>1.</sup>
\row \i Rich Text Editor \i setTextFormat(RichText)
\i Set text with setText(); text() returns rich text. Rich
text editing is fairly limited. You can't set margins or
insert images for example (although you can read and
correctly display files that have margins set and that
include images). This mode is mostly useful for editing small
amounts of rich text. <sup>2.</sup>
\row \i Text Viewer<sup>3.</sup> \i setReadOnly(TRUE)
\i Set text with setText() or append() (which has no undo
history so is faster and uses less memory); text() returns
plain or rich text depending on the textFormat(). This mode
can correctly display a large subset of HTML tags.
\endtable
<sup>1.</sup><small>We do \e not recommend using QTextEdit to
create syntax highlighting editors because the current API is
insufficient for this purpose. We hope to release a more complete
API that will support syntax highlighting in a later
release.</small>
<sup>2.</sup><small>A more complete API that supports setting
margins, images, etc., is planned for a later Qt release.</small>
<sup>3.</sup><small>Qt 3.1 will provide a Log Viewer mode which is
optimised for the fast and memory efficient display of large
amounts of read only text.</small>
We recommend that you always call setTextFormat() to set the mode
you want to use. If you use \c AutoText then setText() and
append() will try to determine whether the text they are given is
plain text or rich text. If you use \c RichText then setText() and
append() will assume that the text they are given is rich text.
insert() simply inserts the text it is given.
QTextEdit works on paragraphs and characters. A paragraph is a
formatted string which is word-wrapped to fit into the width of
the widget. By default when reading plain text, two newlines
signify a paragraph. A document consists of zero or more
diff --git a/noncore/apps/oxygen/calcdlgui.cpp b/noncore/apps/oxygen/calcdlgui.cpp
index f8dfde5..2bb8337 100644
--- a/noncore/apps/oxygen/calcdlgui.cpp
+++ b/noncore/apps/oxygen/calcdlgui.cpp
@@ -1,64 +1,63 @@
/***************************************************************************
application: : Oxygen
begin : September 2002
copyright : ( C ) 2002 by Carsten Niehaus
email : cniehaus@handhelds.org
**************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
-#include "oxygen.h"
#include "calcdlgui.h"
#include "kmolcalc.h"
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qpushbutton.h>
calcDlgUI::calcDlgUI() : CalcDlg()
{
kmolcalc = new KMolCalc;
connect( calculate, SIGNAL( clicked() ), this, SLOT( calc() ) );
connect( clear_fields, SIGNAL( clicked() ), this, SLOT( clear() ) );
result->setReadOnly( true );
}
void calcDlgUI::calc()
{
QString compound( formula->text() );
if ( compound.isEmpty() ) {
clear();
return;
}
QString errors( kmolcalc->readFormula( compound ) );
QString mw, ea;
double weight = kmolcalc->getWeight();
if ( errors == "OK" ) {
mw.setNum( weight );
ea = kmolcalc->getEmpFormula() + " :\n" + kmolcalc->getEA();
} else {
mw = "???";
ea = tr( "ERROR: \n" ).arg( errors )+ "\n";
}
result->setText( mw );
anal_display->setText( ea );
}
/**
* * Clear all text entry / result fields.
* */
void calcDlgUI::clear()
{
formula->clear();
result->clear();
anal_display->clear();
}
diff --git a/noncore/apps/oxygen/dataTable.cpp b/noncore/apps/oxygen/dataTable.cpp
index e3906be..48e2b20 100644
--- a/noncore/apps/oxygen/dataTable.cpp
+++ b/noncore/apps/oxygen/dataTable.cpp
@@ -1,124 +1,121 @@
/***************************************************************************
application: : Oxygen
begin : September 2002
copyright : ( C ) 2002 by Carsten Niehaus
email : cniehaus@handhelds.org
**************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include <qpe/config.h>
#include "dataTable.h"
-#include <qwidget.h>
#include <qhbox.h>
#include <qlabel.h>
-#include <qfont.h>
#include <qlayout.h>
#include <qpe/qpeapplication.h>
-#include <qstringlist.h>
OxydataWidget::OxydataWidget(QWidget *parent, const char *name, const QStringList &list ) : QWidget( parent,name ), names( list )
{
QGridLayout *qgrid = new QGridLayout( this, 2,1 );
QHBox *hbox = new QHBox( this );
left = new QLabel( hbox );
middle = new QLabel( hbox );
right = new QLabel( hbox );
right->setAlignment( AlignRight );
middle->setAlignment( AlignHCenter );
QFont bf;
bf.setBold( true );
bf.setPointSize( bf.pointSize()+2 );
middle->setFont( bf );
DataTable = new OxydataTable( 9,2, this );
setTable();
qgrid->addWidget( hbox,0,0 );
qgrid->addWidget( DataTable,1,0 );
}
void OxydataWidget::setElement( int el )
{
QStringList::ConstIterator it = names.at(el);
Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
configobj.setGroup( QString::number( el+1 ));
left->setText( configobj.readEntry( "Symbol" ) );
middle->setText( *it );
right->setText( QString::number( el+1 ) );
DataTable->setText( 0,1,tr( "%1 u" ).arg( configobj.readEntry( "Weight" ) ) );
DataTable->setText( 1,1,configobj.readEntry( "Block" ) );
DataTable->setText( 2,1,configobj.readEntry( "Group" ) );
DataTable->setText( 3,1,configobj.readEntry( "EN" ) );
DataTable->setText( 4,1,tr( "%1 pm" ).arg( configobj.readEntry( "AR" ) ) ) ;
DataTable->setText( 5,1,tr( "%1 J" ).arg( configobj.readEntry( "IE" ) ) );
DataTable->setText( 6,1,tr( "%1 g/cm^3" ).arg( configobj.readEntry( "Density" ) ) );
DataTable->setText( 7,1,tr( "%1 K" ).arg( configobj.readEntry( "BP" ) ) );
DataTable->setText( 8,1,tr( "%1 K" ).arg( configobj.readEntry( "MP" ) ) );
}
void OxydataWidget::setTable() const
{
DataTable->setText( 0,0, tr( "Weight" ) );
DataTable->setText( 1,0, tr( "Block" )) ;
DataTable->setText( 2,0, tr( "Group" )) ;
DataTable->setText( 3,0, tr( "Electronegativity" )) ;
DataTable->setText( 4,0, tr( "Atomic radius" )) ;
DataTable->setText( 5,0, tr( "Ionization Energy" )) ;
DataTable->setText( 6,0, tr( "Density" )) ;
DataTable->setText( 7,0, tr( "Boiling point" ) );
DataTable->setText( 8,0, tr( "Melting point" ) );
}
void OxydataWidget::setLayout()
{
#warning this is not working and I have no idea why!
// DataTable->setColumnWidth ( 0 , this->width()/2 );
// DataTable->setColumnWidth ( 1 , this->width()/2 );
//X DataTable->setColumnWidth ( 0 , 110 );
//X DataTable->setColumnWidth ( 1 , 110 );
}
OxydataTable::OxydataTable(int numRows, int numCols, QWidget *parent,
const char *name) : QTable(numRows, numCols,parent, name)
{
for (int zeile = 0; zeile < numRows; zeile++)
for ( int spalte = 0; spalte < numCols; spalte++ )
{
OxydataQTI *testus = new OxydataQTI (this, OxydataQTI::Never, "hm" );
setItem(zeile, spalte, (QTableItem*)testus);
}
this->setShowGrid( false );
this->setHScrollBarMode(QScrollView::AlwaysOff);
this->horizontalHeader()->hide();
this->verticalHeader()->hide();
this->setTopMargin( 0 );
this->setLeftMargin( 0 );
}
void OxydataTable::paintCell( QPainter *p, int row, int col, const QRect &cr, bool selected)
{
if ( cr.width() == 0 || cr.height() == 0 )
return;
selected = FALSE;
diff --git a/noncore/apps/oxygen/datawidgetui.cpp b/noncore/apps/oxygen/datawidgetui.cpp
index e1d6e41..dcb80e5 100644
--- a/noncore/apps/oxygen/datawidgetui.cpp
+++ b/noncore/apps/oxygen/datawidgetui.cpp
@@ -1,53 +1,48 @@
/***************************************************************************
application: : Oxygen
begin : September 2002
copyright : ( C ) 2002 by Carsten Niehaus
email : cniehaus@handhelds.org
**************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include "datawidgetui.h"
#include "dataTable.h"
-#include <qpe/config.h>
-#include <qstring.h>
#include <qcombobox.h>
#include <qlayout.h>
-#include <qhbox.h>
-#include <qlabel.h>
-#include <qpe/qpeapplication.h>
dataWidgetUI::dataWidgetUI(const QStringList &list) : QWidget()
{
names = list;
this->setCaption( tr( "Chemical Data" ));
QGridLayout *qgrid = new QGridLayout( this, 2,1 );
dataCombo = new QComboBox( this );
//read in all names of the 118 elements
int i = 0;
for ( QStringList::ConstIterator it = names.begin() ; it != names.end() ; ++it,i++)
{
dataCombo->insertItem( QString::number( i+1 )+" - "+*it );
}
OxydataWidget *oxyDW = new OxydataWidget(this, "OxydataWidget_oxyDW", names);
connect ( dataCombo, SIGNAL( activated(int) ), oxyDW, SLOT( setElement(int) ) );
oxyDW->setElement( 0 );
oxyDW->setLayout();
qgrid->addWidget( dataCombo, 0,0);
qgrid->addWidget( oxyDW , 1,0 );
}
diff --git a/noncore/apps/oxygen/kmolcalc.cpp b/noncore/apps/oxygen/kmolcalc.cpp
index 7a47942..b9f5209 100644
--- a/noncore/apps/oxygen/kmolcalc.cpp
+++ b/noncore/apps/oxygen/kmolcalc.cpp
@@ -1,113 +1,110 @@
/*
* kmolcalc.cpp
*
* Copyright (C) 2000,2001 Tomislav Gountchev <tomi@idiom.com>
* Copyright (C) 2002 Carsten Niehaus <cniehaus@handhelds.org>
*/
/**
* KMOLCALC is the calculation engine. It knows about a hashtable of user defined atomic
* weights and group definitions ELSTABLE, and the currently processed formula, stored
* as a list of elements and their coefficients, ELEMENTS.
*/
#include "kmolcalc.h"
-#include <qdict.h>
-#include <qdir.h>
-#include <qfile.h>
#include <qpe/qpeapplication.h>
/**
* Construct a new calculator object.
*/
KMolCalc::KMolCalc() {
elements = new ElementList;
elstable = NULL;
readElstable();
}
KMolCalc::~KMolCalc() {
delete elements;
}
void KMolCalc::readElstable() {
weight = -1; // not calculated yet
if (elstable) delete elstable;
elstable = new QDict<SubUnit> (197, TRUE);
elstable->setAutoDelete(TRUE);
mwfile = QPEApplication::qpeDir() +"share/oxygen/kmolweights";
QFile f(mwfile);
if (f.exists()) readMwfile(f);
}
/**
* Parse a string S and construct the ElementList this->ELEMENTS, representing the
* composition of S. Returns 0 if successful, or an error code (currently -1) if
* parsing failed.
* The elements is S must be valid element or group symbols, as stored in this->ELSTABLE.
* See help files for correct formula syntax.
*/
QString KMolCalc::readFormula(const QString& s) {
weight = -1;
if (elements) delete elements;
elements = new ElementList;
return KMolCalc::readGroup(s, elements);
}
// read a formula group recursively. Called by readFormula.
QString KMolCalc::readGroup(const QString& s, ElementList* els) {
if (s.isEmpty()) return QString ("Enter a formula."); //ERROR
int sl = s.length();
int i = 0;
QString errors ("OK");
bool ok = TRUE;
while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++;
double prefix = (i == 0 ? 1 : s.left(i).toDouble(&ok));
if (! ok || i == sl || prefix == 0) return QString ("Bad formula."); // ERROR
ElementList* elstemp = new ElementList;
while (i < sl) {
int j = i;
if (s[i] == '(') {
ElementList* inner = new ElementList;
int level = 1; // count levels of nested ( ).
while (1) {
if (i++ == sl) {
delete inner;
delete elstemp;
return QString ("Bad formula."); //ERROR
}
if (s[i] == '(') level++;
if (s[i] == ')') level--;
if (level == 0) break;
}
errors = KMolCalc::readGroup(s.mid(j+1, i-j-1), inner);
j = ++i;
while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++;
double suffix = (i == j ? 1 : s.mid(j, i-j).toDouble(&ok));
if (! ok || suffix == 0) {
delete inner;
delete elstemp;
return QString ("Bad formula."); // ERROR
}
inner->addTo(*elstemp, suffix);
delete inner;
inner = NULL;
} else if ((s[i] >= 'A' && s[i] <= 'Z') || (s[i] >= 'a' && s[i] <= 'z')) {
while (++i < sl && ((s[i] >= 'a' && s[i] <= 'z') || s[i] == '*' ||
s[i] == '\''));
QString elname = s.mid(j, i-j);
j = i;
while (i < sl && ((s[i] <= '9' && s[i] >= '0') || s[i] == '.')) i++;
double suffix = (i == j ? 1 : s.mid(j, i-j).toDouble(&ok));
if (! ok || suffix == 0) {
delete elstemp;
return QString ("Bad formula."); // ERROR
}
SubUnit* group = elstable->find(elname);
if (group == 0) {
delete elstemp;
return QString ("Undefined symbol: ") + elname; //ERROR
}
group->addTo(*elstemp, suffix);
diff --git a/noncore/apps/oxygen/oxyframe.cpp b/noncore/apps/oxygen/oxyframe.cpp
index 5a4dbbe..8cc520e 100644
--- a/noncore/apps/oxygen/oxyframe.cpp
+++ b/noncore/apps/oxygen/oxyframe.cpp
@@ -1,41 +1,39 @@
/***************************************************************************
application: : Oxygen
begin : September 2002
copyright : ( C ) 2002 by Carsten Niehaus
email : cniehaus@handhelds.org
**************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
-#include "oxygen.h"
-#include <qpe/config.h>
#include "oxyframe.h"
OxyFrame::OxyFrame(QWidget *parent, const char *name, QString symbol )
: QLabel(parent,name)
{
N = name;
this->setFrameStyle( QFrame::Box );
this->setLineWidth( 0 );
this->setMidLineWidth( 1 );
this->setFrameShadow( QFrame::Sunken );
setMinimumSize(6,6);
setScaledContents( true );
QFont font;
font.setWeight(QFont::Light);
font.setPixelSize(3);
setFont( font );
setText( symbol );
}
void OxyFrame::mousePressEvent ( QMouseEvent* /*e*/ ){
emit num( N );
};
diff --git a/noncore/apps/oxygen/oxygen.cpp b/noncore/apps/oxygen/oxygen.cpp
index 5bdc2aa..5ea97bf 100644
--- a/noncore/apps/oxygen/oxygen.cpp
+++ b/noncore/apps/oxygen/oxygen.cpp
@@ -1,118 +1,116 @@
/***************************************************************************
application: : Oxygen
begin : September 2002
copyright : ( C ) 2002 by Carsten Niehaus
email : cniehaus@handhelds.org
**************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include "oxygen.h"
-#include <qapplication.h>
#include <qtabwidget.h>
-#include "calcdlg.h"
#include "calcdlgui.h"
#include "datawidgetui.h"
#include "psewidget.h"
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") );
names.append( tr("Lithium") );
names.append( tr("Beryllium") );
names.append( tr("Boron") );
names.append( tr("Carbon") );
names.append( tr("Nitrogen") );
names.append( tr("Oxygen") );
names.append( tr("Fluorine") );
names.append( tr("Neon") );
names.append( tr("Sodium") );
names.append( tr("Magnesium") );
names.append( tr("Aluminum") );
names.append( tr("Silicon") );
names.append( tr("Phosphorus") );
names.append( tr("Sulfur") );
names.append( tr("Chlorine") );
names.append( tr("Argon") );
names.append( tr("Potassium") );
names.append( tr("Calcium") );
names.append( tr("Scandium") );
names.append( tr("Titanium") );
names.append( tr("Vanadium") );
names.append( tr("Chromium") );
names.append( tr("Manganese") );
names.append( tr("Iron") );
names.append( tr("Cobalt") );
names.append( tr("Nickel") );
names.append( tr("Copper") );
names.append( tr("Zinc") );
names.append( tr("Gallium") );
names.append( tr("Germanium") );
names.append( tr("Arsenic") );
names.append( tr("Selenium") );
names.append( tr("Bromine") );
names.append( tr("Krypton") );
names.append( tr("Rubidium") );
names.append( tr("Strontium") );
names.append( tr("Yttrium") );
names.append( tr("Zirconium") );
names.append( tr("Niobium") );
names.append( tr("Molybdenum") );
names.append( tr("Technetium") );
names.append( tr("Ruthenium") );
names.append( tr("Rhodium") );
names.append( tr("Palladium") );
names.append( tr("Silver") );
names.append( tr("Cadmium") );
names.append( tr("Indium") );
names.append( tr("Tin") );
names.append( tr("Antimony") );
names.append( tr("Tellurium") );
names.append( tr("Iodine") );
names.append( tr("Xenon") );
names.append( tr("Cesium") );
names.append( tr("Barium") );
names.append( tr("Lanthanum") );
names.append( tr("Cerium") );
names.append( tr("Praseodymium") );
names.append( tr("Neodymium") );
names.append( tr("Promethium") );
names.append( tr("Samarium") );
names.append( tr("Europium") );
names.append( tr("Gadolinium") );
names.append( tr("Terbium") );
names.append( tr("Dysprosium") );
names.append( tr("Holmium") );
names.append( tr("Erbium") );
names.append( tr("Thulium") );
names.append( tr("Ytterbium") );
names.append( tr("Lutetium") );
names.append( tr("Hafnium") );
diff --git a/noncore/apps/oxygen/psewidget.cpp b/noncore/apps/oxygen/psewidget.cpp
index be5185b..7f7ae0c 100644
--- a/noncore/apps/oxygen/psewidget.cpp
+++ b/noncore/apps/oxygen/psewidget.cpp
@@ -1,120 +1,118 @@
/***************************************************************************
application: : Oxygen
begin : September 2002
copyright : ( C ) 2002, 2003 by Carsten Niehaus
email : cniehaus@handhelds.org
**************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
#include <qpe/config.h>
#include <qlayout.h>
#include <qpe/qpeapplication.h>
-#include <qlist.h>
#include "dataTable.h"
#include "psewidget.h"
-#include "oxyframe.h"
PSEWidget::PSEWidget(const QStringList &list) : QWidget()
{
this->setCaption( tr( "Periodic System" ) );
lastElement=1;
names = list;
QVBoxLayout *vlay = new QVBoxLayout( this );
QGridLayout *grid = new QGridLayout( 18,10 );
int h=0, v=0;
Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
for( int n = 0 ; n < 109 ; n++ )
{
configobj.setGroup( QString::number( n+1 ));
position( n+1,h,v );
PSEframe.append( new OxyFrame( this , QString::number(n), configobj.readEntry( "Symbol" ) ) );
grid->addWidget( PSEframe.current() , v/40+1 , h/40 );
PSEframe.current()->setMinimumHeight( 11 );
PSEframe.current()->setPalette( QPalette( PSEColor( configobj.readEntry( "Block" ) ) ) );
connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( slotShowElement(QString) ));
connect( PSEframe.current(), SIGNAL( num(QString) ), this, SLOT( inverseColor(QString) ));
}
oxyDW = new OxydataWidget(this, "PSEWidget_oxyDW", names);
oxyDW->setElement( 0 );
oxyDW->setLayout();
vlay->addLayout( grid );
vlay->addWidget( oxyDW );
}
QColor PSEWidget::PSEColor( QString block ) const
{
QColor c;
if ( block == "s" ) c.setRgb( 213 , 233 , 231 );
else if ( block == "d" ) c.setRgb( 200,230,160 );
else if ( block == "p" ) c.setRgb( 238,146,138 );
else if ( block == "f" ) c.setRgb( 190 , 190 , 190 );
return c;
};
void PSEWidget::inverseColor( QString number)
{
Config configobj( QPEApplication::qpeDir() +"share/oxygen/oxygendata", Config::File );
configobj.setGroup( number );
QString block = configobj.readEntry( "Block" );
QColor c, d;
c = PSEColor( block );
d = c.dark();
PSEframe.at( number.toUInt() )->setPalette( QPalette( d ) );
configobj.setGroup( QString::number( lastElement+1 ) );
block = configobj.readEntry( "Block" );
c = PSEColor( block );
PSEframe.at( lastElement )->setPalette( QPalette( c ) );
lastElement=number.toInt();
}
void PSEWidget::slotShowElement(QString number)
{
oxyDW->setElement( number.toInt() );
};
void PSEWidget::position(int n, int& h, int& v)
{
//Hydrogen
if (n == 1)
{
h=0; v=0;
}
//Helium
if (n == 2)
{
h=680; v=0;
}
//Lithium
if (n == 3)
{
h=0; v=40;
}
//Beryllium
if (n == 4)
{
diff --git a/noncore/apps/qashmoney/account.cpp b/noncore/apps/qashmoney/account.cpp
index 181be23..f21598e 100755
--- a/noncore/apps/qashmoney/account.cpp
+++ b/noncore/apps/qashmoney/account.cpp
@@ -1,99 +1,97 @@
#include "account.h"
-#include "transaction.h"
-#include "transfer.h"
#include "preferences.h"
#include <qpixmap.h>
#include <stdlib.h>
extern Preferences *preferences;
Account::Account ()
{
adb = sqlite_open ( "qmaccounts.db", 0, NULL );
}
Account::~Account ()
{
sqlite_close ( adb );
}
void Account::addAccount ( QString name, int parentid, float balance, int type, QString description, float creditlimit,
int statementyear, int statementmonth, int statementday, float statementbalance, const char *currency )
{
sqlite_exec_printf ( adb, "insert into accounts2 values ( '%q', %i, %.2f, %i, '%q', %.2f, %i, %i, %i, %.2f, '%q', 0, 0, 0, 0, 0, NULL );", 0, 0, 0,
(const char *) name, parentid, balance, type, (const char *) description, creditlimit, statementyear, statementmonth, statementday, statementbalance, currency );
}
void Account::updateAccount ( QString name, QString description, QString currencycode, int accountid )
{
sqlite_exec_printf ( adb, "update accounts2 set name = '%q', description = '%q', currency = '%q' where accountid = %i;", 0, 0, 0, ( const char * ) name, ( const char * ) description, ( const char * ) currencycode, accountid );
}
void Account::deleteAccount ( int accountid )
{
sqlite_exec_printf ( adb, "delete from accounts2 where accountid = %i;", 0, 0, 0, accountid );
}
void Account::setAccountExpanded ( int expanded, int accountid )
{
sqlite_exec_printf ( adb, "update accounts2 set r1 = %i where accountid = %i;", 0, 0, 0, expanded, accountid );
}
int Account::getAccountExpanded ( int id )
{
char **results;
sqlite_get_table_printf ( adb, "select r1 from accounts2 where accountid = %i;", &results, 0, 0, 0, id );
if ( strlen ( results [1] ) == 0 )
return 0;
else
return atoi ( results [ 1 ] );
}
int Account::getNumberOfAccounts ()
{
char **results;
sqlite_get_table ( adb, "select count() from accounts2;", &results, NULL, NULL, NULL );
return atoi ( results [ 1 ] );
}
int Account::getNumberOfChildAccounts ( int id )
{
char **results;
sqlite_get_table_printf ( adb, "select count() from accounts2 where parent = %i;", &results, NULL, NULL, NULL, id );
return atoi ( results [ 1 ] );
}
void Account::updateAccountBalance ( int accountid )
{
// Here, we'll get a balance for the transactions in an account
sqlite *tdb = sqlite_open ( "qmtransactions.db", 0, NULL );
int rows, columns;
char **results;
sqlite_get_table_printf ( tdb, "select sum (amount) from transactions where accountid= %i;", &results, &rows, &columns, NULL, accountid );
float transactionsbalance = strtod ( results [ 1 ], 0 );
sqlite_close ( tdb );
// next, we'll get a balance for all the transfers from the account
sqlite *trdb = sqlite_open ( "qmtransfers.db", 0, NULL );
rows = 0;
columns = 0;
char **results2;
sqlite_get_table_printf ( trdb, "select sum (amount) from transfers where fromaccount = %i;", &results2, &rows, &columns, NULL, accountid );
float fromtransfersbalance = ( strtod ( results2 [ 1 ], 0 ) * -1 );
// finally, we'll get a balance for all the transfers into the account
rows = 0;
columns= 0;
char **results3;
sqlite_get_table_printf ( trdb, "select sum (amount) from transfers where toaccount = %i;", &results3, &rows, &columns, NULL, accountid );
float totransfersbalance = strtod ( results3 [ 1 ], 0 );
sqlite_close ( trdb );
// calculate and update new balance
sqlite_exec_printf ( adb, "update accounts2 set balance = %.2f where accountid = %i;", 0, 0, 0,
( transactionsbalance + fromtransfersbalance + totransfersbalance + getStatementBalance ( accountid ) ), accountid );
}
void Account::changeParentAccountBalance ( int parentid )
diff --git a/noncore/apps/qashmoney/accountdisplay.cpp b/noncore/apps/qashmoney/accountdisplay.cpp
index d0ba82a..5ef5454 100755
--- a/noncore/apps/qashmoney/accountdisplay.cpp
+++ b/noncore/apps/qashmoney/accountdisplay.cpp
@@ -1,105 +1,103 @@
-#include <qdatetime.h>
#include <qmessagebox.h>
#include <qheader.h>
#include "accountdisplay.h"
#include "newaccount.h"
#include "transaction.h"
#include "transferdialog.h"
-#include "preferences.h"
#include "transfer.h"
extern Account *account;
extern Transaction *transaction;
extern Transfer *transfer;
extern Preferences *preferences;
AccountDisplay::AccountDisplay ( QWidget *parent ) : QWidget ( parent )
{
cleared = 0;
firstline = new QHBox ( this );
firstline->setSpacing ( 2 );
newaccount = new QPushButton ( firstline );
newaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") );
connect ( newaccount, SIGNAL ( released () ), this, SLOT ( addAccount () ) );
editaccount = new QPushButton ( firstline );
editaccount->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/edit.png") );
connect ( editaccount, SIGNAL ( released () ), this, SLOT ( editAccount () ) );
deleteaccount = new QPushButton ( firstline );
deleteaccount->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") );
connect ( deleteaccount, SIGNAL ( released () ), this, SLOT ( deleteAccount () ) );
transferbutton = new QPushButton ( firstline );
transferbutton->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/transfer.png") );
transferbutton->setToggleButton ( TRUE );
connect ( transferbutton, SIGNAL ( toggled ( bool ) ), this, SLOT ( accountTransfer ( bool ) ) );
listview = new QListView ( this );
listview->setAllColumnsShowFocus ( TRUE );
listview->setShowSortIndicator ( TRUE );
listview->setRootIsDecorated ( TRUE );
listview->setMultiSelection ( FALSE );
connect ( listview, SIGNAL ( expanded ( QListViewItem * ) ), this, SLOT ( setAccountExpanded ( QListViewItem * ) ) );
connect ( listview, SIGNAL ( collapsed ( QListViewItem * ) ), this, SLOT ( setAccountCollapsed ( QListViewItem * ) ) );
listview->header()->setTracking ( FALSE );
connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) );
connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) );
layout = new QVBoxLayout ( this, 2, 5 );
layout->addWidget ( firstline );
layout->addWidget ( listview );
}
void AccountDisplay::setTabs ( QWidget *newtab2, QTabWidget *newtabs )
{
tab2 = newtab2;
maintabs = newtabs;
}
void AccountDisplay::addAccount ()
{
// initialize local variables
int parentid = 0;
type = 0;
QString parentlist [ listview->childCount() + 1 ] [ 3 ] ;
// create new account window for entering data
NewAccount *newaccount = new NewAccount ( this );
int width = this->width();
newaccount->accountbox->setMaximumWidth ( ( int ) ( width * 0.5 ) );
newaccount->datebox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
newaccount->childbox->setMaximumWidth ( ( int ) ( width * 0.5 ) );
newaccount->balancebox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
newaccount->creditlimitbox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
// if there are no accounts, disable the child check box
if ( account->getNumberOfAccounts () == 0 )
newaccount->childcheckbox->setEnabled ( FALSE );
// if there are accounts, fill up the pulldown menu for
// selecting a parent account. We should only add those parents without transactions
else
{
int c = 0;
QListViewItemIterator it ( listview );
for ( ; it.current(); ++it )
{
int id = it.current()->text ( getIDColumn() ).toInt();
// iterate through accountdisplay listview and add parents with no transactions
// add this item to the list box only if it is a parent and has no transactions
if ( transfer->getNumberOfTransfers ( id ) == 0 && transaction->getNumberOfTransactions ( id ) == 0 && it.current()->parent() == 0 )
{
newaccount->childbox->insertItem ( it.current()->text ( 0 ) );
parentlist [ c ] [ 0 ] = it.current()->text ( 0 );
parentlist [ c ] [ 1 ] = it.current()->text ( getIDColumn() );
parentlist [ c ] [ 2 ] = QString::number ( c );
c++;
}
}
}
diff --git a/noncore/apps/qashmoney/budgetdisplay.cpp b/noncore/apps/qashmoney/budgetdisplay.cpp
index 492595a..d4047bf 100755
--- a/noncore/apps/qashmoney/budgetdisplay.cpp
+++ b/noncore/apps/qashmoney/budgetdisplay.cpp
@@ -1,106 +1,103 @@
#include <qmessagebox.h>
#include <qheader.h>
-#include <qfont.h>
#include <sqlite.h>
#include "budgetdisplay.h"
#include "budget.h"
-#include "newaccount.h"
#include "datepicker.h"
-#include "preferences.h"
#include "transaction.h"
extern Preferences *preferences;
extern Budget *budget;
extern Transaction *transaction;
BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent )
{
QFont font = this->font();
font.setWeight ( QFont::Bold );
//set the default date to today
newDate = QDate::currentDate ();
year = newDate.year();
month = newDate.month();
day = newDate.day();
datelabel = preferences->getDate ( year, month );
setCaption ( "Budget" );
firstline = new QHBox ( this );
firstline->setSpacing ( 2 );
secondline = new QHBox ( this );
secondline->setSpacing ( 10 );
menu = new QMenuBar ( this );
menu->setFrameStyle ( QFrame::Box | QFrame::Sunken );
budgetmenu = new QPopupMenu ( this );
lineitemsmenu = new QPopupMenu ( this );
datemenu = new QPopupMenu ( this );
menu->insertItem ( "Budget", budgetmenu );
menu->insertItem ( "Line Item", lineitemsmenu );
menu->insertItem ( "Date", datemenu );
budgetmenu->insertItem ( "New", this, SLOT ( newBudget () ), 0, 1 );
budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget () ), 0, 2 );
budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget () ), 0, 3 );
lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem () ), 0, 1 );
lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem () ), 0, 2 );
lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem () ), 0, 3 );
datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) );
budgetbox = new QComboBox ( firstline );
connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) );
budgetview = new QComboBox ( firstline );
budgetview->insertItem ( "Month" );
budgetview->insertItem ( "Year" );
connect ( budgetview, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentView ( int ) ) );
budgeted = new QLabel ( secondline );
budgeted->setFont ( font );
actual = new QLabel ( secondline );
actual->setFont ( font );
date = new QLabel ( secondline );
date->setFont ( font );
listview = new QListView ( this );
listview->setAllColumnsShowFocus ( TRUE );
listview->setShowSortIndicator ( TRUE );
listview->setRootIsDecorated ( TRUE );
listview->setMultiSelection ( FALSE );
listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13
listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14
listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15
listview->addColumn ( "", 0 ); // line item ids
listview->setColumnWidthMode ( 0, QListView::Manual );
listview->setColumnWidthMode ( 1, QListView::Manual );
listview->setColumnWidthMode ( 2, QListView::Manual );
listview->setColumnAlignment ( 1, Qt::AlignRight );
listview->setColumnAlignment ( 2, Qt::AlignRight );
listview->setColumnWidthMode ( 3, QListView::Manual );
listview->header()->setTracking ( FALSE );
connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) );
connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) );
// pull the column sorting preference from the preferences table, and configure the listview accordingly
int column = 0;
int direction = 0;
preferences->getSortingPreference ( 3, &column, &direction );
listview->setSorting ( column, direction );
displayBudgetNames();
layout = new QVBoxLayout ( this, 2, 2 );
layout->setMenuBar ( menu );
layout->addWidget ( firstline );
layout->addWidget ( secondline );
layout->addWidget ( listview );
}
void BudgetDisplay::deleteBudget ()
{
listview->clear();
transaction->clearBudgetIDs ( currentbudget );
budget->deleteBudget ( currentbudget );
diff --git a/noncore/apps/qashmoney/newaccount.cpp b/noncore/apps/qashmoney/newaccount.cpp
index 2ad8f60..7e57a18 100755
--- a/noncore/apps/qashmoney/newaccount.cpp
+++ b/noncore/apps/qashmoney/newaccount.cpp
@@ -1,102 +1,99 @@
#include "newaccount.h"
#include "calculator.h"
#include "datepicker.h"
-#include "transaction.h"
-#include "preferences.h"
-#include <qdatetime.h>
#include <qmultilineedit.h>
extern Preferences *preferences;
NewAccount::NewAccount ( QWidget *parent, const char *name, bool modal ) : QDialog ( parent, name, modal )
{
accountdescription = "";
dateedited = FALSE;
setCaption( tr( "Account" ) );
namelabel = new QLabel ( "Account Name", this );
accountbox = new QHBox ( this );
accountname = new QLineEdit ( accountbox );
descriptionbutton = new QPushButton ( accountbox );
descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) );
datelabel = new QLabel ( "Date", this );
datebox = new QHBox ( this );
startdate = new QLineEdit ( datebox );
startdate->setDisabled ( TRUE );
datebutton = new QPushButton ( datebox );
datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
childcheckbox = new QCheckBox ( this );
childcheckbox->setText( tr ( "Child Account" ) );
childlabel = new QLabel ( "Child of", this );
childbox = new QComboBox ( FALSE, this );
hideChildPulldownMenu ();
balancelabel = new QLabel ( "Balance", this );
balancebox = new QHBox ( this );
accountbalance = new QLineEdit ( balancebox );
accountbalance->setText ( "0.00" );
balancecalculator = new QPushButton( balancebox );
balancecalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
creditlimitlabel = new QLabel ( "Credit Limit", this );
creditlimitbox = new QHBox ( this );
creditlimit = new QLineEdit ( creditlimitbox );
creditlimitbox->setEnabled ( FALSE );
creditlimitcalculator = new QPushButton( creditlimitbox );
creditlimitcalculator->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
currencybox = new Currency ( this );
typelabel = new QLabel ( "Type", this );
accounttype = new QComboBox ( FALSE, this );
accounttype->insertItem( tr( "Bank" ) );
accounttype->insertItem( tr( "Cash" ) );
accounttype->insertItem( tr( "Credit Card" ) );
accounttype->insertItem( tr( "Equity" ) );
accounttype->insertItem( tr( "Asset" ) );
accounttype->insertItem( tr( "Liability" ) );
layout = new QGridLayout ( this, 7, 2, 4, 2 );
layout->addWidget ( namelabel , 0, 0, Qt::AlignLeft );
layout->addWidget ( accountbox, 1, 0, Qt::AlignLeft );
layout->addWidget ( datelabel, 2, 0, Qt::AlignLeft );
layout->addWidget ( datebox, 3, 0, Qt::AlignLeft );
layout->addWidget ( childcheckbox, 4, 0, Qt::AlignLeft );
layout->addWidget ( childlabel, 5, 0, Qt::AlignLeft );
layout->addWidget ( childbox, 6, 0, Qt::AlignLeft );
layout->addWidget ( balancelabel, 0, 1, Qt::AlignLeft );
layout->addWidget ( balancebox, 1, 1, Qt::AlignLeft );
layout->addWidget ( creditlimitlabel, 2, 1, Qt::AlignLeft );
layout->addWidget ( creditlimitbox, 3, 1, Qt::AlignLeft );
layout->addWidget ( currencybox, 4, 1, Qt::AlignLeft );
layout->addWidget ( typelabel, 5, 1, Qt::AlignLeft );
layout->addWidget ( accounttype, 6, 1, Qt::AlignLeft );
connect ( childcheckbox, SIGNAL ( clicked () ), this, SLOT ( showChildPulldownMenu() ) );
connect ( balancecalculator, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
connect ( creditlimitcalculator, SIGNAL ( released() ), this, SLOT ( showCreditLimitCalculator() ) );
connect ( accounttype, SIGNAL ( activated ( int ) ), this, SLOT ( activateCreditLimit ( int ) ) );
connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) );
connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addAccountDescription() ) );
}
NewAccount::~NewAccount ()
{
}
void NewAccount::showChildPulldownMenu ()
{
if ( childcheckbox->isChecked() == TRUE )
{
childlabel->setEnabled ( TRUE );
childbox->setEnabled ( TRUE );
}
else
hideChildPulldownMenu();
diff --git a/noncore/apps/qashmoney/newtransaction.cpp b/noncore/apps/qashmoney/newtransaction.cpp
index 630a8b8..5c78139 100755
--- a/noncore/apps/qashmoney/newtransaction.cpp
+++ b/noncore/apps/qashmoney/newtransaction.cpp
@@ -1,103 +1,101 @@
#include "newtransaction.h"
#include "calculator.h"
#include "datepicker.h"
-#include "memory.h"
#include "budget.h"
-#include <qdatetime.h>
#include <qmultilineedit.h>
extern Budget *budget;
extern Preferences *preferences;
NewTransaction::NewTransaction ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
{
transactiondescription = "";
currentlineitem = -1;
currentbudget = -1;
dateedited = FALSE;
setCaption( tr( "Transaction" ) );
// START FIRST COLUMN
namelabel = new QLabel ( "Transaction", this );
transactionnamebox = new QHBox ( this );
transactionname = new QComboBox ( transactionnamebox );
transactionname->setEditable ( TRUE );
descriptionbutton = new QPushButton ( transactionnamebox );
descriptionbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/info.png" ) );
connect ( descriptionbutton, SIGNAL ( released () ), this, SLOT ( addTransactionDescription() ) );
amountlabel = new QLabel ( "Amount", this );
transactionamountbox = new QHBox ( this );
transactionamount = new QLineEdit ( transactionamountbox );
transactionamount->setAlignment ( Qt::AlignRight );
transactionamount->setText ( "0.00" );
calculatorbutton = new QPushButton( transactionamountbox );
calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
datelabel = new QLabel ( "Date", this );
transactiondatebox = new QHBox ( this );
transactiondate = new QLineEdit ( transactiondatebox );
transactiondate->setAlignment ( Qt::AlignRight );
transactiondate->setDisabled ( TRUE );
datebutton = new QPushButton( transactiondatebox );
datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) );
clearedcheckbox = new QCheckBox ( "Cleared", this );
depositbox = new QCheckBox ( "Credit", this );
// START SECOND COLUMN
numberlabel = new QLabel ( "Number", this );
transactionnumber = new QLineEdit ( this );
budgetlabel = new QLabel ( "Budget", this );
budgetbox = new QComboBox ( FALSE, this );
lineitemlabel = new QLabel ( "LineItem", this );
lineitembox = new QComboBox ( FALSE, this );
layout = new QGridLayout ( this, 7, 2, 2, 2 );
layout->addWidget ( namelabel, 0, 0, Qt::AlignLeft );
layout->addWidget ( transactionnamebox, 1, 0, Qt::AlignLeft );
layout->addWidget ( amountlabel, 2, 0, Qt::AlignLeft );
layout->addWidget ( transactionamountbox, 3, 0, Qt::AlignLeft );
layout->addWidget ( datelabel, 4, 0, Qt::AlignLeft );
layout->addWidget ( transactiondatebox, 5, 0, Qt::AlignLeft );
layout->addWidget ( clearedcheckbox, 6, 0, Qt::AlignLeft );
layout->addWidget ( numberlabel, 0, 1, Qt::AlignLeft );
layout->addWidget ( transactionnumber, 1, 1, Qt::AlignLeft );
layout->addWidget ( budgetlabel, 2, 1, Qt::AlignLeft );
layout->addWidget ( budgetbox, 3, 1, Qt::AlignLeft );
layout->addWidget ( lineitemlabel, 4, 1, Qt::AlignLeft );
layout->addWidget ( lineitembox, 5, 1, Qt::AlignLeft );
layout->addWidget ( depositbox, 6, 1, Qt::AlignLeft );
if ( budget->getNumberOfBudgets() != 0 )
{
budgetnameslist = budget->getBudgetNames();
budgetidslist = budget->getBudgetIDs();
budgetbox->insertStringList ( *budgetnameslist );
lineitemlabel->setEnabled ( FALSE );
lineitembox->setEnabled ( FALSE );
connect ( budgetbox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentBudget ( int ) ) );
connect ( lineitembox, SIGNAL ( activated ( int ) ), this, SLOT ( setCurrentLineItem ( int ) ) );
}
else
{
budgetlabel->setEnabled ( FALSE );
budgetbox->setEnabled ( FALSE );
lineitemlabel->setEnabled ( FALSE );
lineitembox->setEnabled ( FALSE );
}
}
NewTransaction::~NewTransaction ()
{
diff --git a/noncore/apps/qashmoney/preferencedialogs.cpp b/noncore/apps/qashmoney/preferencedialogs.cpp
index d7c66d3..5408a5b 100755
--- a/noncore/apps/qashmoney/preferencedialogs.cpp
+++ b/noncore/apps/qashmoney/preferencedialogs.cpp
@@ -1,99 +1,98 @@
#include "preferencedialogs.h"
#include "preferences.h"
-#include <qlabel.h>
extern Preferences *preferences;
DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
{
setCaption( tr( "Date" ) );
QLabel *datelabel = new QLabel ( "Format", this );
dateformat = new QComboBox ( this );
dateformat->setEditable ( FALSE );
dateformat->insertItem ( "yyyymmdd" );
dateformat->insertItem ( "yymmdd" );
dateformat->insertItem ( "mmddyyyy" );
dateformat->insertItem ( "mmddyy" );
dateformat->insertItem ( "yyyyddmm" );
dateformat->insertItem ( "yyddmm" );
dateformat->insertItem ( "ddmmyyyy" );
dateformat->insertItem ( "ddmmyy" );
connect ( dateformat, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateFormat ( int ) ) );
QLabel *dateseparatorlabel = new QLabel ( "Separator", this );
dateseparator = new QComboBox ( this );
dateseparator->insertItem ( "/" );
dateseparator->insertItem ( "-" );
dateseparator->insertItem ( "." );
connect ( dateseparator, SIGNAL ( activated ( int ) ), this, SLOT ( changeDateSeparator ( int ) ) );
defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultDatePreferences () ) );
dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 );
dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 );
layout = new QVBoxLayout ( this, 2, 2 );
layout->addWidget ( datelabel );
layout->addWidget ( dateformat );
layout->addWidget ( dateseparatorlabel );
layout->addWidget ( dateseparator );
layout->insertSpacing ( 4, 5 );
layout->addWidget ( defaults );
}
DatePreferences::~DatePreferences ()
{
}
void DatePreferences::changeDateFormat ( int index )
{
index ++;
preferences->changePreference ( 1, index );
}
void DatePreferences::changeDateSeparator ( int index )
{
index ++;
preferences->changePreference ( 2, index );
}
void DatePreferences::setDefaultDatePreferences ()
{
preferences->setDefaultDatePreferences ();
dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 );
dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 );
}
// START TRANSACTION PREFERENCES
TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
{
setCaption( tr ( "Transaction" ) );
showclearedtransactions = new QCheckBox ( this );
showclearedtransactions->setText ( "Show Cleared Transactions" );
limittransactionsbox = new QHBox ( this );
limittransactionsbox->setSpacing ( 2 );
limittransactionslabel = new QLabel ( "Show ", limittransactionsbox );
limittransactions = new QComboBox ( limittransactionsbox );
QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox );
limittransactions->insertItem ( "14 days" );
limittransactions->insertItem ( "30 days" );
limittransactions->insertItem ( "90 days" );
limittransactions->insertItem ( "180 days" );
limittransactions->insertItem ( "365 days" );
limittransactions->insertItem ( "All" );
limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) );
excludetransfers = new QCheckBox ( this );
excludetransfers->setText ( "Include Transfers In Limit View" );
if ( preferences->getPreference ( 3 ) == 1 )
showclearedtransactions->setChecked ( TRUE );
else
showclearedtransactions->setChecked ( FALSE );
diff --git a/noncore/apps/qashmoney/transactiondisplay.cpp b/noncore/apps/qashmoney/transactiondisplay.cpp
index 78b8a00..474f11e 100755
--- a/noncore/apps/qashmoney/transactiondisplay.cpp
+++ b/noncore/apps/qashmoney/transactiondisplay.cpp
@@ -1,111 +1,108 @@
#include "transactiondisplay.h"
#include "newtransaction.h"
#include "account.h"
#include "budget.h"
#include "memory.h"
#include "transfer.h"
-#include "preferences.h"
#include "calculator.h"
#include "datepicker.h"
-#include <qdatetime.h>
#include <qmessagebox.h>
#include <qheader.h>
#include <qmultilineedit.h>
-#include <qdatetime.h>
extern Transaction *transaction;
extern Budget *budget;
extern Account *account;
extern Preferences *preferences;
extern Memory *memory;
extern Transfer *transfer;
TransactionDisplay::TransactionDisplay ( QWidget* parent ) : QWidget ( parent )
{
// set transactiondisplay variables;
accountid = 0;
children = TRUE;
firstline = new QHBox ( this );
firstline->setSpacing ( 2 );
newtransaction = new QPushButton ( firstline );
newtransaction->setPixmap ( QPixmap ("/opt/QtPalmtop/pics/new.png") );
connect ( newtransaction, SIGNAL ( released () ), this, SLOT ( addTransaction () ) );
edittransaction = new QPushButton ( firstline );
edittransaction->setPixmap( QPixmap ("/opt/QtPalmtop/pics/edit.png") );
connect ( edittransaction, SIGNAL ( released () ), this, SLOT ( checkListViewEdit () ) );
deletetransaction = new QPushButton ( firstline );
deletetransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/delete.png") );
connect ( deletetransaction, SIGNAL ( released () ), this, SLOT ( checkListViewDelete () ) );
toggletransaction = new QPushButton ( firstline );
toggletransaction->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/redo.png") );
connect ( toggletransaction, SIGNAL ( released () ), this, SLOT ( checkListViewToggle () ) );
viewtransactionnotes = new QPushButton ( firstline );
viewtransactionnotes->setPixmap( QPixmap ( "/opt/QtPalmtop/pics/info.png") );
connect ( viewtransactionnotes, SIGNAL ( released () ), this, SLOT ( showTransactionNotes () ) );
secondline = new QHBox ( this );
secondline->setSpacing ( 5 );
name = new QLabel ( secondline );
balance = new QLabel ( secondline );
QLabel *limit = new QLabel ( "Limit", secondline );
limitbox = new QLineEdit ( secondline );
limitbox->setMinimumWidth ( ( int ) ( this->width() / 6 ) );
connect ( limitbox, SIGNAL ( textChanged ( const QString & ) ), this, SLOT ( limitDisplay ( const QString & ) ) );
listview = new QListView ( this );
listview->setAllColumnsShowFocus ( TRUE );
listview->setShowSortIndicator ( TRUE );
listview->header()->setTracking ( FALSE );
connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) );
connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) );
layout = new QVBoxLayout ( this, 2, 2 );
layout->addWidget ( firstline );
layout->addWidget ( secondline );
layout->addWidget ( listview );
}
void TransactionDisplay::addTransaction ()
{
// create local variables
int cleared = -1;
// create new transaction window
NewTransaction *newtransaction = new NewTransaction ( this );
int width = this->size().width();
newtransaction->transactionname->setMaximumWidth ( ( int ) ( width * 0.45 ) );
newtransaction->transactionname->setMinimumWidth ( ( int ) ( width * 0.35 ) );
newtransaction->lineitembox->setMaximumWidth ( ( int ) ( width * 0.45 ) );
newtransaction->transactiondatebox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
newtransaction->transactionamountbox->setMaximumWidth ( ( int ) ( width * 0.4 ) );
newtransaction->transactionnumber->setMaximumWidth ( ( int ) ( width * 0.25 ) );
// enter today's date in the date box as defaul
QDate today = QDate::currentDate ();
int defaultday = today.day();
int defaultmonth = today.month();
int defaultyear = today.year();
newtransaction->transactiondate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) );
// add memory items to the transactionname combobox
memory->displayMemoryItems ( newtransaction->transactionname );
newtransaction->transactionname->insertItem ( "", 0 );
if ( newtransaction->exec () == QDialog::Accepted )
{
if ( newtransaction->clearedcheckbox->isChecked () == TRUE ) // set a parent id and type for a child transaction
cleared = 1;
else
cleared = 0;
float amount = newtransaction->transactionamount->text().toFloat();
if ( newtransaction->depositbox->isChecked() == FALSE )
diff --git a/noncore/apps/qashmoney/transferdialog.cpp b/noncore/apps/qashmoney/transferdialog.cpp
index f85c740..558abec 100755
--- a/noncore/apps/qashmoney/transferdialog.cpp
+++ b/noncore/apps/qashmoney/transferdialog.cpp
@@ -1,102 +1,100 @@
#include "transferdialog.h"
#include "datepicker.h"
#include "calculator.h"
-#include <qdatetime.h>
-#include <qfont.h>
extern Preferences *preferences;
extern Account *account;
TransferDialog::TransferDialog ( QWidget *parent, int fromaccountid, int toaccountid ) : QDialog ( parent, 0, TRUE )
{
dateedited = FALSE;
setCaption ( "Transfer" );
fromaccountlabel = new QLabel ( "From account:", this );
QFont f = this->font();
f.setWeight ( QFont::Bold );
fromaccountlabel->setFont ( f );
fromaccount = new QLabel ( account->getAccountName ( fromaccountid ), this );
toaccountlabel = new QLabel ( "To Account:", this );
toaccountlabel->setFont ( f );
toaccount = new QLabel ( account->getAccountName ( toaccountid ), this );
datelabel = new QLabel ( "Date", this );
datebox = new QHBox ( this );
datebox->setSpacing ( 2 );
date = new QLineEdit ( datebox );
date->setAlignment ( Qt::AlignRight );
date->setDisabled ( TRUE );
datebutton = new QPushButton ( datebox );
datebutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/date.png" ) );
connect ( datebutton, SIGNAL ( released () ), this, SLOT ( showCalendar () ) );
amounttlabel = new QLabel ( "Amount", this );
amountbox = new QHBox ( this );
amountbox->setSpacing ( 2 );
amount = new QLineEdit ( amountbox );
amount->setAlignment ( Qt::AlignRight );
calculatorbutton = new QPushButton( amountbox );
calculatorbutton->setPixmap ( QPixmap ( "/opt/QtPalmtop/pics/kcalc.png" ) );
connect ( calculatorbutton, SIGNAL ( released() ), this, SLOT ( showCalculator() ) );
clearedcheckbox = new QCheckBox ( "Cleared", this );
layout = new QVBoxLayout ( this, 4, 2 );
layout->addWidget ( fromaccountlabel, Qt::AlignLeft );
layout->addWidget ( fromaccount, Qt::AlignLeft );
layout->addWidget ( toaccountlabel, Qt::AlignLeft );
layout->addWidget ( toaccount, Qt::AlignLeft );
layout->addSpacing ( 5 );
layout->addWidget ( datelabel, Qt::AlignLeft );
layout->addWidget ( datebox, Qt::AlignLeft );
layout->addWidget ( amounttlabel, Qt::AlignLeft );
layout->addWidget ( amountbox, Qt::AlignLeft );
layout->addWidget ( clearedcheckbox, Qt::AlignLeft );
}
bool TransferDialog::getDateEdited ()
{
return dateedited;
}
void TransferDialog::showCalendar ()
{
QDate newDate = QDate::currentDate ();
DatePicker *dp = new DatePicker ( newDate );
if ( dp->exec () == QDialog::Accepted )
{
// Set date integers
year = dp->getYear();
month = dp->getMonth();
day = dp->getDay();
// Set dateedited to TRUE
// This tells the accountdisplay object that the user edited an account
// and did change the date
dateedited = TRUE;
// Display date with our selected format
date->setText ( preferences->getDate ( year, month, day ) );
}
}
int TransferDialog::getDay ()
{
return day;
}
int TransferDialog::getMonth ()
{
return month;
}
int TransferDialog::getYear ()
{
return year;
}
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp
index 207172d..f35dfcd 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -1,133 +1,132 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
/* local includes */
#include "tableviewer.h"
#include "ui/tvbrowseview.h"
#include "ui/tvfilterview.h"
#include "ui/tvlistview.h"
#include "ui/tveditview.h"
#include "ui/tvkeyedit.h"
#include "db/datacache.h"
/* QPE includes */
#include <qpe/fileselector.h>
#include <qpe/resource.h>
#include <qpe/qpetoolbar.h>
/* QTE includes */
#include <qmenubar.h>
-#include <qpe/qpetoolbar.h>
#include <qpopupmenu.h>
#include <qapplication.h>
#include <qwidgetstack.h>
#include <qlayout.h>
#include <qbuffer.h>
/*!
\class TableViewerWindow
\brief The main window widget of the application
This is the main widget of the table viewer application.
It is the co-ordination point.
*/
/*!
Constructs a new TableViewerWindow
*/
TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f)
: QMainWindow(parent, name, f)
{
setCaption(tr("Table Viewer"));
/* Build data */
ds = new DBStore();
doc.setType("text/x-xml-tableviewer");
doc.setName("table");
dirty = FALSE;
ts.current_column = 0;
ts.kRep = ds->getKeys();
/* build menus */
menu = new QMenuBar(this, 0);
QPopupMenu *file_menu = new QPopupMenu;
file_menu->insertItem("New", this, SLOT(newDocument()));
file_menu->insertItem("Open", this, SLOT(selectDocument()));
file_menu->insertSeparator();
file_menu->insertItem("Properties");
/* later will want to set this up to clean up first via this, SLOT(quit) */
menu->insertItem("Document", file_menu);
QPopupMenu *edit_menu = new QPopupMenu;
edit_menu->insertItem("Edit Item", this, SLOT(editItemSlot()));
edit_menu->insertItem("Edit Keys", this, SLOT(editKeysSlot()));
edit_menu->insertItem("Edit filters", this, SLOT(filterViewSlot()));
menu->insertItem("Edit", edit_menu);
QPopupMenu *view_menu = new QPopupMenu;
view_menu->insertItem("Browse View", this, SLOT(browseViewSlot()));
view_menu->insertItem("List View", this, SLOT(listViewSlot()));
menu->insertItem("View", view_menu);
QVBoxLayout *main_layout = new QVBoxLayout;
/* Build tool bar */
navigation = new QToolBar(this, "navigation");
QToolButton *newItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("new")), "New Item", QString::null,
this, SLOT(newItemSlot()), navigation, "New Item");
QToolButton *editItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null,
this, SLOT(editItemSlot()), navigation, "Edit Item");
QToolButton *deleteItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("trash")), "Delete Item",
QString::null, this,
SLOT(deleteItemSlot()), navigation, "Delete Item");
navigation->addSeparator();
QToolButton *firstItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("fastback")), "First Item",
QString::null, this,
SLOT(firstItem()), navigation, "First Item");
QToolButton *previousItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("back")), "Previous Item",
QString::null, this,
SLOT(previousItem()), navigation, "Previous Item");
QToolButton *nextItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("forward")), "Next Item",
QString::null, this,
SLOT(nextItem()), navigation, "Next Item");
QToolButton *lastItemButton = new QToolButton(
QIconSet(Resource::loadPixmap("fastforward")), "Last Item",
QString::null, this,
SLOT(lastItem()), navigation, "Last Item");
navigation->addSeparator();
QToolButton *browseButton = new QToolButton(
QIconSet(Resource::loadPixmap("day")), "View Single Item",
QString::null, this,
SLOT(browseViewSlot()), navigation, "View Single Item");
QToolButton *listButton = new QToolButton(
QIconSet(Resource::loadPixmap("month")), "View Multiple Items",
QString::null, this,