summaryrefslogtreecommitdiff
Side-by-side diff
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,149 +1,146 @@
/****************************************************************************
** $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;
}
static inline bool prevVisualCharJoins( const QString &str, int pos)
{
return ( prevChar( str, pos )->joining() != QChar::OtherJoining );
}
static inline bool nextVisualCharJoins( const QString &str, int pos)
{
QChar::Joining join = nextChar( str, pos )->joining();
return ( join == QChar::Dual || join == QChar::Center );
}
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,249 +1,234 @@
/****************************************************************************
** $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 );
}
}
return 0;
}
bool QTextCommandHistory::isUndoAvailable()
{
return current > -1;
}
bool QTextCommandHistory::isRedoAvailable()
{
return current > -1 && current < (int)history.count() - 1 || current == -1 && history.count() > 0;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
QTextDeleteCommand::QTextDeleteCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str,
const QByteArray& oldStyleInfo )
: QTextCommand( d ), id( i ), index( idx ), parag( 0 ), text( str ), styleInformation( oldStyleInfo )
{
for ( int j = 0; j < (int)text.size(); ++j ) {
if ( text[ j ].format() )
text[ j ].format()->addRef();
}
}
QTextDeleteCommand::QTextDeleteCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str )
: QTextCommand( 0 ), id( -1 ), index( idx ), parag( p ), text( str )
{
for ( int i = 0; i < (int)text.size(); ++i ) {
if ( text[ i ].format() )
text[ i ].format()->addRef();
}
}
QTextDeleteCommand::~QTextDeleteCommand()
{
for ( int i = 0; i < (int)text.size(); ++i ) {
if ( text[ i ].format() )
text[ i ].format()->removeRef();
}
text.resize( 0 );
}
QTextCursor *QTextDeleteCommand::execute( QTextCursor *c )
{
QTextParagraph *s = doc ? doc->paragAt( id ) : parag;
if ( !s ) {
qWarning( "can't locate parag at %d, last parag: %d", id, doc->lastParagraph()->paragId() );
return 0;
}
cursor.setParagraph( s );
cursor.setIndex( index );
int len = text.size();
if ( c )
*c = cursor;
if ( doc ) {
doc->setSelectionStart( QTextDocument::Temp, cursor );
for ( int i = 0; i < len; ++i )
cursor.gotoNextLetter();
doc->setSelectionEnd( QTextDocument::Temp, cursor );
doc->removeSelectedText( QTextDocument::Temp, &cursor );
if ( c )
*c = cursor;
} else {
s->remove( index, len );
}
return c;
}
QTextCursor *QTextDeleteCommand::unexecute( QTextCursor *c )
{
QTextParagraph *s = doc ? doc->paragAt( id ) : parag;
if ( !s ) {
qWarning( "can't locate parag at %d, last parag: %d", id, doc->lastParagraph()->paragId() );
return 0;
}
cursor.setParagraph( s );
cursor.setIndex( index );
QString str = QTextString::toString( text );
cursor.insert( str, TRUE, &text );
cursor.setParagraph( s );
cursor.setIndex( index );
if ( c ) {
c->setParagraph( s );
c->setIndex( index );
for ( int i = 0; i < (int)text.size(); ++i )
c->gotoNextLetter();
}
if ( !styleInformation.isEmpty() ) {
QDataStream styleStream( styleInformation, IO_ReadOnly );
int num;
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,234 +1,232 @@
/****************************************************************************
** $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
\value MarginFirstLine margin (indentation) of the first line of
a paragarph (in addition to the MarginLeft of the paragraph)
*/
/*!
Constructs a new style called \a name for the stylesheet \a
parent.
All properties in QStyleSheetItem are initially in the "do not
change" state, except \link QStyleSheetItem::DisplayMode display
mode\endlink, which defaults to \c DisplayInline.
*/
QStyleSheetItem::QStyleSheetItem( QStyleSheet* parent, const QString& name )
{
d = new QStyleSheetItemData;
d->stylename = name.lower();
d->sheet = parent;
init();
if (parent)
parent->insert( this );
}
/*!
Copy constructor. Constructs a copy of \a other that is not bound
to any style sheet.
*/
QStyleSheetItem::QStyleSheetItem( const QStyleSheetItem & other )
{
d = new QStyleSheetItemData;
*d = *other.d;
}
/*!
Destroys the style. Note that QStyleSheetItem objects become
owned by QStyleSheet when they are created.
*/
QStyleSheetItem::~QStyleSheetItem()
{
delete d;
}
/*!
Returns the style sheet this item is in.
*/
QStyleSheet* QStyleSheetItem::styleSheet()
{
return d->sheet;
}
/*!
\overload
Returns the style sheet this item is in.
*/
const QStyleSheet* QStyleSheetItem::styleSheet() const
{
return d->sheet;
}
/*!
\internal
Internal initialization
*/
void QStyleSheetItem::init()
{
d->disp = DisplayInline;
d->fontitalic = Undefined;
d->fontunderline = Undefined;
d->fontstrikeout = Undefined;
d->fontweight = Undefined;
d->fontsize = Undefined;
d->fontsizelog = Undefined;
d->fontsizestep = 0;
d->ncolumns = Undefined;
d->col = QColor(); // !isValid()
d->anchor = FALSE;
d->align = Undefined;
d->valign = VAlignBaseline;
d->margin[0] = Undefined;
d->margin[1] = Undefined;
d->margin[2] = Undefined;
d->margin[3] = Undefined;
d->margin[4] = Undefined;
d->list = (ListStyle) Undefined;
d->whitespacemode = (WhiteSpaceMode) Undefined;
d->selfnest = TRUE;
d->lineSpacing = Undefined;
}
/*!
Returns the name of the style item.
*/
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,254 +1,234 @@
/****************************************************************************
** $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
paragraphs, indexed from 0. Characters are indexed on a
per-paragraph basis, also indexed from 0. The words in the
paragraph are aligned in accordance with the paragraph's
alignment(). Paragraphs are separated by hard line breaks. Each
character within a paragraph has its own attributes, for example,
font and color.
The text edit documentation uses the following concepts:
\list
\i \e{current format} --
this is the format at the current cursor position, \e and it
is the format of the selected text if any.
\i \e{current paragraph} -- the paragraph which contains the
cursor.
\endlist
QTextEdit can display images (using QMimeSourceFactory), lists and
tables. If the text is too large to view within the text edit's
viewport, scrollbars will appear. The text edit can load both
plain text and HTML files (a subset of HTML 3.2 and 4). The
rendering style and the set of valid tags are defined by a
styleSheet(). Custom tags can be created and placed in a custom
style sheet. Change the style sheet with \l{setStyleSheet()}; see
QStyleSheet for details. The images identified by image tags are
displayed if they can be interpreted using the text edit's
\l{QMimeSourceFactory}; see setMimeSourceFactory().
If you want a text browser with more navigation use QTextBrowser.
If you just need to display a small piece of rich text use QLabel
or QSimpleRichText.
If you create a new QTextEdit, and want to allow the user to edit
rich text, call setTextFormat(Qt::RichText) to ensure that the
text is treated as rich text. (Rich text uses HTML tags to set
text formatting attributes. See QStyleSheet for information on the
HTML tags that are supported.). If you don't call setTextFormat()
explicitly the text edit will guess from the text itself whether
it is rich text or plain text. This means that if the text looks
like HTML or XML it will probably be interpreted as rich text, so
you should call setTextFormat(Qt::PlainText) to preserve such
text.
Note that we do not intend to add a full-featured web browser
widget to Qt (because that would easily double Qt's size and only
a few applications would benefit from it). The rich
text support in Qt is designed to provide a fast, portable and
efficient way to add reasonable online help facilities to
applications, and to provide a basis for rich text editors.
\section1 Using QTextEdit as a Display Widget
QTextEdit can display a large HTML subset, including tables and
images.
The text is set or replaced using setText() which deletes any
existing text and replaces it with the text passed in the
setText() call. If you call setText() with legacy HTML (with
setTextFormat(RichText) in force), and then call text(), the text
that is returned may have different markup, but will render the
same. Text can be inserted with insert(), paste(), pasteSubType()
and append(). Text that is appended does not go into the undo
history; this makes append() faster and consumes less memory. Text
can also be cut(). The entire text is deleted with clear() and the
selected text is deleted with removeSelectedText(). Selected
(marked) text can also be deleted with del() (which will delete
the character to the right of the cursor if no text is selected).
Loading and saving text is achieved using setText() and text(),
for example:
\code
QFile file( fileName ); // Read the text from a file
if ( file.open( IO_ReadOnly ) ) {
QTextStream ts( &file );
textEdit->setText( ts.read() );
}
\endcode
\code
QFile file( fileName ); // Write the text to a file
if ( file.open( IO_WriteOnly ) ) {
QTextStream ts( &file );
ts << textEdit->text();
textEdit->setModified( FALSE );
}
\endcode
By default the text edit wraps words at whitespace to fit within
the text edit widget. The setWordWrap() function is used to
specify the kind of word wrap you want, or \c NoWrap if you don't
want any wrapping. Call setWordWrap() to set a fixed pixel width
\c FixedPixelWidth, or character column (e.g. 80 column) \c
FixedColumnWidth with the pixels or columns specified with
setWrapColumnOrWidth(). If you use word wrap to the widget's width
\c WidgetWidth, you can specify whether to break on whitespace or
anywhere with setWrapPolicy().
The background color is set differently than other widgets, using
setPaper(). You specify a brush style which could be a plain color
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,152 +1,149 @@
/***************************************************************************
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;
QTableItem *itm = item( row, col );
QColorGroup colgrp = colorGroup();
if ( itm )
{
if ( row%2 )
colgrp.setColor( QColorGroup::Base, QColor( 180,200,210 ) );
else
colgrp.setColor( QColorGroup::Base, QColor( 230,235,235 ) );
p->save();
itm->paint( p, colgrp, cr, selected );
p->restore();
}
}
OxydataQTI::OxydataQTI(QTable * table, EditType et, const QString & text )
: QTableItem ( table, et, text )
{
}
int OxydataQTI::alignment() const
{
if ( col()%2 )
{
return AlignRight | AlignVCenter;
}else return AlignLeft | AlignVCenter;
};
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,199 +1,196 @@
/*
* 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);
} else if (s[i] == '+') {
if (elstemp->isEmpty()) {
delete elstemp;
return QString ("Bad formula."); //ERROR
}
elstemp->addTo(*els, prefix);
delete elstemp;
errors = KMolCalc::readGroup(s.mid(i+1, sl-i-1), els);
return errors;
} else {
delete elstemp;
return QString ("Bad formula."); //ERROR
}
}
elstemp->addTo(*els, prefix);
delete elstemp;
return errors;
}
/**
* Calculate and return the molecular weight of the current chemical formula.
*/
double KMolCalc::getWeight() {
if (weight == -1) weight = elements->getWeight(elstable);
return weight;
}
/**
* Return the elemental composition of the current formula, as a string of tab-separated
* element - percentage pairs, separated by newlines.
*/
QString KMolCalc::getEA() {
if (weight == -1) weight = elements->getWeight(elstable);
if (weight == -1) return QString("ERROR: Couldn't get Mw..."); // ERROR
return elements->getEA(elstable, weight);
}
/**
* Return the empirical formula of the current compound as a QString.
*/
QString KMolCalc::getEmpFormula() {
return elements->getEmpFormula();
}
// Read the element definition file.
void KMolCalc::readMwfile(QFile& f) {
if (! f.open(IO_ReadOnly)) return; //ERROR
QTextStream fs (&f);
QString line;
while (! fs.eof()) {
line = fs.readLine();
SubUnit* s = SubUnit::makeSubUnit(line);
elstable->replace(s->getName(), s);
}
f.close();
}
/**
* Remove a group or element definition from ELSTABLE.
*/
void KMolCalc::undefineGroup (const QString& name) {
elstable->remove (name);
}
/**
* Add a new element name - atomic weight record to the ELSTABLE hashtable. Assumes
* NAME has valid syntax.
*/
void KMolCalc::defineElement (const QString& name, double weight) {
Element* el = new Element(name, weight);
elstable->replace(name, el);
}
/**
* Add a new group definition to the ELSTABLE. Returns 0 if OK, -1 if parsing FORMULA
* fails. Assumes the syntax of grpname is correct.
*/
QString KMolCalc::defineGroup (const QString& grpname, const QString& formula) {
ElementList* els = new ElementList(grpname);
QString error = readGroup(formula, els);
if (error != "OK") return error;
if (els->contains(grpname)) return QString("Can't define a group recursively!\n");
elstable->replace(grpname, els);
return QString("OK");
}
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,157 +1,155 @@
/***************************************************************************
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") );
names.append( tr("Tantalum") );
names.append( tr("Tungsten") );
names.append( tr("Rhenium") );
names.append( tr("Osmium") );
names.append( tr("Iridium") );
names.append( tr("Platinum") );
names.append( tr("Gold") );
names.append( tr("Mercury") );
names.append( tr("Thallium") );
names.append( tr("Lead") );
names.append( tr("Bismuth") );
names.append( tr("Polonium") );
names.append( tr("Astatine") );
names.append( tr("Radon") );
names.append( tr("Francium") );
names.append( tr("Radium") );
names.append( tr("Actinium") );
names.append( tr("Thorium") );
names.append( tr("Protactinium") );
names.append( tr("Uranium") );
names.append( tr("Neptunium") );
names.append( tr("Plutonium") );
names.append( tr("Americium") );
names.append( tr("Curium") );
names.append( tr("Berkelium") );
names.append( tr("Californium") );
names.append( tr("Einsteinium") );
names.append( tr("Fermium") );
names.append( tr("Mendelevium") );
names.append( tr("Nobelium") );
names.append( tr("Lawrencium") );
names.append( tr("Rutherfordium") );
names.append( tr("Dubnium") );
names.append( tr("Seaborgium") );
names.append( tr("Bohrium") );
names.append( tr("Hassium") );
names.append( tr("Meitnerium") );
}
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,198 +1,196 @@
/***************************************************************************
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)
{
h=40; v=40;
}
//Boron-->Neon or Aluminum --> Argon
if ((n >= 5 && n <= 10) || (n >= 13 && n <= 18))
for (int i = 1; i <= (6-(10-n)); i++)
{
h=((i*40)+440);
v = 40;
if (n >= 13)
{
v=80;
h=(h-320);
}
}
//Sodium
if (n == 11)
{
h=0; v=80;
}
//Magnesium
if (n == 12)
{
h=40; v=80;
}
//Potassium --> Uuo without La and Ac
if ((n >= 19 && n <= 57) || (n >= 72 && n <= 89) || n >= 104)
for (int i = 1; i <= 18; i++)
{
int f = n;
if (n > 18)
f = n-18;
if (n > 36)
f = n-36;
if (n > 54)
f = n-54;
if (n > 71)
f = n-68;
if (n > 86)
f = n-86;
if (n > 103)
f = n-100;
h=((f*40)-40);
v = 120;
if (n >= 37)
v=160;
if (n >= 55)
v=200;
if (n >= 87)
v=240;
}
//Lanthanum --> Lutetium and Actinum --> Lawrencium
if ((n >= 58 && n <= 71) || (n >= 90 && n <= 103))
for (int i = 1; i <= 14; i++)
{
int f = n;
if (n > 57)
f = n-55;
if (n > 88)
f = n-87;
h=(f*40);
v = 290;
if (n >= 90)
v=330;
}
v += 10;
}
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,195 +1,193 @@
#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 )
{
// select all child balances that share the parent of the current child account
char **results;
int rows;
sqlite_get_table_printf ( adb, "select sum ( balance ) from accounts2 where parent = %i;", &results, &rows, NULL, NULL, parentid );
sqlite_exec_printf ( adb, "update accounts2 set balance = %.2f where accountid = %i;", 0, 0, 0, strtod ( results[ 1 ], NULL ), parentid );
}
int Account::getParentAccountID ( int id )
{
char **results;
sqlite_get_table_printf ( adb, "select parent from accounts2 where accountid = %i;", &results, NULL, NULL, NULL, id );
return atoi ( results [ 1 ] );
}
int Account::getParentAccountID ( QString accountname )
{
char **results;
sqlite_get_table_printf ( adb, "select parent from accounts2 where name= '%q';", &results, NULL, NULL, NULL, ( const char * ) accountname );
return atoi ( results [ 1 ] );
}
void Account::displayAccounts ( QListView *listview )
{
char **results;
int rows, columns;
sqlite_get_table ( adb, "select name, parent, balance, accountid, currency from accounts2;", &results, &rows, &columns, 0 );
// determine if we are using currency support
int currency = preferences->getPreference ( 4 );
// remove all columns from the account display
int counter;
for ( counter = 0; counter <= columns; counter++ )
listview->removeColumn ( 0 );
// add columns to the account display
listview->addColumn ( "Account", 0 );
int columntoalign = 1;
if ( preferences->getPreference ( 4 ) == 1 ) // add the currency column if the user wants it
{
listview->addColumn ( "C", 0 );
columntoalign = 2;
}
listview->addColumn ( "Balance", 0 );
listview->addColumn ( "", 0 );
listview->setColumnAlignment ( columntoalign, Qt::AlignRight );
counter = 5;
int total = ( rows + 1 ) * columns;
while ( counter < total )
{
int accountid = atoi ( results [ counter + 3 ] );
if ( atoi ( results [ counter + 1 ] ) == -1 )
{
QListViewItem *parent = new QListViewItem ( listview );
parent->setText ( 0, results [ counter ] );
if ( currency == 0 )
{
parent->setText ( 1, results [ counter + 2 ] );
parent->setText ( 2, results [ counter + 3 ] );
}
else
{
if ( getNumberOfChildAccounts ( accountid ) == 0 ) // add the currency flag if this is a parent with no children
{
// create the string we'll use to set the currency pixmap
QString filename = "/opt/QtPalmtop/pics/flags/";
QString flag = results [ counter + 4 ];
filename.append ( flag );
filename.append ( ".png" );
parent->setPixmap ( 1, QPixmap ( filename ) );
parent->setText ( 1, flag );
}
parent->setText ( 2, results [ counter + 2 ] );
parent->setText ( 3, results [ counter + 3 ] );
}
if ( getAccountExpanded ( accountid ) == 1 )
parent->setOpen ( TRUE );
//Start display child accounts for this parent
int childcounter = 5;
while ( childcounter < total )
{
if ( atoi ( results [ childcounter + 1 ] ) == accountid )
{
if ( currency == 0 )
QListViewItem *child = new QListViewItem ( parent, results [ childcounter ], results [ childcounter + 2 ], results [ childcounter + 3 ] );
else
{
// create the string we'll use to set the currency pixmap
QString filename = "/opt/QtPalmtop/pics/flags/";
QString flag = results [ childcounter + 4 ];
filename.append ( flag );
filename.append ( ".png" );
QListViewItem *child = new QListViewItem ( parent, results [ childcounter ], "", results [ childcounter + 2 ], results [ childcounter + 3 ] );
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,201 +1,199 @@
-#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++;
}
}
}
if ( preferences->getPreference ( 4 ) == 0 )
newaccount->currencybox->setEnabled ( FALSE );
// enter today's date in the date box as default
QDate today = QDate::currentDate ();
int defaultday = today.day();
int defaultmonth = today.month();
int defaultyear = today.year();
newaccount->startdate->setText ( preferences->getDate ( defaultyear, defaultmonth, defaultday ) );
//add account information if user pushes OK button
if ( newaccount->exec() == QDialog::Accepted )
{
if ( newaccount->childcheckbox->isChecked () == TRUE ) // set a parent id and type for a child account
{
// go through the parentlist we created and determine the parent accountid
// we can't use the name of the account because there may be two accounts
// with the same name. This function does it all by accountid
int counter;
for ( counter = 0; counter < listview->childCount() + 1; counter++ )
if ( ( parentlist [ counter ] [ 2 ].toInt() ) == newaccount->childbox->currentItem() )
{
parentid = parentlist [ counter ] [ 1 ].toInt();
break;
}
type = ( newaccount->accounttype->currentItem() ) + 6; // sets account ids for child accounts. See accountdisplay.h for types
}
else
{
parentid = -1;
type = newaccount->accounttype->currentItem(); // sets account ids for parent accounts
}
// add the new account
if ( newaccount->getDateEdited () == TRUE )
account->addAccount ( newaccount->accountname->text(), parentid, newaccount->accountbalance->text().toFloat(), type,
newaccount->getDescription(), newaccount->creditlimit->text().toFloat(), newaccount->getYear(),
newaccount->getMonth(), newaccount->getDay(), newaccount->accountbalance->text().toFloat(), newaccount->currencybox->currencybox->currentText() );
else
account->addAccount ( newaccount->accountname->text (), parentid, newaccount->accountbalance->text().toFloat(), type,
newaccount->getDescription(), newaccount->creditlimit->text().toFloat(), defaultyear,
defaultmonth, defaultday, newaccount->accountbalance->text().toFloat(), newaccount->currencybox->currencybox->currentText() );
if ( parentid != -1 )
account->changeParentAccountBalance ( parentid );
// redisplay accounts
// this function clears the account display first
account->displayAccounts ( listview );
setToggleButton();
}
maintabs->setTabEnabled ( tab2, FALSE );
}
void AccountDisplay::deleteAccount ()
{
if ( listview->selectedItem() == 0 )
QMessageBox::warning ( this, "QashMoney", "Please select an account\nto delete.");
else if ( listview->selectedItem()->parent() == 0 && listview->selectedItem()->childCount() != 0 )
QMessageBox::warning ( this, "QashMoney", "Can't delete parent accounts\nwith children");
else
{
QMessageBox mb ( "Delete Account", "This will delete all transactions\nand transfers for this account.", QMessageBox::Information, QMessageBox::Ok, QMessageBox::Cancel, QMessageBox::NoButton );
if ( mb.exec() == QMessageBox::Ok )
{
int accountid = listview->selectedItem()->text ( getIDColumn() ).toInt ();
int parentid = account->getParentAccountID ( accountid );
// delete all the transactions and transfers for the account
transaction->deleteAllTransactions ( accountid );
transfer->deleteAllTransfers ( accountid );
// delete the account
account->deleteAccount ( accountid );
// update account balances
if ( parentid != -1 )
account->changeParentAccountBalance ( parentid );
//redisplay accounts
account->displayAccounts ( listview );
//remove all the columns from the accountdisplay if there are not any accounts
if ( account->getNumberOfAccounts() == 0 )
{
int columns = listview->columns();
int counter;
for ( counter = 0; counter <= columns; counter++ )
listview->removeColumn ( 0 );
}
setToggleButton();
}
}
maintabs->setTabEnabled ( tab2, FALSE );
}
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,202 +1,199 @@
#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 );
if ( budgetbox->count() != 0 )
displayBudgetNames();
checkBudgets();
}
void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize )
{
switch ( column )
{
case 0:
preferences->changeColumnPreference ( 13, newsize );
break;
case 1:
preferences->changeColumnPreference ( 14, newsize );
break;
case 2:
preferences->changeColumnPreference ( 15, newsize );
break;
}
}
void BudgetDisplay::saveSortingPreference ( int column )
{
preferences->changeSortingPreference ( 3, column );
}
int BudgetDisplay::getIDColumn ()
{
int counter;
int columns = listview->columns();
for ( counter = 0; counter <= columns; counter++ )
if ( listview->header()->label ( counter ).length() == 0 )
return counter;
}
void BudgetDisplay::newBudget ()
{
constructBudgetWindow();
int response = nb->exec();
if ( response == 1 )
{
// open a new budget object
int addedbudget = budget->addBudget ( budgetname->text(), 0, description->text(), currencybox->currencybox->currentText(), day, month, year, day, month, year, 0 );
transaction->clearBudgetIDs ( addedbudget );
displayBudgetNames();
}
checkBudgets();
}
void BudgetDisplay::constructBudgetWindow ()
{
//construct and format the new budget window
nb = new QDialog ( this, 0, TRUE );
nb->setCaption ( "Budget" );
QLabel *namelabel = new QLabel ( "Budget Name", nb );
budgetname = new QLineEdit ( nb );
QLabel *descriptionlabel = new QLabel ( "Description", nb );
description = new QLineEdit ( nb );
currencybox = new Currency ( nb );
QBoxLayout *layout = new QVBoxLayout ( nb, 2, 2 );
layout->addWidget ( namelabel );
layout->addWidget ( budgetname );
layout->addWidget ( descriptionlabel );
layout->addWidget ( description );
layout->addWidget ( currencybox );
}
void BudgetDisplay::displayBudgetNames ()
{
budgetbox->clear();
if ( budget->getNumberOfBudgets() != 0 )
{
ids = budget->getBudgetIDs();
for ( QStringList::Iterator it = ids->begin(); it != ids->end(); ++it )
{
QString flag = "/opt/QtPalmtop/pics/flags/";
flag.append ( budget->getCurrency ( (*it).toInt() ) );
flag.append ( ".png" );
budgetbox->insertItem ( QPixmap ( flag ), budget->getBudgetName ( (*it).toInt() ) );
}
setCurrentBudget ( 0 );
}
else
checkBudgets();
}
void BudgetDisplay::setCurrentBudget ( int index )
{
currentbudget = ( ids->operator[] ( index ).toInt() );
displayLineItems();
}
void BudgetDisplay::setCurrentView ( int index )
{
displayLineItems();
}
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,198 +1,195 @@
#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();
}
void NewAccount::hideChildPulldownMenu ()
{
childlabel->setEnabled ( FALSE );
childbox->setEnabled ( FALSE );
}
void NewAccount::showCalculator ()
{
Calculator *calculator = new Calculator ( this );
calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
if ( calculator->exec () == QDialog::Accepted )
accountbalance->setText ( calculator->display->text() );
}
void NewAccount::showCreditLimitCalculator ()
{
Calculator *calculator = new Calculator ( this );
calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
if ( calculator->exec () == QDialog::Accepted )
creditlimit->setText ( calculator->display->text() );
}
void NewAccount::activateCreditLimit ( int index )
{
if ( index == 2 || index == 5 )
creditlimitbox->setEnabled ( TRUE );
else
{
creditlimit->clear ();
creditlimitbox->setEnabled ( FALSE );
}
}
void NewAccount::showCalendar ()
{
QDate newDate = QDate::currentDate ();
DatePicker *dp = new DatePicker ( newDate );
dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
int response = dp->exec();
if ( response == 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
startdate->setText ( preferences->getDate ( year, month, day ) );
}
}
bool NewAccount::getDateEdited ()
{
return dateedited;
}
int NewAccount::getDay ()
{
return day;
}
int NewAccount::getMonth ()
{
return month;
}
int NewAccount::getYear ()
{
return year;
}
QString NewAccount::getDescription ()
{
return accountdescription;
}
void NewAccount::setDescription ( QString description )
{
accountdescription = description;
}
void NewAccount::addAccountDescription ()
{
// Function for adding or editing an account description.
QDialog *description = new QDialog ( this, "description", TRUE );
description->setCaption ( "Notes" );
QMultiLineEdit *enter = new QMultiLineEdit ( description );
enter->setFixedSize ( ( int ) (this->width() * 0.75 ), ( int ) ( this->height() * 0.5 ) );
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,199 +1,197 @@
#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 ()
{
}
void NewTransaction::showCalculator ()
{
Calculator *calculator = new Calculator ( this );
calculator->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
if ( calculator->exec () == QDialog::Accepted )
transactionamount->setText ( calculator->display->text() );
}
void NewTransaction::showCalendar ()
{
QDate newDate = QDate::currentDate ();
DatePicker *dp = new DatePicker ( newDate );
dp->setMaximumWidth ( ( int ) ( this->size().width() * 0.9 ) );
int response = dp->exec();
if ( response == QDialog::Accepted )
{
// Set date integers
year = dp->getYear();
month = dp->getMonth();
day = dp->getDay();
// Set dateedited to TRUE
// This tells the transactiondisplay object that the user edited an transaction
// and did change the date3
dateedited = TRUE;
// Display date with our selected format
transactiondate->setText ( preferences->getDate ( year, month, day ) );
}
}
bool NewTransaction::getDateEdited ()
{
return dateedited;
}
int NewTransaction::getDay ()
{
return day;
}
int NewTransaction::getMonth ()
{
return month;
}
int NewTransaction::getYear ()
{
return year;
}
QString NewTransaction::getDescription ()
{
return transactiondescription;
}
void NewTransaction::setDescription ( QString description )
{
transactiondescription = description;
}
void NewTransaction::addTransactionDescription ()
{
// Function for adding or editing an transaction description.
QDialog *description = new QDialog ( this, "description", TRUE );
description->setCaption ( "Notes" );
QMultiLineEdit *enter = new QMultiLineEdit ( description );
enter->setFixedSize ( ( int ) (this->width() * 0.75 ), ( int ) ( this->height() * 0.5 ) );
enter->setWrapColumnOrWidth ( ( int ) (this->width() * 0.75 ) );
enter->setWordWrap ( QMultiLineEdit::WidgetWidth );
if ( transactiondescription != "(NULL)" )
enter->setText ( transactiondescription );
if ( description->exec () == QDialog::Accepted )
transactiondescription = enter->text ();
}
int NewTransaction::getNameIndex ( QString name )
{
int counter;
int items = transactionname->count();
for ( counter = 0; ( items - 1 ); counter++ )
{
if ( name == transactionname->text ( counter ) )
{
return counter;
break;
}
}
return 0;
}
void NewTransaction::setCurrentBudget ( int index )
{
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,195 +1,194 @@
#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 );
if ( preferences->getPreference ( 6 ) == 1 )
excludetransfers->setChecked ( TRUE );
else
excludetransfers->setChecked ( FALSE );
defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultTransactionPreferences () ) );
layout = new QVBoxLayout ( this, 2, 2 );
layout->addWidget ( showclearedtransactions );
layout->addWidget ( limittransactionsbox );
layout->addWidget ( excludetransfers );
layout->insertSpacing ( 3, 5 );
layout->addWidget ( defaults );
connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) );
connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) );
connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) );
}
TransactionPreferences::~TransactionPreferences ()
{
}
void TransactionPreferences::changeLimitTransactionsPreference ( int pref )
{
preferences->changePreference ( 7, pref );
}
void TransactionPreferences::changeShowClearedPreference ( bool state )
{
if ( state == TRUE )
preferences->changePreference ( 3, 1 );
else
preferences->changePreference ( 3, 0 );
}
void TransactionPreferences::changeExcludeTranfersPreference ( bool state )
{
if ( state == TRUE )
preferences->changePreference ( 6, 1 );
else
preferences->changePreference ( 6, 0 );
}
void TransactionPreferences::setDefaultTransactionPreferences ()
{
preferences->changePreference ( 3, 0 );
preferences->changePreference ( 6, 0 );
preferences->changePreference ( 7, 0 );
showclearedtransactions->setChecked ( FALSE );
limittransactions->setCurrentItem ( 0 );
}
// START ACCOUNT PREFERNCES
AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
{
setCaption( tr ( "Account" ) );
currencysupport = new QCheckBox ( this );
currencysupport->setText ( "Enable Currency Support" );
onetouch = new QCheckBox ( this );
onetouch->setText ( "One Touch Account Viewing" );
if ( preferences->getPreference ( 4 ) == 1 )
currencysupport->setChecked ( TRUE );
else
currencysupport->setChecked ( FALSE );
if ( preferences->getPreference ( 5 ) == 1 )
onetouch->setChecked ( TRUE );
else
onetouch->setChecked ( FALSE );
defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultAccountPreferences () ) );
layout = new QVBoxLayout ( this, 2, 2 );
layout->addWidget ( currencysupport );
layout->addWidget ( onetouch );
layout->insertSpacing ( 2, 5 );
layout->addWidget ( defaults );
connect ( currencysupport, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeCurrencySupport ( bool ) ) );
connect ( onetouch, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeOneTouchViewing ( bool ) ) );
}
AccountPreferences::~AccountPreferences ()
{
}
void AccountPreferences::changeCurrencySupport ( bool state )
{
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,207 +1,204 @@
#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 )
amount = amount * -1;
// add the transaction name to the memory items
memory->addMemoryItem ( newtransaction->transactionname->currentText() );
// add the transaction
if ( newtransaction->getDateEdited () == TRUE )
transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ),
newtransaction->transactionnumber->text().toInt(), newtransaction->getDay(), newtransaction->getMonth(), newtransaction->getYear(), amount, cleared, newtransaction->getCurrentBudget(),
newtransaction->getCurrentLineItem() );
else
transaction->addTransaction ( newtransaction->getDescription(), newtransaction->transactionname->currentText(), accountid, account->getParentAccountID ( accountid ),
newtransaction->transactionnumber->text().toInt(), defaultday, defaultmonth, defaultyear, amount, cleared, newtransaction->getCurrentBudget(), newtransaction->getCurrentLineItem() );
// redisplay transactions
listview->clear();
QString displaytext = "%";
displaytext.prepend ( limitbox->text() );
setTransactionDisplayDate ();
if ( transaction->getNumberOfTransactions() > 0 )
transaction->displayTransactions ( listview, accountid, children, displaytext, displaydate );
// redisplay transfers
if ( transfer->getNumberOfTransfers() > 0 )
transfer->displayTransfers ( listview, accountid, children, displaydate );
// add the transaction amount to the account it's associated with
// and update its parent account balance if necessary
account->updateAccountBalance ( accountid );
if ( account->getParentAccountID ( accountid ) != -1 )
account->changeParentAccountBalance ( account->getParentAccountID ( accountid ) );
// format then reset the account balance
redisplayAccountBalance ();
}
}
void TransactionDisplay::checkListViewEdit ()
{
if ( listview->selectedItem() == 0 )
QMessageBox::warning ( this, "QashMoney", "Please select a transaction\nto edit.");
else if ( listview->currentItem()->text ( getIDColumn() ).toInt() < 0 )
editTransfer ();
else
editTransaction();
}
void TransactionDisplay::showCalculator ()
{
Calculator *calculator = new Calculator ( this );
if ( calculator->exec () == QDialog::Accepted )
amount->setText ( calculator->display->text() );
}
void TransactionDisplay::showCalendar ()
{
QDate newDate = QDate::currentDate ();
DatePicker *dp = new DatePicker ( newDate );
if ( dp->exec () == QDialog::Accepted )
{
year = dp->getYear();
month = dp->getMonth();
day = dp->getDay();
date->setText ( preferences->getDate ( year, month, day ) );
}
}
void TransactionDisplay::editTransfer ()
{
transferid = listview->currentItem()->text ( getIDColumn() ).toInt();
fromaccount = transfer->getFromAccountID ( transferid );
toaccount = transfer->getToAccountID ( transferid );
year = transfer->getYear ( transferid );
month = transfer->getMonth ( transferid );
day = transfer->getDay ( transferid );
QDialog *editransfer = new QDialog ( this, "edittransfer", TRUE );
editransfer->setCaption ( "Transfer" );
QStringList accountnames = account->getAccountNames();
QStringList accountids = account->getAccountIDs();
QLabel *fromaccountlabel = new QLabel ( "From Account:", editransfer );
QFont f = this->font();
f.setWeight ( QFont::Bold );
fromaccountlabel->setFont ( f );
QComboBox *fromaccountbox = new QComboBox ( editransfer );
fromaccountbox->insertStringList ( accountnames );
fromaccountbox->setCurrentItem ( accountids.findIndex ( QString::number ( fromaccount ) ) );
QLabel *toaccountlabel = new QLabel ( "To Account:", editransfer );
toaccountlabel->setFont ( f );
QComboBox *toaccountbox = new QComboBox ( editransfer );
toaccountbox->insertStringList ( accountnames );
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,114 +1,112 @@
#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;
}
void TransferDialog::showCalculator ()
{
Calculator *calculator = new Calculator ( this );
if ( calculator->exec () == QDialog::Accepted )
amount->setText ( calculator->display->text() );
}
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,229 +1,228 @@
/**********************************************************************
** 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,
SLOT(listViewSlot()), navigation, "View Multiple Items");
setToolBarsMovable(FALSE);
setToolBarsMovable(FALSE);
setToolBarsMovable(FALSE);
/* Build widgets */
browseView = new TVBrowseView(&ts, this, 0);
listView = new TVListView(&ts, this, 0);
filterView = new TVFilterView(&ts, this, 0);
fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer",
this, "fileselector");
fileSelector->setNewVisible(FALSE);
fileSelector->setCloseVisible(FALSE);
cw = new QWidgetStack(this, 0);
cw->addWidget(listView, ListState);
cw->addWidget(browseView, BrowseState);
cw->addWidget(filterView, FilterState);
cw->addWidget(fileSelector, FileState);
current_view = FileState;
cw->raiseWidget(current_view);
fileSelector->reread();
connect(browseView, SIGNAL(searchOnKey(int, TVVariant)),
this, SLOT(searchOnKey(int, TVVariant)));
connect(browseView, SIGNAL(sortChanged(int)),
this, SLOT(setPrimaryKey(int)));
connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot()));
connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)),
this, SLOT(openDocument(const DocLnk &)));
main_layout->addWidget(menu);
main_layout->addWidget(cw);
setCentralWidget(cw);
}
/*!
Destroys the TableViewerWindow
*/
TableViewerWindow::~TableViewerWindow()
{
if(dirty)
saveDocument();
}
/*!
Opens a file dialog and loads the file specified by the dialog
*/
void TableViewerWindow::selectDocument()
{
if(dirty)
saveDocument();
current_view = FileState;
cw->raiseWidget(current_view);
fileSelector->reread();
}
void TableViewerWindow::saveDocument()
{
if(!dirty)
return;
FileManager fm;
QIODevice *dev = fm.saveFile(doc);
if(!ds->saveSource(dev, doc.type())){
qWarning("Save unsuccessful");
return;
}
dev->close();
dirty = FALSE;
}
void TableViewerWindow::newDocument()
{
DocLnk nf;
nf.setType("text/x-xml-tableviewer");
nf.setName("table");
delete ds;
ds = new DBStore();
ts.current_column = 0;
ts.kRep = ds->getKeys();
browseView->reset();
listView->reset();
filterView->reset();
doc = nf;
dirty = FALSE;