summaryrefslogtreecommitdiff
path: root/noncore/apps
authorar <ar>2004-05-31 15:26:50 (UTC)
committer ar <ar>2004-05-31 15:26:50 (UTC)
commit27dfc34d411dee76f09f5e516c60b0a64eb35948 (patch) (side-by-side diff)
treeb7f7259497630390e352a1257cac5dc59f5399a6 /noncore/apps
parent27b09fe4f930b96e82cea9fb0eb1a9b87f7ec062 (diff)
downloadopie-27dfc34d411dee76f09f5e516c60b0a64eb35948.zip
opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.gz
opie-27dfc34d411dee76f09f5e516c60b0a64eb35948.tar.bz2
- convert qWarning to owarn
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-write/qrichtext_p.h157
-rw-r--r--noncore/apps/tableviewer/browsekeyentry.cpp53
-rw-r--r--noncore/apps/tableviewer/db/common.cpp165
-rw-r--r--noncore/apps/tableviewer/db/datacache.cpp68
-rw-r--r--noncore/apps/tableviewer/db/datacache.h24
-rw-r--r--noncore/apps/tableviewer/ui/browsekeyentry.cpp49
-rw-r--r--noncore/apps/tableviewer/ui/filterkeyentry.cpp42
-rw-r--r--noncore/apps/tableviewer/ui/tvfilterview.cpp55
-rw-r--r--noncore/apps/tinykate/libkate/kateconfig.cpp4
-rw-r--r--noncore/apps/zsafe/main.cpp25
-rw-r--r--noncore/apps/zsafe/zlistview.cpp11
-rw-r--r--noncore/apps/zsafe/zsafe.cpp51
12 files changed, 361 insertions, 343 deletions
diff --git a/noncore/apps/opie-write/qrichtext_p.h b/noncore/apps/opie-write/qrichtext_p.h
index e368edb..3778feb 100644
--- a/noncore/apps/opie-write/qrichtext_p.h
+++ b/noncore/apps/opie-write/qrichtext_p.h
@@ -41,24 +41,27 @@
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of a number of Qt sources files. This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
//
//
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
#ifndef QT_H
#include "qstring.h"
#include "qlist.h"
#include "qrect.h"
#include "qfontmetrics.h"
#include "qintdict.h"
#include "qmap.h"
#include "qstringlist.h"
#include "qfont.h"
#include "qcolor.h"
#include "qsize.h"
#include "qvaluelist.h"
@@ -115,46 +118,46 @@ public:
int x;
int height() const;
int ascent() const;
int descent() const;
bool isCustom() const { return (type & Custom) != 0; }
QTextFormat *format() const;
QTextCustomItem *customItem() const;
void setFormat( QTextFormat *f );
void setCustomItem( QTextCustomItem *i );
struct CustomData
{
- QTextFormat *format;
- QTextCustomItem *custom;
- QString anchorName;
- QString anchorHref;
+ QTextFormat *format;
+ QTextCustomItem *custom;
+ QString anchorName;
+ QString anchorHref;
};
void loseCustomItem();
union {
- QTextFormat* format;
- CustomData* custom;
+ QTextFormat* format;
+ CustomData* custom;
} d;
bool isAnchor() const { return ( type & Anchor) != 0; }
QString anchorName() const;
QString anchorHref() const;
void setAnchor( const QString& name, const QString& href );
private:
QTextStringChar &operator=( const QTextStringChar & ) {
- //abort();
- return *this;
+ //abort();
+ return *this;
}
friend class QComplexText;
friend class QTextParagraph;
};
#if defined(Q_TEMPLATEDLL)
// MOC_SKIP_BEGIN
Q_TEMPLATE_EXTERN template class Q_EXPORT QMemArray<QTextStringChar>;
// MOC_SKIP_END
#endif
class Q_EXPORT QTextString
@@ -199,32 +202,32 @@ private:
void checkBidi() const;
QMemArray<QTextStringChar> data;
uint bidiDirty : 1;
uint bidi : 1; // true when the paragraph has right to left characters
uint rightToLeft : 1;
uint dir : 5;
};
inline bool QTextString::isBidi() const
{
if ( bidiDirty )
- checkBidi();
+ checkBidi();
return bidi;
}
inline bool QTextString::isRightToLeft() const
{
if ( bidiDirty )
- checkBidi();
+ checkBidi();
return rightToLeft;
}
inline QChar::Direction QTextString::direction() const
{
return (QChar::Direction) dir;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#if defined(Q_TEMPLATEDLL)
// MOC_SKIP_BEGIN
@@ -375,25 +378,25 @@ private:
inline QTextCommandHistory::~QTextCommandHistory()
{
clear();
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class Q_EXPORT QTextCustomItem
{
public:
QTextCustomItem( QTextDocument *p )
- : xpos(0), ypos(-1), width(-1), height(0), parent( p )
+ : xpos(0), ypos(-1), width(-1), height(0), parent( p )
{}
virtual ~QTextCustomItem();
virtual void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ) = 0;
virtual void adjustToPainter( QPainter* );
enum Placement { PlaceInline = 0, PlaceLeft, PlaceRight };
virtual Placement placement() const;
bool placeInline() { return placement() == PlaceInline; }
virtual bool ownLine() const;
virtual void resize( int nwidth );
@@ -429,50 +432,50 @@ public:
};
#if defined(Q_TEMPLATEDLL)
// MOC_SKIP_BEGIN
Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<QString, QString>;
// MOC_SKIP_END
#endif
class Q_EXPORT QTextImage : public QTextCustomItem
{
public:
QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context,
- QMimeSourceFactory &factory );
+ QMimeSourceFactory &factory );
virtual ~QTextImage();
Placement placement() const { return place; }
void adjustToPainter( QPainter* );
int minimumWidth() const { return width; }
QString richText() const;
void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected );
private:
QRegion* reg;
QPixmap pm;
Placement place;
int tmpwidth, tmpheight;
QMap<QString, QString> attributes;
QString imgId;
};
class Q_EXPORT QTextHorizontalLine : public QTextCustomItem
{
public:
QTextHorizontalLine( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context,
- QMimeSourceFactory &factory );
+ QMimeSourceFactory &factory );
virtual ~QTextHorizontalLine();
void adjustToPainter( QPainter* );
void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected );
QString richText() const;
bool ownLine() const { return TRUE; }
private:
int tmpheight;
QColor color;
@@ -523,29 +526,29 @@ private:
};
inline int QTextFlow::width() const { return w; }
class QTextTable;
class Q_EXPORT QTextTableCell : public QLayoutItem
{
friend class QTextTable;
public:
QTextTableCell( QTextTable* table,
- int row, int column,
- const QMap<QString, QString> &attr,
- const QStyleSheetItem* style,
- const QTextFormat& fmt, const QString& context,
- QMimeSourceFactory &factory, QStyleSheet *sheet, const QString& doc );
+ int row, int column,
+ const QMap<QString, QString> &attr,
+ const QStyleSheetItem* style,
+ const QTextFormat& fmt, const QString& context,
+ QMimeSourceFactory &factory, QStyleSheet *sheet, const QString& doc );
virtual ~QTextTableCell();
QSize sizeHint() const ;
QSize minimumSize() const ;
QSize maximumSize() const ;
QSizePolicy::ExpandData expanding() const;
bool isEmpty() const;
void setGeometry( const QRect& ) ;
QRect geometry() const;
bool hasHeightForWidth() const;
int heightForWidth( int ) const;
@@ -597,25 +600,25 @@ Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<QTextCursor*, int>;
class Q_EXPORT QTextTable: public QTextCustomItem
{
friend class QTextTableCell;
public:
QTextTable( QTextDocument *p, const QMap<QString, QString> &attr );
virtual ~QTextTable();
void adjustToPainter( QPainter *p );
void pageBreak( int y, QTextFlow* flow );
void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch,
- const QColorGroup& cg, bool selected );
+ const QColorGroup& cg, bool selected );
bool noErase() const { return TRUE; }
bool ownLine() const { return TRUE; }
Placement placement() const { return place; }
bool isNested() const { return TRUE; }
void resize( int nwidth );
virtual void invalidate();
virtual bool enter( QTextCursor *c, QTextDocument *&doc, QTextParagraph *&parag, int &idx, int &ox, int &oy, bool atEnd = FALSE );
virtual bool enterAt( QTextCursor *c, QTextDocument *&doc, QTextParagraph *&parag, int &idx, int &ox, int &oy, const QPoint &pos );
virtual bool next( QTextCursor *c, QTextDocument *&doc, QTextParagraph *&parag, int &idx, int &ox, int &oy );
virtual bool prev( QTextCursor *c, QTextDocument *&doc, QTextParagraph *&parag, int &idx, int &ox, int &oy );
@@ -675,27 +678,27 @@ Q_TEMPLATE_EXTERN template class Q_EXPORT QPtrList<QTextDocument>;
class Q_EXPORT QTextDocument : public QObject
{
Q_OBJECT
friend class QTextTableCell;
friend class QTextCursor;
friend class QTextEdit;
friend class QTextParagraph;
public:
enum SelectionIds {
- Standard = 0,
- Temp = 32000 // This selection must not be drawn, it's used e.g. by undo/redo to
- // remove multiple lines with removeSelectedText()
+ Standard = 0,
+ Temp = 32000 // This selection must not be drawn, it's used e.g. by undo/redo to
+ // remove multiple lines with removeSelectedText()
};
QTextDocument( QTextDocument *p );
QTextDocument( QTextDocument *d, QTextFormatCollection *f );
virtual ~QTextDocument();
QTextDocument *parent() const { return par; }
QTextParagraph *parentParagraph() const { return parentPar; }
void setText( const QString &text, const QString &context );
QMap<QString, QString> attributes() const { return attribs; }
void setAttributes( const QMap<QString, QString> &attr ) { attribs = attr; }
@@ -782,29 +785,29 @@ public:
void setMimeSourceFactory( QMimeSourceFactory *f ) { if ( f ) factory_ = f; }
void setContext( const QString &c ) { if ( !c.isEmpty() ) contxt = c; }
void setUnderlineLinks( bool b );
bool underlineLinks() const { return underlLinks; }
void setPaper( QBrush *brush ) { if ( backBrush ) delete backBrush; backBrush = brush; }
QBrush *paper() const { return backBrush; }
void doLayout( QPainter *p, int w );
void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 );
void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch,
- QPixmap *&doubleBuffer, const QColorGroup &cg,
- bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE );
+ QPixmap *&doubleBuffer, const QColorGroup &cg,
+ bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE );
QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg,
- bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0,
- bool resetChanged = TRUE );
+ bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0,
+ bool resetChanged = TRUE );
void registerCustomItem( QTextCustomItem *i, QTextParagraph *p );
void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p );
void setFlow( QTextFlow *f );
void takeFlow();
QTextFlow *flow() const { return flow_; }
bool isPageBreakEnabled() const { return pages; }
void setPageBreakEnabled( bool b ) { pages = b; }
void setUseFormatCollection( bool b ) { useFC = b; }
bool useFormatCollection() const { return useFC; }
@@ -849,40 +852,40 @@ public:
static bool endsWith( QString str, const QString &s);
signals:
void minimumWidthChanged( int );
private:
void init();
QPixmap *bufferPixmap( const QSize &s );
// HTML parser
bool hasPrefix(const QChar* doc, int length, int pos, QChar c);
bool hasPrefix(const QChar* doc, int length, int pos, const QString& s);
QTextCustomItem* parseTable( const QMap<QString, QString> &attr, const QTextFormat &fmt,
- const QChar* doc, int length, int& pos, QTextParagraph *curpar );
+ const QChar* doc, int length, int& pos, QTextParagraph *curpar );
bool eatSpace(const QChar* doc, int length, int& pos, bool includeNbsp = FALSE );
bool eat(const QChar* doc, int length, int& pos, QChar c);
QString parseOpenTag(const QChar* doc, int length, int& pos, QMap<QString, QString> &attr, bool& emptyTag);
QString parseCloseTag( const QChar* doc, int length, int& pos );
QChar parseHTMLSpecialChar(const QChar* doc, int length, int& pos);
QString parseWord(const QChar* doc, int length, int& pos, bool lower = TRUE);
QChar parseChar(const QChar* doc, int length, int& pos, QStyleSheetItem::WhiteSpaceMode wsm );
void setRichTextInternal( const QString &text, QTextCursor* cursor = 0 );
void setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheetItem> >& styles, QTextParagraph* stylesPar );
private:
struct Q_EXPORT Focus {
- QTextParagraph *parag;
- int start, len;
- QString href;
+ QTextParagraph *parag;
+ int start, len;
+ QString href;
};
int cx, cy, cw, vw;
QTextParagraph *fParag, *lParag;
QTextPreProcessor *pProcessor;
QMap<int, QColor> selectionColors;
QMap<int, QTextDocumentSelection> selections;
QMap<int, bool> selectionText;
QTextCommandHistory *commandHistory;
QTextFormatter *pFormatter;
QTextIndent *indenter;
QTextFormatCollection *fCollection;
@@ -922,48 +925,48 @@ private:
double scaleFontsFactor;
short list_tm,list_bm, list_lm, li_tm, li_bm, par_tm, par_bm;
};
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class Q_EXPORT QTextDeleteCommand : public QTextCommand
{
public:
QTextDeleteCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str,
- const QByteArray& oldStyle );
+ const QByteArray& oldStyle );
QTextDeleteCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str );
virtual ~QTextDeleteCommand();
Commands type() const { return Delete; }
QTextCursor *execute( QTextCursor *c );
QTextCursor *unexecute( QTextCursor *c );
protected:
int id, index;
QTextParagraph *parag;
QMemArray<QTextStringChar> text;
QByteArray styleInformation;
};
class Q_EXPORT QTextInsertCommand : public QTextDeleteCommand
{
public:
QTextInsertCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str,
- const QByteArray& oldStyleInfo )
- : QTextDeleteCommand( d, i, idx, str, oldStyleInfo ) {}
+ const QByteArray& oldStyleInfo )
+ : QTextDeleteCommand( d, i, idx, str, oldStyleInfo ) {}
QTextInsertCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str )
- : QTextDeleteCommand( p, idx, str ) {}
+ : QTextDeleteCommand( p, idx, str ) {}
virtual ~QTextInsertCommand() {}
Commands type() const { return Insert; }
QTextCursor *execute( QTextCursor *c ) { return QTextDeleteCommand::unexecute( c ); }
QTextCursor *unexecute( QTextCursor *c ) { return QTextDeleteCommand::execute( c ); }
};
class Q_EXPORT QTextFormatCommand : public QTextCommand
{
public:
QTextFormatCommand( QTextDocument *d, int sid, int sidx, int eid, int eidx, const QMemArray<QTextStringChar> &old, QTextFormat *f, int fl );
@@ -1002,55 +1005,55 @@ private:
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
struct Q_EXPORT QTextParagraphSelection
{
int start, end;
};
struct Q_EXPORT QTextLineStart
{
QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 )
#ifndef QT_NO_COMPLEXTEXT
- , bidicontext( 0 )
+ , bidicontext( 0 )
#endif
{ }
QTextLineStart( ushort y_, ushort bl, ushort h_ ) : y( y_ ), baseLine( bl ), h( h_ ),
- w( 0 )
+ w( 0 )
#ifndef QT_NO_COMPLEXTEXT
- , bidicontext( 0 )
+ , bidicontext( 0 )
#endif
{ }
#ifndef QT_NO_COMPLEXTEXT
QTextLineStart( QBidiContext *c, QBidiStatus s ) : y(0), baseLine(0), h(0),
- status( s ), bidicontext( c ) { if ( bidicontext ) bidicontext->ref(); }
+ status( s ), bidicontext( c ) { if ( bidicontext ) bidicontext->ref(); }
#endif
virtual ~QTextLineStart()
{
#ifndef QT_NO_COMPLEXTEXT
- if ( bidicontext && bidicontext->deref() )
- delete bidicontext;
+ if ( bidicontext && bidicontext->deref() )
+ delete bidicontext;
#endif
}
#ifndef QT_NO_COMPLEXTEXT
void setContext( QBidiContext *c ) {
- if ( c == bidicontext )
- return;
- if ( bidicontext && bidicontext->deref() )
- delete bidicontext;
- bidicontext = c;
- if ( bidicontext )
- bidicontext->ref();
+ if ( c == bidicontext )
+ return;
+ if ( bidicontext && bidicontext->deref() )
+ delete bidicontext;
+ bidicontext = c;
+ if ( bidicontext )
+ bidicontext->ref();
}
QBidiContext *context() const { return bidicontext; }
#endif
public:
ushort y, baseLine, h;
#ifndef QT_NO_COMPLEXTEXT
QBidiStatus status;
#endif
int w;
private:
@@ -1174,25 +1177,25 @@ public:
void setExtraData( QTextParagraphData *data );
QTextParagraphData *extraData() const;
QMap<int, QTextLineStart*> &lineStartList();
void setFormat( int index, int len, QTextFormat *f, bool useCollection = TRUE, int flags = -1 );
void setAlignment( int a );
int alignment() const;
virtual void paint( QPainter &painter, const QColorGroup &cg, QTextCursor *cursor = 0, bool drawSelections = FALSE,
- int clipx = -1, int clipy = -1, int clipw = -1, int cliph = -1 );
+ int clipx = -1, int clipy = -1, int clipw = -1, int cliph = -1 );
virtual int topMargin() const;
virtual int bottomMargin() const;
virtual int leftMargin() const;
virtual int firstLineMargin() const;
virtual int rightMargin() const;
virtual int lineSpacing() const;
void registerFloatingItem( QTextCustomItem *i );
void unregisterFloatingItem( QTextCustomItem *i );
void setFullWidth( bool b ) { fullWidth = b; }
@@ -1237,27 +1240,27 @@ public:
void setMovedDown( bool b ) { movedDown = b; }
bool wasMovedDown() const { return movedDown; }
void setDirection( QChar::Direction d );
QChar::Direction direction() const;
void readStyleInformation( QDataStream& stream );
void writeStyleInformation( QDataStream& stream ) const;
protected:
virtual void drawLabel( QPainter* p, int x, int y, int w, int h, int base, const QColorGroup& cg );
virtual void drawString( QPainter &painter, const QString &str, int start, int len, int xstart,
- int y, int baseLine, int w, int h, int selection,
- QTextStringChar *formatChar, const QColorGroup& cg,
- bool rightToLeft );
+ int y, int baseLine, int w, int h, int selection,
+ QTextStringChar *formatChar, const QColorGroup& cg,
+ bool rightToLeft );
private:
QMap<int, QTextParagraphSelection> &selections() const;
QPtrList<QTextCustomItem> &floatingItems() const;
QBrush backgroundBrush( const QColorGroup&cg ) { if ( bgcol ) return *bgcol; return cg.brush( QColorGroup::Base ); }
void invalidateStyleCache();
QMap<int, QTextLineStart*> lineStarts;
int invalid;
QRect r;
QTextParagraph *p, *n;
void *docOrPseudo;
@@ -1306,28 +1309,28 @@ public:
virtual void setWrapEnabled( bool b );
virtual void setWrapAtColumn( int c );
virtual void setAllowBreakInWords( bool b ) { biw = b; }
bool allowBreakInWords() const { return biw; }
int minimumWidth() const { return thisminw; }
int widthUsed() const { return thiswused; }
static bool isBreakable( QTextString *string, int pos );
protected:
virtual QTextLineStart *formatLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start,
- QTextStringChar *last, int align = Qt3::AlignAuto, int space = 0 );
+ QTextStringChar *last, int align = Qt3::AlignAuto, int space = 0 );
#ifndef QT_NO_COMPLEXTEXT
virtual QTextLineStart *bidiReorderLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start,
- QTextStringChar *last, int align, int space );
+ QTextStringChar *last, int align, int space );
#endif
void insertLineStart( QTextParagraph *parag, int index, QTextLineStart *ls );
int thisminw;
int thiswused;
private:
bool wrapEnabled;
int wrapColumn;
bool biw;
#ifdef HAVE_THAI_BREAKS
@@ -1370,56 +1373,56 @@ public:
virtual ~QTextIndent() {}
virtual void indent( QTextDocument *doc, QTextParagraph *parag, int *oldIndent = 0, int *newIndent = 0 ) = 0;
};
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class Q_EXPORT QTextPreProcessor
{
public:
enum Ids {
- Standard = 0
+ Standard = 0
};
QTextPreProcessor();
virtual ~QTextPreProcessor() {}
virtual void process( QTextDocument *doc, QTextParagraph *, int, bool = TRUE ) = 0;
virtual QTextFormat *format( int id ) = 0;
};
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class Q_EXPORT QTextFormat
{
friend class QTextFormatCollection;
friend class QTextDocument;
public:
enum Flags {
- NoFlags,
- Bold = 1,
- Italic = 2,
- Underline = 4,
- Family = 8,
- Size = 16,
- Color = 32,
- Misspelled = 64,
- VAlign = 128,
- StrikeOut= 256,
- Font = Bold | Italic | Underline | Family | Size | StrikeOut,
- Format = Font | Color | Misspelled | VAlign
+ NoFlags,
+ Bold = 1,
+ Italic = 2,
+ Underline = 4,
+ Family = 8,
+ Size = 16,
+ Color = 32,
+ Misspelled = 64,
+ VAlign = 128,
+ StrikeOut= 256,
+ Font = Bold | Italic | Underline | Family | Size | StrikeOut,
+ Format = Font | Color | Misspelled | VAlign
};
enum VerticalAlignment { AlignNormal, AlignSuperScript, AlignSubScript };
QTextFormat();
virtual ~QTextFormat();
QTextFormat( const QStyleSheetItem *s );
QTextFormat( const QFont &f, const QColor &c, QTextFormatCollection *parent = 0 );
QTextFormat( const QTextFormat &fm );
QTextFormat makeTextFormat( const QStyleSheetItem *style, const QMap<QString,QString>& attr, double scaleFontsFactor ) const;
QTextFormat& operator=( const QTextFormat &fm );
@@ -1720,32 +1723,32 @@ inline void QTextDocument::setTabArray( int *a )
{
tArray = a;
}
inline void QTextDocument::setTabStops( int tw )
{
tStopWidth = tw;
}
inline QString QTextDocument::originalText() const
{
if ( oTextValid )
- return oText;
+ return oText;
return text();
}
inline void QTextDocument::setFlow( QTextFlow *f )
{
if ( flow_ )
- delete flow_;
+ delete flow_;
flow_ = f;
}
inline void QTextDocument::takeFlow()
{
flow_ = 0;
}
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
inline QColor QTextFormat::color() const
{
@@ -1777,29 +1780,29 @@ inline QTextFormatCollection *QTextFormat::parent() const
return collection;
}
inline void QTextFormat::addRef()
{
ref++;
}
inline void QTextFormat::removeRef()
{
ref--;
if ( !collection )
- return;
+ return;
if ( this == collection->defFormat )
- return;
+ return;
if ( ref == 0 )
- collection->remove( this );
+ collection->remove( this );
}
inline QString QTextFormat::key() const
{
return k;
}
inline bool QTextFormat::useLinkColor() const
{
return linkColor;
}
@@ -1834,65 +1837,65 @@ inline void QTextParagraph::setBackgroundColor( const QColor & c )
bgcol = new QColor( c );
setChanged( TRUE );
}
inline void QTextParagraph::clearBackgroundColor()
{
delete bgcol; bgcol = 0; setChanged( TRUE );
}
inline void QTextParagraph::append( const QString &s, bool reallyAtEnd )
{
if ( reallyAtEnd )
- insert( str->length(), s );
+ insert( str->length(), s );
else
- insert( QMAX( str->length() - 1, 0 ), s );
+ insert( QMAX( str->length() - 1, 0 ), s );
}
inline QTextParagraph *QTextParagraph::prev() const
{
return p;
}
inline QTextParagraph *QTextParagraph::next() const
{
return n;
}
inline bool QTextParagraph::hasAnySelection() const
{
return mSelections ? !selections().isEmpty() : FALSE;
}
inline void QTextParagraph::setEndState( int s )
{
if ( s == state )
- return;
+ return;
state = s;
}
inline int QTextParagraph::endState() const
{
return state;
}
inline void QTextParagraph::setParagId( int i )
{
id = i;
}
inline int QTextParagraph::paragId() const
{
if ( id == -1 )
- qWarning( "invalid parag id!!!!!!!! (%p)", (void*)this );
+ owarn << "invalid parag id!!!!!!!! (" << (void*)this << ")" << oendl;
return id;
}
inline bool QTextParagraph::firstPreProcess() const
{
return firstPProcess;
}
inline void QTextParagraph::setFirstPreProcess( bool b )
{
firstPProcess = b;
}
@@ -1901,32 +1904,32 @@ inline QMap<int, QTextLineStart*> &QTextParagraph::lineStartList()
{
return lineStarts;
}
inline QTextString *QTextParagraph::string() const
{
return str;
}
inline QTextDocument *QTextParagraph::document() const
{
if ( hasdoc )
- return (QTextDocument*) docOrPseudo;
+ return (QTextDocument*) docOrPseudo;
return 0;
}
inline QTextParagraphPseudoDocument *QTextParagraph::pseudoDocument() const
{
if ( hasdoc )
- return 0;
+ return 0;
return (QTextParagraphPseudoDocument*) docOrPseudo;
}
inline QTextTableCell *QTextParagraph::tableCell() const
{
return hasdoc ? document()->tableCell () : 0;
}
inline QTextCommandHistory *QTextParagraph::commands() const
{
return hasdoc ? document()->commands() : pseudoDocument()->commandHistory;
diff --git a/noncore/apps/tableviewer/browsekeyentry.cpp b/noncore/apps/tableviewer/browsekeyentry.cpp
index 04e7902..bab9af6 100644
--- a/noncore/apps/tableviewer/browsekeyentry.cpp
+++ b/noncore/apps/tableviewer/browsekeyentry.cpp
@@ -7,51 +7,53 @@
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
-**********************************************************************/
+**********************************************************************/
#include "browsekeyentry.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qtoolbutton.h>
#include <qwidgetstack.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include <qhbox.h>
#include <qdatetime.h>
-//#include <iostream.h>
-#include <qheader.h>
-// For qWarning(const char *)
/*!
\class TVBrowseKeyEntry
\brief a Widget used enter keys into the TVBrowseViewWidget
The TVBrowseKeyEntry Widget provides the facility to enter
various key types to be search on in the table. The key can be changed
and the entry field will update to the correct sort of widget appropriately
*/
/*!
- Constructs the widget
+ Constructs the widget
*/
TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
: QWidget(parent, name, f)
{
int stack_elem = 0;
QHBoxLayout *h_layout = new QHBoxLayout(this);
textKey = new QLineEdit(this, 0);
dateKey = new QHBox(this, 0);
dayKey = new QLineEdit(dateKey, 0);
monthKey = new QLineEdit(dateKey, 0);
@@ -71,55 +73,55 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
changeKeyButton->setText(tr("key"));
totalKeys = 0;
ts = 0;
keyMenu = new QPopupMenu(this, "keymenu");
ws = new QWidgetStack(this, 0);
ws->addWidget(textKey, stack_elem++);
ws->addWidget(timeKey, stack_elem++);
ws->addWidget(dateKey, stack_elem++);
ws->raiseWidget(0);
-
+
// TODO connect slots and signals....
- connect(changeKeyButton, SIGNAL(clicked()),
+ connect(changeKeyButton, SIGNAL(clicked()),
this, SLOT(changeKeyMenuSlot()));
- connect(resetButton, SIGNAL(clicked()),
+ connect(resetButton, SIGNAL(clicked()),
this, SLOT(resetKeySlot()));
- connect(textKey, SIGNAL(textChanged(const QString&)),
+ connect(textKey, SIGNAL(textChanged(const QString&)),
this, SLOT(searchOnText()));
- connect(dayKey, SIGNAL(textChanged(const QString&)),
+ connect(dayKey, SIGNAL(textChanged(const QString&)),
this, SLOT(searchOnText()));
- connect(monthKey, SIGNAL(textChanged(const QString&)),
+ connect(monthKey, SIGNAL(textChanged(const QString&)),
this, SLOT(searchOnText()));
- connect(yearKey, SIGNAL(textChanged(const QString&)),
+ connect(yearKey, SIGNAL(textChanged(const QString&)),
this, SLOT(searchOnText()));
- connect(secondKey, SIGNAL(textChanged(const QString&)),
+ connect(secondKey, SIGNAL(textChanged(const QString&)),
this, SLOT(searchOnText()));
- connect(minuteKey, SIGNAL(textChanged(const QString&)),
+ connect(minuteKey, SIGNAL(textChanged(const QString&)),
this, SLOT(searchOnText()));
- connect(hourKey, SIGNAL(textChanged(const QString&)),
+ connect(hourKey, SIGNAL(textChanged(const QString&)),
this, SLOT(searchOnText()));
-
+
h_layout->addWidget(ws);
h_layout->addWidget(resetButton);
h_layout->addWidget(changeKeyButton);
}
/*!
- Destructs the widget
+ Destructs the widget
*/
TVBrowseKeyEntry::~TVBrowseKeyEntry()
{
}
/*!
Changes which key the user intends to search on
\param id_param the index of the key future searches should be base on
*/
void TVBrowseKeyEntry::changeKeySlot(int id_param)
{
@@ -127,62 +129,62 @@ void TVBrowseKeyEntry::changeKeySlot(int id_param)
switch(ts->kRep->getKeyType(ts->current_column)) {
/* work out what to raise */
case kt_string:
case kt_int:
ws->raiseWidget(0);
break;
case kt_time:
ws->raiseWidget(1);
break;
case kt_date:
ws->raiseWidget(2);
break;
- default:
- return;
+ default:
+ return;
}
}
/*!
Opens the change key menu
*/
void TVBrowseKeyEntry::changeKeyMenuSlot()
{
- if(ts)
+ if(ts)
keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0)));
}
/*!
Blanks the key entry widget
\TODO the actual implmentation
*/
void TVBrowseKeyEntry::resetKeySlot() {
;
}
void TVBrowseKeyEntry::setTableState(TableState *t) {
int i;
ts = t;
/* clear the old */
keyMenu->clear();
for (i = 0; i < t->kRep->getNumFields(); i++) {
- keyMenu->insertItem(ts->kRep->getKeyName(i), this,
+ keyMenu->insertItem(ts->kRep->getKeyName(i), this,
SLOT(changeKeySlot(int)), 0, i);
keyMenu->setItemParameter(i, i);
}
}
/*!
- Searches on the current value of the key entry provided that the
- current key is of type text WARNING, TODO fix memory leaks
+ Searches on the current value of the key entry provided that the
+ current key is of type text WARNING, TODO fix memory leaks
*/
void TVBrowseKeyEntry::searchOnText()
{
void *sendkey;
int tmp;
switch(ts->kRep->getKeyType(ts->current_column)) {
/* work out what to raise */
case kt_string:
sendkey = (void *)new QString(textKey->text());
break;
case kt_int: {
@@ -219,24 +221,23 @@ void TVBrowseKeyEntry::searchOnText()
m = monthKey->text().toInt(&ok);
if (!ok)
return;
y = yearKey->text().toInt(&ok);
if (!ok)
return;
if(!QDate::isValid(y, m, d))
return;
sendkey = (void *) new QDate(y, m, d);
break;
}
default:
- qWarning("TVBrowseKeyEntry::searchOnText() "
- "cannot work out data type");
+ owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl;
return;
}
emit searchOnKey(ts->current_column, sendkey);
}
/*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, void *v)
This signal indicates that a search on key index currentKeyId should be
done searching for the value v.
-*/
+*/
diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp
index b58af85..c35dbea 100644
--- a/noncore/apps/tableviewer/db/common.cpp
+++ b/noncore/apps/tableviewer/db/common.cpp
@@ -7,26 +7,26 @@
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
-**********************************************************************/
-#include "common.h"
+**********************************************************************/
+#include "common.h"
#include "datacache.h"
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/timestring.h>
using namespace Opie::Core;
/* QT */
#include <qstring.h>
#include <qheader.h>
#include <qvector.h>
#include <qdatetime.h>
@@ -79,31 +79,31 @@ int parseNextNumber(QString *q) {
\returns an int which is either
<UL>
<LI> < 0 if the first string is smaller than the second,</LI>
<LI> > 0 if the first string is bigger then the second,</LI>
<LI> == 0 if the first string is equal to the second.</LI>
</UL>
*/
int QStringVector::compareItems(Item a, Item b)
{
QString *qa = (QString *)a;
QString *qb = (QString *)b;
-
+
return QString::compare(*qa, *qb);
}
/*!
\class TVVariant
- A way of abstracting void * and keeping information on
+ A way of abstracting void * and keeping information on
the keytypes and behaviours in one place
*/
TVVariantPrivate::TVVariantPrivate()
{
typ = TVVariant::Invalid;
}
TVVariantPrivate::TVVariantPrivate( TVVariantPrivate *d)
{
switch(d->typ)
{
@@ -311,25 +311,25 @@ void TVVariant::load(QDataStream &s )
s >> *x;
d->value.ptr = x;
}
break;
case Int:
{
int x;
s >> x;
d->value.i = x;
}
break;
default:
- ofatal << "Unrecognized data type" << oendl;
+ ofatal << "Unrecognized data type" << oendl;
}
}
void TVVariant::save( QDataStream &s ) const
{
s << type();
switch( d->typ ) {
case String:
s << *((QString *)d->value.ptr);
break;
case Date:
@@ -373,25 +373,25 @@ QDataStream& operator<< (QDataStream& s, const TVVariant::KeyType& p)
return s;
}
const QString TVVariant::toString() const
{
switch(d->typ) {
case String:
return *((QString*)d->value.ptr);
case Date:
return ((QDate*)d->value.ptr)->toString();
case Time:
return ((QTime*)d->value.ptr)->toString();
- case Int:
+ case Int:
return QString::number(d->value.i);
case Invalid:
default:
return QString::null;
}
return QString::null;
}
// TODO DO, this properly, */
int TVVariant::toInt() const
{
if(d->typ == Int)
@@ -415,55 +415,55 @@ const QDate TVVariant::toDate() const
/* date format is day mon d yyyy */
/* ignore the first three letters, read the next
three for month.. etc */
int day = parseNextNumber(&q);
int month = parseNextNumber(&q);
int year = parseNextNumber(&q);
if (!QDate::isValid(year, month, day))
return QDate();
return QDate(year, month, day);
}
-
+
return QDate();
}
const QTime TVVariant::toTime() const
{
if(d->typ == Time)
return *((QTime *)d->value.ptr);
-
+
if(d->typ == String) {
QString q = toString();
int hour = parseNextNumber(&q);
int minute = parseNextNumber(&q);
int second = parseNextNumber(&q);
int msecond = parseNextNumber(&q);
if (!QTime::isValid(hour, minute, second, msecond))
return QTime();
return QTime(hour, minute, second, msecond);
}
return QTime();
}
#define TV_VARIANT_AS( f ) Q##f& TVVariant::as##f() { \
if ( d->typ != f ) \
*this = TVVariant( to##f() ); \
else \
detach(); \
return *((Q##f*)d->value.ptr); }
-
+
TV_VARIANT_AS(String)
TV_VARIANT_AS(Date)
TV_VARIANT_AS(Time)
#undef TV_VARIANT_AS
int& TVVariant::asInt()
{
detach();
if (d->typ != Int) {
d->value.i = toInt();
d->typ = Int;
@@ -551,162 +551,162 @@ bool TVVariant::operator>( const TVVariant &v ) const
case Invalid:
default:
break;
}
return FALSE;
}
/*! True if n is closer to this than o */
bool TVVariant::closer(TVVariant n, TVVariant o)
{
/* Nothing is close to an invalid, so nothing can be closer */
if(d->typ == Invalid)
- return FALSE;
+ return FALSE;
/* can't be closer if of different type */
if(n.type() != type())
return FALSE;
/* if new shares type, and old doesn't, then new is closer */
if(o.type() != type())
return TRUE;
switch(type()){
case String: {
- /* case for strings is close is a substring.. closer is
+ /* case for strings is close is a substring.. closer is
* earlier alphabetically */
QString qs1 = n.toString().lower();
QString qs2 = o.toString().lower();
QString qsv = toString().lower();
if (!qs1.startsWith(qsv))
return FALSE;
/* contains sub-str, if later than is not closer */
- if(QString::compare(qs1, qs2) > 0)
+ if(QString::compare(qs1, qs2) > 0)
return FALSE;
return TRUE;
}
case Int: {
/* case for int is smallest absolute difference */
int i1 = n.toInt();
int i2 = o.toInt();
int iv = toInt();
int diff1 = (i1 - iv);
- if (diff1 < 0)
+ if (diff1 < 0)
diff1 = -diff1;
int diff2 = (i2 - iv);
- if (diff2 < 0)
+ if (diff2 < 0)
diff2 = -diff2;
- if (diff1 < diff2)
+ if (diff1 < diff2)
return TRUE;
return FALSE;
}
case Date: {
QDate i1 = n.toDate();
QDate i2 = o.toDate();
QDate iv = toDate();
/* definition of closer is the least difference in days */
int diff1 = i1.daysTo(iv);
- if (diff1 < 0)
+ if (diff1 < 0)
diff1 = -diff1;
int diff2 = i2.daysTo(iv);
- if (diff2 < 0)
+ if (diff2 < 0)
diff2 = -diff2;
if (diff1 < diff2)
return TRUE;
return FALSE;
}
case Time: {
QTime i1 = n.toTime();
QTime i2 = o.toTime();
QTime iv = toTime();
/* definition of closer is the least difference in days */
int diff1 = i1.msecsTo(iv);
- if (diff1 < 0)
+ if (diff1 < 0)
diff1 = -diff1;
int diff2 = i2.msecsTo(iv);
- if (diff2 < 0)
+ if (diff2 < 0)
diff2 = -diff2;
if (diff1 < diff2)
return TRUE;
return FALSE;
}
default:
/* don't know how to do 'closer' on this type, hence never closer
* or even close */
break;
}
return FALSE;
}
/*! True if n is close to this */
bool TVVariant::close(TVVariant n)
{
/* Nothing is close to an invalid, so nothing can be closer */
if(type() == Invalid)
- return FALSE;
+ return FALSE;
/* can't be close if of different type */
if(n.type() != type())
return FALSE;
switch(type()){
case String: {
- /* case for strings is close is a substring.. closer is
+ /* case for strings is close is a substring.. closer is
* earlier alphabetically */
QString qs1 = n.toString().lower();
QString qsv = toString().lower();
if (!qs1.startsWith(qsv))
return FALSE;
return TRUE;
}
- case Int:
+ case Int:
case Date:
case Time:
return TRUE;
default:
/* don't know how to do 'closer' on this type, hence never closer
* or even close */
break;
}
return FALSE;
}
/*!
\class Key
\brief document me!
-
+
document me!
*/
Key::Key() : kname(), kexample(), kflags(0) { }
Key::Key(QString name, TVVariant example, int flags) :
- kname(name), kexample(example), kflags(flags) { }
+ kname(name), kexample(example), kflags(flags) { }
Key::Key(const Key &other)
{
kname = other.kname;
kexample = other.kexample;
kflags = other.kflags;
}
-Key& Key::operator=(const Key& key)
+Key& Key::operator=(const Key& key)
{
kname = key.kname;
kexample = key.kexample;
kflags = key.kflags;
return *this;
}
QString Key::name() const
{
return QString(kname);
}
@@ -768,31 +768,31 @@ void Key::setNewFlag(bool v)
/*!
\class KeyList
\brief A represntation of keys used for a table.
The KeyList class is used to store the representation of keys used in table
headings by DBStore. It stores the names and types of the keys
*/
/*!
Constructs a KeyList
*/
-KeyList::KeyList() : QIntDict<Key>(20)
+KeyList::KeyList() : QIntDict<Key>(20)
{
setAutoDelete(TRUE);
}
/* Should be deep copy, but isn't */
-KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k)
+KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k)
{
KeyListIterator it(k);
while(it.current()) {
replace(it.currentKey(), new Key(*it.current()));
++it;
}
setAutoDelete(TRUE);
}
/*!
Destroys a KeyList
@@ -813,137 +813,136 @@ bool KeyList::operator!=(const KeyList &other)
if (other.getKeyName(it.currentKey()) != getKeyName(it.currentKey()))
return TRUE;
if (other.getKeyType(it.currentKey()) != getKeyType(it.currentKey()))
return TRUE;
++it;
}
return FALSE;
}
/*!
Returns the number of keys stored in the KeyList
*/
-int KeyList::getNumFields() const
+int KeyList::getNumFields() const
{
return count();
}
/*!
Adds a new key to the KeyList
\param name the name of the new key
\param type the type of the new key
*/
int KeyList::addKey(QString name, TVVariant example)
{
int i = count();
while(find(i) && (i > -1))
i--;
replace(i, new Key(name, example, 0));
return i;
}
int KeyList::addKey(QString name, TVVariant::KeyType type)
{
/* generate a valid type for the example? */
TVVariant e = TVVariant("0");
switch(type) {
- case TVVariant::String:
+ case TVVariant::String:
return addKey(name, TVVariant("<undefined>").asString());
break;
- case TVVariant::Date:
+ case TVVariant::Date:
return addKey(name, TVVariant(QDate::currentDate()).asDate());
break;
- case TVVariant::Time:
+ case TVVariant::Time:
return addKey(name, TVVariant(QTime(0,0,0)).toTime());
break;
- case TVVariant::Int:
+ case TVVariant::Int:
return addKey(name, TVVariant(0).toInt());
break;
default:
- qWarning(QObject::tr("KeyList::addKey() Cannot make default "
- "value for type %1, Key not added.").arg(type));
+ owarn << "KeyList::addKey() Cannot make default value for type " << type << ", Key not added." << oendl;
break;
}
return -1;
}
-void KeyList::setKeyFlags(int i, int flag)
+void KeyList::setKeyFlags(int i, int flag)
{
if(find(i))
find(i)->setFlags(flag);
}
int KeyList::getKeyFlags(int i) const
{
if(find(i))
return find(i)->flags();
return 0;
}
-bool KeyList::checkNewFlag(int i) const
+bool KeyList::checkNewFlag(int i) const
{
if (find(i))
return find(i)->newFlag();
return false;
}
-void KeyList::setNewFlag(int i, bool f)
+void KeyList::setNewFlag(int i, bool f)
{
if(!find(i))
return;
find(i)->setNewFlag(f);
}
-bool KeyList::checkDeleteFlag(int i) const
+bool KeyList::checkDeleteFlag(int i) const
{
if (find(i))
return find(i)->delFlag();
return false;
}
-void KeyList::setDeleteFlag(int i, bool f)
+void KeyList::setDeleteFlag(int i, bool f)
{
if(!find(i))
return;
find(i)->setDelFlag(f);
}
/*!
Returns the name of the key at index i
*/
QString KeyList::getKeyName(int i) const
{
if (find (i))
return find(i)->name();
return QString();
}
-void KeyList::setKeyName(int i, const QString &n)
+void KeyList::setKeyName(int i, const QString &n)
{
if(find(i))
find(i)->setName(n);
}
/*!
Returns the type of the key at index i
*/
TVVariant::KeyType KeyList::getKeyType(int i) const
{
if(find(i))
return find(i)->type();
return TVVariant::Invalid;
}
-void KeyList::setKeyType(int i, TVVariant::KeyType t)
+void KeyList::setKeyType(int i, TVVariant::KeyType t)
{
if(!find(i))
return;
switch(t) {
case TVVariant::String:
find(i)->setExample(TVVariant(QString("default")));
return;
case TVVariant::Int:
find(i)->setExample(TVVariant(int(0)));
return;
case TVVariant::Date:
find(i)->setExample(TVVariant(QDate::currentDate()));
@@ -1031,27 +1030,27 @@ QDataStream &operator>>( QDataStream &s, KeyList &k)
return s;
}
/*!
\class DataElem
\brief A class representing a single row or element of a table in a DBStore
This class holds the data of a row in a table.
*/
/*!
- Constructs a DataElem. This function needs a container because the
- size, types of keys and primary key are all defined by the containing
- database
+ Constructs a DataElem. This function needs a container because the
+ size, types of keys and primary key are all defined by the containing
+ database
*/
DataElem::DataElem(DBStore *c) : values(20)
{
int size;
contained = c;
size = c->getNumFields();
values.setAutoDelete(TRUE);
}
/*!
Destroys a DataElem and frees memory used by the DataElem
*/
@@ -1077,118 +1076,118 @@ QDataStream &operator<<( QDataStream &s, const DataElem &d)
return s;
}
QDataStream &operator>>( QDataStream &s, DataElem &d)
{
int i;
int size;
TVVariant t;
Q_UINT16 index = 0;
s >> size; /* redundent data but makes streaming easier */
if (size != d.getNumFields()) {
- owarn << "DataSize mis-match" << oendl;
+ owarn << "DataSize mis-match" << oendl;
return s; /* sanity check failed.. don't load */
}
for(i = 0; i < size; i++) {
s >> index;
s >> t;
d.setField(index, t);
}
return s;
}
/*! Returns the number of possible (not valid) fields in the data element */
int DataElem::getNumFields() const
{
return contained->getNumFields();
}
KeyList DataElem::getKeys() const
{
return *(contained->getKeys());
}
-/*!
+/*!
This function determines whether field index i of the element has been
set yet.
- \return A boolean value that is TRUE if the specfied field of this
- element has been set and FALSE if the field has not yet been set
+ \return A boolean value that is TRUE if the specfied field of this
+ element has been set and FALSE if the field has not yet been set
*/
bool DataElem::hasValidValue(int i) const
{
if(!values.find(i))
return FALSE;
- if(!contained->getKeys()->validIndex(i))
+ if(!contained->getKeys()->validIndex(i))
return FALSE;
return values.find(i)->isValid();
}
-/*!
+/*!
This function determines whether field name qs of the element has been
set yet.
- \return A boolean value that is TRUE if the specfied field of this
- element has been set and FALSE if the field has not yet been set
+ \return A boolean value that is TRUE if the specfied field of this
+ element has been set and FALSE if the field has not yet been set
*/
-bool DataElem::hasValidValue(QString qs) const
+bool DataElem::hasValidValue(QString qs) const
{
int i = contained->getKeyIndex(qs);
return hasValidValue(i);
}
/*! returns the type of the field specified by index i */
-TVVariant::KeyType DataElem::getFieldType(int i) const
+TVVariant::KeyType DataElem::getFieldType(int i) const
{
return contained->getKeyType(i);
}
/*! returns the type of the field specified by name qs */
TVVariant::KeyType DataElem::getFieldType(QString qs) const
{
int i = contained->getKeyIndex(qs);
return contained->getKeyType(i);
}
-/*!
- returns a pointer to the data stored in field index i for this
- data element, (value may not be valid)
+/*!
+ returns a pointer to the data stored in field index i for this
+ data element, (value may not be valid)
*/
TVVariant DataElem::getField(int i) const
{
if(hasValidValue(i))
return TVVariant(*values.find(i));
return TVVariant();
}
-/*!
- returns a pointer to the data stored in field name qs for this
- data element, (value may not be valid)
+/*!
+ returns a pointer to the data stored in field name qs for this
+ data element, (value may not be valid)
*/
TVVariant DataElem::getField(QString qs) const
{
int i = contained->getKeyIndex(qs);
return getField(i);
}
/*!
Sets the value of the elements field index i to the value represented in
the QString q.
\param i index of the field to set
\param q a string that can be parsed to get the value to be set
*/
-void DataElem::setField(int i, QString q)
+void DataElem::setField(int i, QString q)
{
/* from the type of the field, parse q and store */
TVVariant::KeyType kt = contained->getKeyType(i);
TVVariant t = TVVariant(q);
switch(kt) {
case TVVariant::Int: {
t.asInt();
setField(i, t);
return;
}
@@ -1199,136 +1198,134 @@ void DataElem::setField(int i, QString q)
}
case TVVariant::Date: {
t.asDate();
setField(i, t);
return;
}
case TVVariant::Time: {
t.asTime();
setField(i, t);
return;
}
default:
- qWarning(
- QObject::tr("DataElem::setField(%1, %2) No valid type found").arg(i).arg(q)
- );
+ owarn << "DataElem::setField(" << i << ", " << q << ") No valid type found" << oendl;
}
}
/*!
Sets the value of the elements field index i to the value at the pointer
value.
\param i index of the field to set
- \param value a pointer to the (already allocated) value to set
+ \param value a pointer to the (already allocated) value to set
*/
-void DataElem::setField(int i, TVVariant value)
+void DataElem::setField(int i, TVVariant value)
{
if (value.isValid()) {
values.remove(i);
values.replace(i, new TVVariant(value));
}
}
/*!
Sets the value of the elements field name qs to the value represented in
the QString q.
\param qs name of the field to set
\param q a string that can be parsed to get the value to be set
*/
-void DataElem::setField(QString qs, QString q)
+void DataElem::setField(QString qs, QString q)
{
/* from the type of the field, parse q and store */
int i = contained->getKeyIndex(qs);
setField(i, qs);
}
/*!
Sets the value of the elements field name qs to the value at the pointer
value.
\param qs name of the field to set
- \param value a pointer to the (already allocated) value to set
+ \param value a pointer to the (already allocated) value to set
*/
void DataElem::setField(QString qs, TVVariant value)
{
int i = contained->getKeyIndex(qs);
setField(i, value);
}
void DataElem::unsetField(int i) {
values.remove(i);
}
void DataElem::unsetField(QString qs)
{
int i = contained->getKeyIndex(qs);
unsetField(i);
}
/*!
- Converts the data element to a Rich Text QString
+ Converts the data element to a Rich Text QString
*/
QString DataElem::toQString() const
{
/* lets make an attempt at this function */
int i;
QString scratch = "";
QIntDictIterator<TVVariant> it(values);
while (it.current()) {
i = it.currentKey();
if(hasValidValue(i)) {
scratch += "<B>" + contained->getKeyName(i) + ":</B> ";
scratch += getField(i).toString();
scratch += "<br>";
}
++it;
}
return scratch;
}
/*! formats individual fields to strings so can be displayed */
-QString DataElem::toQString(int i) const
+QString DataElem::toQString(int i) const
{
if(hasValidValue(i)) {
return getField(i).toString();
}
return "";
}
/*! formats individual fields to strings so can be sorted by QListView */
-QString DataElem::toSortableQString(int i) const
+QString DataElem::toSortableQString(int i) const
{
QString scratch = "";
if(hasValidValue(i)) {
switch (contained->getKeyType(i)) {
case TVVariant::String: {
scratch += getField(i).toString();
break;
}
case TVVariant::Int: {
scratch.sprintf("%08d", getField(i).toInt());
break;
}
case TVVariant::Date: {
static QDate epochD(1800, 1, 1);
- scratch.sprintf("%08d",
+ scratch.sprintf("%08d",
epochD.daysTo(getField(i).toDate()));
break;
}
case TVVariant::Time: {
static QTime epochT(0, 0, 0);
- scratch.sprintf("%08d",
+ scratch.sprintf("%08d",
epochT.msecsTo(getField(i).toTime()));
break;
}
default:
scratch += "Unknown type";
break;
}
}
return scratch;
}
/* compare functions */
@@ -1371,108 +1368,108 @@ bool DataElem::contains(int i, TVVariant v) const
return FALSE;
switch(getField(i).type()) {
case TVVariant::String: {
QString qs1 = getField(i).toString().lower();
QString qs2 = v.toString().lower();
if (qs1.contains(qs2) > 0) return TRUE;
break;
}
/* meaningless for ints */
/* meaningless for time */
/* meaningless for dates */
- case TVVariant::Int:
+ case TVVariant::Int:
case TVVariant::Time:
case TVVariant::Date:
break;
default:
- owarn << "Tried to compare unknown data type" << oendl;
+ owarn << "Tried to compare unknown data type" << oendl;
}
return FALSE;
}
bool DataElem::startsWith(int i, TVVariant v) const
{
if (!hasValidValue(i)) return FALSE;
if (getField(i).type() != v.type())
return FALSE;
switch(getField(i).type()) {
case TVVariant::String: {
QString qs1 = getField(i).toString().lower();
QString qs2 = v.toString().lower();
return qs1.startsWith(qs2);
}
/* meaningless for ints */
/* meaningless for time */
/* meaningless for dates */
- case TVVariant::Int:
+ case TVVariant::Int:
case TVVariant::Time:
case TVVariant::Date:
return FALSE;
default:
- owarn << "Tried to compare unknown data type" << oendl;
+ owarn << "Tried to compare unknown data type" << oendl;
}
return FALSE;
}
bool DataElem::endsWith(int i, TVVariant v) const
{
if (!hasValidValue(i)) return FALSE;
if (getField(i).type() != v.type())
return FALSE;
switch(getField(i).type()) {
case TVVariant::String: {
QString qs1 = getField(i).toString().lower();
QString qs2 = v.toString().lower();
return qs1.startsWith(qs2);
}
/* meaningless for ints */
/* meaningless for time */
/* meaningless for dates */
- case TVVariant::Int:
+ case TVVariant::Int:
case TVVariant::Time:
case TVVariant::Date:
return FALSE;
default:
- owarn << "Tried to compare unknown data type" << oendl;
+ owarn << "Tried to compare unknown data type" << oendl;
}
return FALSE;
}
/*!
Determins which of the first to parameters are closer to the third, target
parameter.
- \return
+ \return
<UL>
- <LI>TRUE if the first element is a closer match to the target than the
+ <LI>TRUE if the first element is a closer match to the target than the
second element</LI>
<LI>FALSE if the first element is not a closer match to the target than
the second element</LI>
</UL>
*/
bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
{
- int type;
+ int type;
if(!d1) return FALSE;
if (!d1->hasValidValue(column)) return FALSE;
if(!target.isValid()) return FALSE;
type = d1->getField(column).type();
if(d2) {
if (type != d2->getField(column).type()) {
/* can't do compare */
- owarn << "Tried to compare two incompatable types" << oendl;
+ owarn << "Tried to compare two incompatable types" << oendl;
return FALSE;
}
return target.closer(d1->getField(column), d2->getField(column));
- }
+ }
return target.close(d1->getField(column));
}
diff --git a/noncore/apps/tableviewer/db/datacache.cpp b/noncore/apps/tableviewer/db/datacache.cpp
index 6380e1b..de57961 100644
--- a/noncore/apps/tableviewer/db/datacache.cpp
+++ b/noncore/apps/tableviewer/db/datacache.cpp
@@ -7,25 +7,25 @@
** 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.
**
-**********************************************************************/
+**********************************************************************/
/*
* This file is used to load the xml files that represent the database.
* The main requirment for said file is each data entry must contain a key,
* otherwise any other data headings are allowed.
*/
#include "datacache.h"
#include "xmlsource.h"
#include "csvsource.h"
/* OPIE */
#include <opie2/odebug.h>
@@ -54,28 +54,28 @@ DBStore::DBStore()
{
name = "";
number_elems = 0;
full = false;
kRep = new KeyList();
master_table.resize(INIT_TABLE_SIZE);
table_size = INIT_TABLE_SIZE;
current_elem = 0;
archive = 0;
}
-//TODO
+//TODO
/*!
- Reinitializes the table to empty (include a resize of the master table,
- which should free some memory)
+ Reinitializes the table to empty (include a resize of the master table,
+ which should free some memory)
*/
void DBStore::freeTable()
{
name = "";
if(archive) {
delete archive;
archive = 0;
}
kRep->clear(); /* clear the current key list */
number_elems = 0;
table_size = INIT_TABLE_SIZE;
@@ -84,90 +84,90 @@ void DBStore::freeTable()
current_elem = 0;
}
/*!
Removes all items from the DBStore and destroys the DBStore
*/
DBStore::~DBStore()
{
freeTable();
}
/*!
- This function opens the given xml file, loads it and sets up the
+ This function opens the given xml file, loads it and sets up the
appropriate data structures.
\param file_name A string representing the name of the file to be opened
\return true if successful, false otherwise.
*/
bool DBStore::openSource(QIODevice *inDev, const QString &source) {
- /* first check if db is already open, if contains data.. then clear */
+ /* first check if db is already open, if contains data.. then clear */
if(number_elems > 0) {
freeTable();
}
if (source == "text/x-xml-tableviewer") {
archive = new DBXml(this);
} else if (source == "text/csv") {
- archive = new DBCsv(this);
+ archive = new DBCsv(this);
} else
- return false;
+ return false;
return (archive->openSource(inDev));
}
-bool DBStore::saveSource(QIODevice *outDev, const QString &source)
+bool DBStore::saveSource(QIODevice *outDev, const QString &source)
{
/* saving a new file */
if(!archive) {
if (source == "text/x-xml-tableviewer") {
archive = new DBXml(this);
- } else if (source == "text/x-xml-tableviewer") {
+ } else if (source == "text/x-xml-tableviewer") {
archive = new DBCsv(this);
} else
- return false;
+ return false;
}
/* changing file type */
if(archive->type() != source) {
delete archive;
if (source == "text/x-xml-tableviewer") {
archive = new DBXml(this);
- } else if (source == "text/x-xml-tableviewer") {
+ } else if (source == "text/x-xml-tableviewer") {
archive = new DBCsv(this);
- } else
- return false;
+ } else
+ return false;
}
return (archive->saveSource(outDev));
}
-/*!
+/*!
This function is used to add new elements to the database. If the database
has already reached the maximum allowable size this function does not alter
the database.
\param delm An already allocated and initialized data element to be added
*/
void DBStore::addItem(DataElem *delem)
{
addItemInternal(delem);
}
void DBStore::addItemInternal(DataElem *delem)
{
- /* if already full, don't over fill, do a qWarning though */
+ /* if already full, don't over fill, do a owarn though */
if (full) {
- owarn << "Attempted to add items to already full table" << oendl;
+ owarn << "Attempted to add items to already full table" << oendl;
return;
}
master_table.insert(number_elems, delem);
current_elem = number_elems;
number_elems++;
if(number_elems >= table_size) {
/* filled current table, double if we can */
table_size = table_size << 1;
@@ -176,126 +176,126 @@ void DBStore::addItemInternal(DataElem *delem)
if (!table_size) {
full = true;
/* no point in doing antying else. */
return;
}
master_table.resize(table_size);
}
}
void DBStore::removeItem(DataElem *r)
{
int position = master_table.findRef(r);
- if(position != -1) {
- /* there is at least one item, this is it */
- /* replace this with the last element, decrease the element count */
- master_table.insert(position, master_table.at(--number_elems));
- master_table.remove(number_elems);
- delete r;
- }
+ if(position != -1) {
+ /* there is at least one item, this is it */
+ /* replace this with the last element, decrease the element count */
+ master_table.insert(position, master_table.at(--number_elems));
+ master_table.remove(number_elems);
+ delete r;
+ }
}
/*!
Sets the name of the database
\param n A string representing the new name of the database.
*/
void DBStore::setName(const QString &n)
{
- name = n;
+ name = n;
}
/*!
Gets the name of the database
\return A string representing the name of the database.
*/
QString DBStore::getName()
{
- return name;
+ return name;
}
/*!
- Retrieves a pointer to the key representation of the database for
+ Retrieves a pointer to the key representation of the database for
other classes to use as reference.
\return a pointer to the databases key representaion
*/
KeyList *DBStore::getKeys()
{
return kRep;
}
/*!
sets the database's key representation the passed pointer
\param a pointer to a key representaton
*/
void DBStore::setKeys(KeyList *k)
{
kRep = k;
}
/*!
- Sets the current element to the first element of the database
+ Sets the current element to the first element of the database
*/
void DBStore::first()
{
current_elem = 0;
}
/*!
- Sets the current element to the last element of the database
+ Sets the current element to the last element of the database
*/
void DBStore::last()
{
current_elem = number_elems - 1;
}
/*!
Sets the current element to the next element of the database if
there exists an element after the current one.
*/
bool DBStore::next()
{
unsigned int new_current_elem = current_elem + 1;
- if (current_elem < number_elems)
+ if (current_elem < number_elems)
/* was valid before inc (it is possible but unlikely that inc current
elem will change it from invalid to valid) */
if (new_current_elem < number_elems) {
/* is valid after inc */
current_elem = new_current_elem;
return true;
}
return false;
}
/*!
Sets the current element to the previous element of the database if
there exists an element before the current one.
*/
bool DBStore::previous()
{
unsigned int new_current_elem = current_elem -1;
if (current_elem < number_elems)
/* was valid */
if (new_current_elem < number_elems) {
- /* still is (if was 0, then now -1, but as is unsigned will wrap
+ /* still is (if was 0, then now -1, but as is unsigned will wrap
and hence be invalid */
current_elem = new_current_elem;
return true;
}
return false;
}
/*!
Returns the current data element in the database. Which element is current
- is affected by newly added items, findItem, next, previous, first and
+ is affected by newly added items, findItem, next, previous, first and
last functions
\return a pointer to the current data element
*/
-DataElem *DBStore::getCurrentData()
+DataElem *DBStore::getCurrentData()
{
- if (current_elem >= number_elems)
+ if (current_elem >= number_elems)
return NULL;
return master_table[current_elem];
}
diff --git a/noncore/apps/tableviewer/db/datacache.h b/noncore/apps/tableviewer/db/datacache.h
index c5dc637..e38050c 100644
--- a/noncore/apps/tableviewer/db/datacache.h
+++ b/noncore/apps/tableviewer/db/datacache.h
@@ -18,68 +18,74 @@
**
**********************************************************************/
/*
* This file is used to load the xml files that represent the database.
* The main requirment for said file is each data entry must contain a key,
* otherwise any other data headings are allowed.
*/
#ifndef __DATACACHE_H__
#define __DATACACHE_H__
+#include "common.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qstring.h>
#include <qvector.h>
-#include "common.h"
class DBStore;
/*! Abstract class that defines how database stuff can be accessed */
class DBAccess {
public:
// DBAccess(DBStore *d) { dstore = d; }
virtual ~DBAccess() {}
virtual QString type() {
return QString();
}
virtual bool openSource(QIODevice *) {
- qWarning("DBAccess::openSource not yet implemented");
+ owarn << "DBAccess::openSource not yet implemented" << oendl;
return false;
}
virtual bool saveSource(QIODevice *) {
- qWarning("DBAccess::saveSource(QString) not yet implemented");
+ owarn << "DBAccess::saveSource(QString) not yet implemented" << oendl;
return false;
}
protected:
DBStore *dstore;
QString source_name;
};
class DBStore {
public:
DBStore();
~DBStore();
bool openSource(QIODevice *, const QString &source);
bool saveSource(QIODevice *, const QString &source);
// Add an item
void addItem(DataElem *);
void addItemInternal(DataElem *);
- void removeItem(DataElem *);
+ void removeItem(DataElem *);
// Set the name of the database
void setName(const QString &name);
// Get the name of the database
QString getName();
KeyList *getKeys();
void setKeys(KeyList *);
/*! gets the number of fields defined in the database */
inline int getNumFields() {
@@ -97,34 +103,34 @@ public:
}
/*! gets the name of a key given its index */
inline QString getKeyName(int i) {
return kRep->getKeyName(i);
}
// Access functions.. iterator type stuff
void first();
void last();
- bool next();
- bool previous();
+ bool next();
+ bool previous();
- DataElem* getCurrentData();
+ DataElem* getCurrentData();
private:
/* does the work of freeing used memory */
void freeTable();
- QString name;
+ QString name;
QVector<DataElem> master_table;
DBAccess *archive;
KeyList *kRep;
unsigned int number_elems;
unsigned int table_size; /* should always be a power of 2 */
- bool full; /* since because we are using an int for indexing there is
+ bool full; /* since because we are using an int for indexing there is
an upper limit on the number of items we can store. */
unsigned int current_elem;
};
#endif
diff --git a/noncore/apps/tableviewer/ui/browsekeyentry.cpp b/noncore/apps/tableviewer/ui/browsekeyentry.cpp
index 42e24dd..6b78437 100644
--- a/noncore/apps/tableviewer/ui/browsekeyentry.cpp
+++ b/noncore/apps/tableviewer/ui/browsekeyentry.cpp
@@ -7,51 +7,51 @@
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
-**********************************************************************/
+**********************************************************************/
#include "browsekeyentry.h"
#include "commonwidgets.h"
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
#include <qtoolbutton.h>
#include <qwidgetstack.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include <qhbox.h>
#include <qdatetime.h>
-#include <qheader.h>
-// For qWarning(const char *)
-
/*!
\class TVBrowseKeyEntry
\brief a Widget used enter keys into the TVBrowseViewWidget
The TVBrowseKeyEntry Widget provides the facility to enter
various key types to be search on in the table. The key can be changed
and the entry field will update to the correct sort of widget appropriately
*/
/*!
- Constructs the widget
+ Constructs the widget
*/
TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
: QWidget(parent, name, f)
{
QHBoxLayout *h_layout = new QHBoxLayout(this);
textKey = new QLineEdit(this, 0);
intKey = new IntEdit(this, 0);
dateKey = new DateEdit(this, 0);
timeKey = new TimeEdit(this, 0);
resetButton = new QPushButton(this, "reset");
@@ -64,143 +64,142 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
totalKeys = 0;
ts = 0;
keyMenu = new QPopupMenu(this, "keymenu");
ws = new QWidgetStack(this, 0);
ws->addWidget(textKey, TVVariant::String);
ws->addWidget(intKey, TVVariant::Int);
ws->addWidget(timeKey, TVVariant::Time);
ws->addWidget(dateKey, TVVariant::Date);
ws->raiseWidget(TVVariant::String);
-
+
// TODO connect slots and signals....
- connect(changeKeyButton, SIGNAL(clicked()),
+ connect(changeKeyButton, SIGNAL(clicked()),
this, SLOT(changeKeyMenuSlot()));
- connect(resetButton, SIGNAL(clicked()),
+ connect(resetButton, SIGNAL(clicked()),
textKey, SLOT(clear()));
- connect(resetButton, SIGNAL(clicked()),
+ connect(resetButton, SIGNAL(clicked()),
intKey, SLOT(clear()));
- connect(resetButton, SIGNAL(clicked()),
+ connect(resetButton, SIGNAL(clicked()),
dateKey, SLOT(clear()));
- connect(resetButton, SIGNAL(clicked()),
+ connect(resetButton, SIGNAL(clicked()),
timeKey, SLOT(clear()));
h_layout->addWidget(ws);
h_layout->addWidget(resetButton);
h_layout->addWidget(changeKeyButton);
- connect(textKey, SIGNAL(textChanged(const QString&)),
+ connect(textKey, SIGNAL(textChanged(const QString&)),
this, SLOT(searchOnText()));
- connect(intKey, SIGNAL(valueChanged(int)),
+ connect(intKey, SIGNAL(valueChanged(int)),
this, SLOT(searchOnText()));
- connect(dateKey, SIGNAL(valueChanged(const QDate&)),
+ connect(dateKey, SIGNAL(valueChanged(const QDate&)),
this, SLOT(searchOnText()));
- connect(timeKey, SIGNAL(valueChanged(const QTime&)),
+ connect(timeKey, SIGNAL(valueChanged(const QTime&)),
this, SLOT(searchOnText()));
}
/*!
- Destructs the widget
+ Destructs the widget
*/
TVBrowseKeyEntry::~TVBrowseKeyEntry()
{
}
/*!
Changes which key the user intends to search on
\param id_param the index of the key future searches should be base on
*/
void TVBrowseKeyEntry::changeKeySlot(int id_param)
{
if(ts) {
emit sortChanged(id_param);
ws->raiseWidget(ts->kRep->getKeyType(ts->current_column));
}
}
/*!
Opens the change key menu
*/
void TVBrowseKeyEntry::changeKeyMenuSlot()
{
- if(ts)
+ if(ts)
keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0)));
}
void TVBrowseKeyEntry::setTableState(TableState *t) {
ts = t;
}
void TVBrowseKeyEntry::rebuildKeys() {
int i;
if (!ts) return;
if (!ts->kRep) return;
/* clear the old */
keyMenu->clear();
KeyListIterator it(*ts->kRep);
for (i = 0; i < ts->kRep->getNumFields(); i++) {
- keyMenu->insertItem(it.current()->name(), this,
+ keyMenu->insertItem(it.current()->name(), this,
SLOT(changeKeySlot(int)), 0, i);
keyMenu->setItemParameter(i, it.currentKey());
++it;
}
}
void TVBrowseKeyEntry::reset()
{
textKey->clear();
intKey->clear();
dateKey->clear();
timeKey->clear();
keyMenu->clear();
}
/*!
- Searches on the current value of the key entry provided that the
- current key is of type text WARNING, TODO fix memory leaks
+ Searches on the current value of the key entry provided that the
+ current key is of type text WARNING, TODO fix memory leaks
*/
void TVBrowseKeyEntry::searchOnText()
{
TVVariant sendkey;
if (!ts)
return;
switch(ts->kRep->getKeyType(ts->current_column)) {
case TVVariant::String:
sendkey = TVVariant(QString(textKey->text()));
break;
case TVVariant::Int: {
sendkey = TVVariant(intKey->value());
break;
}
case TVVariant::Time: {
sendkey = TVVariant(QTime(timeKey->time()));
break;
}
case TVVariant::Date: {
sendkey = TVVariant(QDate(dateKey->date()));
break;
}
- case TVVariant::Invalid:
- break;
+ case TVVariant::Invalid:
+ break;
default:
- qWarning("TVBrowseKeyEntry::searchOnText() "
- "cannot work out data type");
+ owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl;
return;
}
emit searchOnKey(ts->current_column, sendkey);
}
/*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, TVVariant)
This signal indicates that a search on key index currentKeyId should be
done searching for the value v.
-*/
+*/
diff --git a/noncore/apps/tableviewer/ui/filterkeyentry.cpp b/noncore/apps/tableviewer/ui/filterkeyentry.cpp
index d108fbd..4d74d6b 100644
--- a/noncore/apps/tableviewer/ui/filterkeyentry.cpp
+++ b/noncore/apps/tableviewer/ui/filterkeyentry.cpp
@@ -7,28 +7,33 @@
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
-**********************************************************************/
+**********************************************************************/
#include "filterkeyentry.h"
#include "commonwidgets.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qwidgetstack.h>
#include <qcombobox.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qsizepolicy.h>
#include <qdatetime.h>
#include <qhbox.h>
TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f)
: QWidget(parent, name, f)
{
int stack_elem = 0;
@@ -89,52 +94,52 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f)
dateCombo->insertItem("equal to");
ts = 0;
ws = new QWidgetStack(this, 0);
ws->setMargin(0);
ws->addWidget(textEntry, TVVariant::String);
ws->addWidget(intEntry, TVVariant::Int);
ws->addWidget(timeEntry, TVVariant::Time);
ws->addWidget(dateEntry, TVVariant::Date);
/* connect the signals down */
- connect(textKey, SIGNAL(textChanged(const QString&)),
+ connect(textKey, SIGNAL(textChanged(const QString&)),
this, SIGNAL(valueChanged()));
- connect(intKey, SIGNAL(valueChanged(int)),
+ connect(intKey, SIGNAL(valueChanged(int)),
this, SIGNAL(valueChanged()));
- connect(dateKey, SIGNAL(valueChanged(const QDate&)),
+ connect(dateKey, SIGNAL(valueChanged(const QDate&)),
this, SIGNAL(valueChanged()));
- connect(timeKey, SIGNAL(valueChanged(const QTime&)),
+ connect(timeKey, SIGNAL(valueChanged(const QTime&)),
this, SIGNAL(valueChanged()));
connect(intCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
connect(textCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
connect(timeCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
connect(dateCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
ws->raiseWidget(TVVariant::String);
layout->addWidget(ws);
current_type = TVVariant::String;
}
/*!
- Destructs the widget
+ Destructs the widget
*/
TVFilterKeyEntry::~TVFilterKeyEntry()
{
}
-void TVFilterKeyEntry::setKey(int i)
+void TVFilterKeyEntry::setKey(int i)
{
if (!ts) return;
if (!ts->kRep) return;
/* set up to raise appropriate widget set */
if (current_type != ts->kRep->getKeyType(i)) {
current_type = ts->kRep->getKeyType(i);
ws->raiseWidget(current_type);
}
}
@@ -174,35 +179,34 @@ CmpType TVFilterKeyEntry::getCompareType()
break;
}
return ct_equal;
}
/* MUST return a valid pointer */
TVVariant TVFilterKeyEntry::getCompareValue()
{
TVVariant sendkey;
int tmp;
switch(current_type) {
- case TVVariant::String:
- sendkey = TVVariant(QString(textKey->text()));
- break;
- case TVVariant::Int: {
+ case TVVariant::String:
+ sendkey = TVVariant(QString(textKey->text()));
+ break;
+ case TVVariant::Int: {
sendkey = TVVariant(intKey->value());
- break;
- }
+ break;
+ }
case TVVariant::Time: {
- sendkey = TVVariant(QTime(timeKey->time()));
- break;
+ sendkey = TVVariant(QTime(timeKey->time()));
+ break;
}
case TVVariant::Date: {
- sendkey = TVVariant(QDate(dateKey->date()));
- break;
+ sendkey = TVVariant(QDate(dateKey->date()));
+ break;
}
default: {
sendkey = TVVariant(0);
- qWarning("TVFilterKeyEntry::getCompareValue() "
- "cannot work out data type");
+ owarn << "TVFilterKeyEntry::getCompareValue() cannot work out data type" << oendl;
}
}
return sendkey;
}
diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp
index 22f1fb7..198c8b5 100644
--- a/noncore/apps/tableviewer/ui/tvfilterview.cpp
+++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp
@@ -9,39 +9,45 @@
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "tvfilterview.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/qpeapplication.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qtoolbutton.h>
#include <qcombobox.h>
#include <qlistview.h>
#include <qlayout.h>
#include <qheader.h>
#include <qpushbutton.h>
#include <qlabel.h>
-#include <qpe/qpeapplication.h>
TVFilterView::TVFilterView(TableState *t, QWidget* parent,
const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl)
{
- if ( !name )
- setName( "Filter View" );
+ if ( !name )
+ setName( "Filter View" );
QVBoxLayout *vlayout = new QVBoxLayout(this);
display = new QListView(this, "display");
display->addColumn("Key");
display->addColumn("Constraint");
display->addColumn("Value");
display->header()->setClickEnabled(FALSE);
display->header()->setResizeEnabled(FALSE);
vlayout->addWidget(display);
@@ -79,83 +85,83 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent,
keyEntry->setEnabled(FALSE);
vlayout->addLayout(hlayout2);
vlayout->addWidget(keyEntry);
connect(newFilterButton, SIGNAL( clicked() ), this, SLOT( newTerm() ));
connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm()));
connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms()));
connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() ));
connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() ));
- connect(display, SIGNAL(selectionChanged(QListViewItem*)), this,
- SLOT(setTerm(QListViewItem*)));
+ connect(display, SIGNAL(selectionChanged(QListViewItem*)), this,
+ SLOT(setTerm(QListViewItem*)));
ts = t;
current = 0;
terms.setAutoDelete(true);
do_filter = false;
#ifdef Q_WS_QWS
QPEApplication::showDialog( this );
#endif
}
/*!
- Destroys the TVFilterView widget
+ Destroys the TVFilterView widget
*/
TVFilterView::~TVFilterView()
{
}
void TVFilterView::rebuildData()
{
}
void TVFilterView::reset()
{
keyNameCombo->clear();
keyIds.clear();
}
-void TVFilterView::rebuildKeys()
+void TVFilterView::rebuildKeys()
{
int i;
if (!ts) return;
if(!ts->kRep) return;
keyEntry->setTableState(ts);
-
+
/* set up the list of keys that can be compared on */
keyNameCombo->clear();
KeyListIterator it(*ts->kRep);
i = 0;
while(it.current()) {
- if(ts->kRep->validIndex(it.currentKey())) {
- keyNameCombo->insertItem(it.current()->name());
- keyIds.insert(i, it.currentKey());
- ++i;
- }
- ++it;
+ if(ts->kRep->validIndex(it.currentKey())) {
+ keyNameCombo->insertItem(it.current()->name());
+ keyIds.insert(i, it.currentKey());
+ ++i;
+ }
+ ++it;
}
}
bool TVFilterView::passesFilter(DataElem *d) {
if (!filterActive()) return true;
FilterTerm *t;
-
+
for (t = terms.first(); t != 0; t = terms.next() ) {
/* check against filter */
switch(t->ct) {
case ct_less:
if (!d->lessThan(t->keyIndex, t->value))
return false;
break;
case ct_more:
if (!d->moreThan(t->keyIndex, t->value))
return false;
break;
case ct_equal:
@@ -166,81 +172,80 @@ bool TVFilterView::passesFilter(DataElem *d) {
if (!d->contains(t->keyIndex, t->value))
return false;
break;
case ct_startswith:
if (!d->startsWith(t->keyIndex, t->value))
return false;
break;
case ct_endswith:
if (!d->endsWith(t->keyIndex, t->value))
return false;
break;
default:
- qWarning("TVFilterView::passesFilter() "
- "unrecognized filter type");
+ owarn << "TVFilterView::passesFilter() unrecognized filter type" << oendl;
return false;
}
}
return true;
}
bool TVFilterView::filterActive() const
{
/* when button operated, also check the do_filter value
return do_filter;
*/
if (terms.isEmpty())
return false;
return true;
}
/* SLOTS */
-void TVFilterView::newTerm()
+void TVFilterView::newTerm()
{
if (!ts) return;
FilterTerm *term = new FilterTerm;
current = term;
term->view = 0;
updateTerm();
display->setSelected(term->view, true);
terms.append(term);
keyEntry->setEnabled(true);
keyNameCombo->setEnabled(true);
}
-void TVFilterView::updateTerm()
+void TVFilterView::updateTerm()
{
FilterTerm *term;
/* Read the widget values (keyname, compare type, value)
* and build the lists */
if (!ts) return;
if (!current) return;
QString keyString;
QString cmpString;
QString vString;
term = current;
/* create new list item, set initial values, enable widgets */
term->keyIndex = keyIds[keyNameCombo->currentItem()];
keyEntry->setKey(term->keyIndex); /* so the next two items make sense */
term->ct = keyEntry->getCompareType(),
term->value = keyEntry->getCompareValue();
-
+
keyString = keyNameCombo->currentText();
switch(term->ct) {
case ct_less:
cmpString = " less than ";
break;
case ct_more:
cmpString = " more than ";
break;
case ct_equal:
cmpString = " equal to ";
break;
@@ -251,56 +256,56 @@ void TVFilterView::updateTerm()
cmpString = " starting with ";
break;
case ct_endswith:
cmpString = " ending with ";
break;
default:
cmpString = " ERROR ";
}
vString = term->value.toString();
/* remove old view */
- if (term->view)
+ if (term->view)
delete(term->view);
term->view = new QListViewItem(display, 0, keyString, cmpString, vString);
display->setSelected(term->view, true);
}
/* deletes current term */
-void TVFilterView::deleteTerm()
+void TVFilterView::deleteTerm()
{
if(!current) return;
if (current->view)
delete(current->view);
terms.removeRef(current);
current = terms.first();
if(terms.isEmpty()) {
keyEntry->setEnabled(false);
keyNameCombo->setEnabled(false);
}
}
/* clears all terminations */
-void TVFilterView::clearTerms()
+void TVFilterView::clearTerms()
{
while(current)
deleteTerm();
}
void TVFilterView::setTerm(QListViewItem *target)
{
- /* Iterate through the list to find item with view=target..
+ /* Iterate through the list to find item with view=target..
* set as current, delete */
FilterTerm *term = current;
for (current = terms.first(); current != 0; current = terms.next() )
if (current->view == target)
break;
if (!current) {
- current = term;
+ current = term;
}
}
diff --git a/noncore/apps/tinykate/libkate/kateconfig.cpp b/noncore/apps/tinykate/libkate/kateconfig.cpp
index 782b629..4b8ce78 100644
--- a/noncore/apps/tinykate/libkate/kateconfig.cpp
+++ b/noncore/apps/tinykate/libkate/kateconfig.cpp
@@ -15,24 +15,25 @@
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#define QTOPIA_INTERNAL_LANGLIST
#include "kateconfig.h"
/* OPIE */
#include <opie2/odebug.h>
#include <qpe/global.h>
+using namespace Opie::Core;
/* QT */
#include <qdir.h>
#include <qmessagebox.h>
#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
#include <qtextcodec.h>
#endif
#include <qtextstream.h>
/* STD */
#include <sys/stat.h>
#include <sys/types.h>
@@ -547,26 +548,25 @@ void KateConfig::write( const QString &fn )
total_length = f.writeBlock( cstr.data(), cstr.length() );
if ( total_length != int(cstr.length()) ) {
QMessageBox::critical( 0, QObject::tr("Out of Space"),
QObject::tr("There was a problem creating\nKateConfiguration Information \nfor this program.\n\nPlease free up some space and\ntry again.") );
f.close();
QFile::remove( strNewFile );
return;
}
f.close();
// now rename the file...
if ( rename( strNewFile, filename ) < 0 ) {
- qWarning( "problem renaming the file %s to %s", strNewFile.latin1(),
- filename.latin1() );
+ owarn << "problem renaming the file " << strNewFile.latin1() << " to " << filename.latin1() << oendl;
QFile::remove( strNewFile );
}
}
/*!
Returns whether the KateConfig is in a valid state.
*/
bool KateConfig::isValid() const
{
return groups.end() != git;
}
diff --git a/noncore/apps/zsafe/main.cpp b/noncore/apps/zsafe/main.cpp
index 4fe319b..5f48f77 100644
--- a/noncore/apps/zsafe/main.cpp
+++ b/noncore/apps/zsafe/main.cpp
@@ -1,27 +1,35 @@
/*
** Author: Carsten Schneider <CarstenSchneider@t-online.de>
**
** $Id$
**
** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
*/
#include "zsafe.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#ifdef DESKTOP
#include <qapplication.h>
#else
#include <qpe/qpeapplication.h>
#endif
+
+/* STD */
#include <stdio.h>
#include <signal.h>
ZSafe *zs;
#ifdef DESKTOP
QApplication *appl;
#else
QPEApplication *appl;
#endif
int DeskW;
int DeskH;
@@ -49,53 +57,50 @@ int main( int argc, char ** argv )
#else
QPEApplication a( argc, argv );
#endif
appl = &a;
#ifdef DESKTOP
if (argc >= 3)
{
#ifndef WIN32
DeskW = atoi(argv[1]);
DeskH = atoi(argv[2]);
#else
- int w, h;
- sscanf (argv[1], "%d", &w);
- sscanf (argv[2], "%d", &h);
- DeskW = w;
+ int w, h;
+ sscanf (argv[1], "%d", &w);
+ sscanf (argv[2], "%d", &h);
+ DeskW = w;
DeskH = h;
#endif
}
else
{
DeskW = 600;
DeskH = 400;
}
#else
DeskW = a.desktop()->width();
DeskH = a.desktop()->height();
- char buf[128];
- sprintf (buf, "Width: %d Height: %d\n", DeskW, DeskH);
- qWarning (buf);
+ owarn << "Width: " << DeskW << " Height: " << DeskH << oendl;
#ifdef JPATCH_HDE
// nothings
#else
- if (DeskW > 240)
+ if (DeskW > 240)
{
DeskW -= 20;
DeskH += 25;
- sprintf (buf, "Changed width: %d Height: %d\n", DeskW, DeskH);
- qWarning (buf);
+ owarn << "Changed width: " << DeskW << " Height: " << DeskH << oendl;
}
#endif
#endif
ZSafe mw;
zs = &mw;
#ifndef WIN32
signal (SIGCONT, resume);
#endif
#ifdef DESKTOP
diff --git a/noncore/apps/zsafe/zlistview.cpp b/noncore/apps/zsafe/zlistview.cpp
index ba02a15..7d0b8c2 100644
--- a/noncore/apps/zsafe/zlistview.cpp
+++ b/noncore/apps/zsafe/zlistview.cpp
@@ -1,35 +1,38 @@
/*
** $Id$
*/
#include "zlistview.h"
-#include <stdio.h>
#include "zsafe.h"
+/* OPIE */
+//#include <opie2/odebug.h>
+
+/* STD */
+#include <stdio.h>
+
ZListView::ZListView (ZSafe *zsafe, const char *id) : QListView(zsafe, id)
{
zs = zsafe;
}
ZListView::~ZListView()
{
}
void ZListView::keyPressEvent ( QKeyEvent *e )
{
/*
- char buf[64];
- sprintf (buf, "key: %d\n", e->key());
- qWarning (buf);
+ owarn << "key: " << e->key() << oendl;
*/
switch (e->key())
{
case 32: // middle cursor key pressed
zs->showInfo (zs->selectedItem);
break;
default:
QListView::keyPressEvent( e );
}
}
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
index 6ff05ac..ca3ff52 100644
--- a/noncore/apps/zsafe/zsafe.cpp
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -872,25 +872,25 @@ void ZSafe::findPwd()
#ifdef DESKTOP
result = Accepted;
#endif
QString name;
QString username;
QString comment;
if (result == Accepted)
{
name = dialog->NameField->text();
username = dialog->UsernameField->text();
comment = dialog->CommentField->text();
- qWarning (name);
+ owarn << name << oendl;
}
else
{
delete dialog;
return;
}
if (!name.isEmpty() && name != lastSearchedName ||
lastSearchedName.isEmpty() && !name.isEmpty())
{
// set search at the beginning if a new name is given
lastSearchedCategory = NULL;
@@ -918,56 +918,56 @@ void ZSafe::findPwd()
bool found=FALSE;
// step through all categories
QListViewItem *i;
if (lastSearchedCategory)
i = lastSearchedCategory;
else
i = ListView->firstChild();
for (;
i != NULL;
i = i->nextSibling())
{
- qWarning (i->text(0));
+ owarn << i->text(0) << oendl;
i->setSelected(FALSE);
// step through all subitems
QListViewItem *si;
if (lastSearchedItem)
si = lastSearchedItem;
else
si = i->firstChild();
// for (si = i->firstChild();
for (;
si != NULL;
si = si->nextSibling())
{
- qWarning (si->text(0));
+ owarn << si->text(0) << oendl;
if (si->isSelected())
si->setSelected(FALSE);
// ListView->repaintItem(si);
bool n=TRUE;
bool u=TRUE;
bool c=TRUE;
if (!name.isEmpty())
n = (si->text(0)).contains (name, FALSE);
if (!username.isEmpty())
u = (si->text(1)).contains (username, FALSE);
if (!comment.isEmpty())
c = (si->text(3)).contains (comment, FALSE);
if ((n && u && c ) && !found)
{
- qWarning ("Found");
+ owarn << "Found" << oendl;
selectedItem = si;
si->setSelected(TRUE);
ListView->setCurrentItem(si);
ListView->ensureItemVisible(si);
ListView->triggerUpdate();
lastSearchedCategory = i;
// set to the next item
lastSearchedItem = si->nextSibling();
if (!lastSearchedItem)
{
// no next item within category -> set next category
@@ -1219,26 +1219,25 @@ void ZSafe::removeAsciiFile()
QDir::homeDirPath() + "/Documents/application/zsafe",
"ZSafe (*.txt)",
this,
"ZSafe File Dialog"
"Choose a text file" );
#endif
if (fn && fn.length() > 0 )
{
QFile f( fn );
if ( !f.remove() )
{
- qWarning( QString("Could not remove file %1").arg(fn),
- 2000 );
+ owarn << "Could not remove file " << fn << oendl;
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not remove text file.") );
return;
}
}
}
void ZSafe::writeAllEntries()
{
if (filename.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
@@ -1269,26 +1268,25 @@ void ZSafe::writeAllEntries()
QDir::homeDirPath() + "/Documents/application/zsafe",
"ZSafe (*.txt)",
this,
"ZSafe File Dialog"
"Choose a text file" );
#endif
// open the new document
if (fn && fn.length() > 0 )
{
QFile f( fn );
if ( !f.open( IO_WriteOnly ) ) {
- qWarning( QString("Could not write to file %1").arg(fn),
- 2000 );
+ owarn << "Could not write to file " << fn << oendl;
QMessageBox::critical( 0, "ZSafe",
QString("Could not export to text file.") );
return;
}
QTextStream t( &f );
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
@@ -1313,28 +1311,28 @@ void ZSafe::writeAllEntries()
oneEntry += "\";";
oneEntry += "\"";
QString comment = si->text(3);
comment.replace (QRegExp("\n"), "<br>");
oneEntry += comment;
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(4);
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(5);
oneEntry += "\"";
- // qWarning (oneEntry);
+ // owarn << oneEntry << oendl;
t << oneEntry << endl;
- // qWarning (si->text(0));
+ // owarn << si->text(0) << oendl;
}
}
f.close();
}
}
void ZSafe::readAllEntries()
{
if (filename.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("No document defined.\nYou have to create a new document"));
@@ -1364,26 +1362,25 @@ void ZSafe::readAllEntries()
QDir::homeDirPath() + "/Documents/application/zsafe",
"ZSafe (*.txt)",
this,
"ZSafe File Dialog"
"Choose a text file" );
#endif
if (fn && fn.length() > 0 )
{
QFile f( fn );
if ( !f.open( IO_ReadOnly ) )
{
- qWarning( QString("Could not read file %1").arg(fn),
- 2000 );
+ owarn << "Could not read file " << fn << oendl;
QMessageBox::critical( 0, "ZSafe",
QString("Could not import text file.") );
return;
}
modified = true;
// clear the password list
selectedItem = NULL;
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
@@ -1394,25 +1391,25 @@ void ZSafe::readAllEntries()
QListViewItem *si;
for (si = i->firstChild();
si != NULL; )
// si = si->nextSibling())
{
QListViewItem *_si = si;
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
- qWarning ("ReadAllEntries(): ");
+ owarn << "ReadAllEntries(): " << oendl;
QTextStream t(&f);
while ( !t.eof() )
{
QString s = t.readLine();
s.replace (QRegExp("\";\""), "\"|\"");
// char buffer[1024];
#ifndef WIN32
char buffer[s.length()+1];
#else
char buffer[4048];
#endif
@@ -1545,26 +1542,25 @@ void ZSafe::readAllEntries()
{
}
}
#ifdef UNUSED
void ZSafe::writeAllEntries()
{
// open the file for writing
QString fn = filename + ".txt";
QFile f( fn );
if ( !f.open( IO_WriteOnly ) ) {
- qWarning( QString("Could not write to file %1").arg(fn),
- 2000 );
+ owarn << "Could not write to file " << fn << oendl;
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not export to text file.") );
return;
}
QTextStream t( &f );
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
@@ -1584,41 +1580,40 @@ void ZSafe::writeAllEntries()
oneEntry += "\"";
oneEntry += si->text(1);
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(2);
oneEntry += "\";";
oneEntry += "\"";
// oneEntry += si->text(3);
QString comment = si->text(3);
comment.replace (QRegExp("\n"), "<br>");
oneEntry += comment;
oneEntry += "\"";
- // qWarning (oneEntry);
+ // owarn << oneEntry << oendl;
t << oneEntry << endl;
- // qWarning (si->text(0));
+ // owarn << si->text(0) << oendl;
}
}
f.close();
}
void ZSafe::readAllEntries()
{
QString fn = filename + ".txt";
QFile f( fn );
if ( !f.open( IO_ReadOnly ) )
{
- qWarning( QString("Could not read file %1").arg(fn),
- 2000 );
+ owarn << "Could not read file " << fn << oendl;
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not import text file.") );
return;
}
modified = true;
// clear the password list
selectedItem = NULL;
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
@@ -1629,25 +1624,25 @@ void ZSafe::readAllEntries()
QListViewItem *si;
for (si = i->firstChild();
si != NULL; )
// si = si->nextSibling())
{
QListViewItem *_si = si;
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
- qWarning ("ReadAllEntries(): ");
+ owarn << "ReadAllEntries(): " << oendl;
QTextStream t(&f);
while ( !t.eof() )
{
QString s = t.readLine();
s.replace (QRegExp("\";\""), "\"|\"");
// char buffer[1024];
int len=s.length()+1;
#ifdef WIN32
char buffer[512];
#else
char buffer[len];
@@ -1753,25 +1748,25 @@ void ZSafe::readAllEntries()
c1->initListItem();
categories.insert (c1->getCategoryName(), c1);
}
}
f.close();
}
#endif // UNUSED
void ZSafe::resume(int)
{
- qWarning ("Resume");
+ owarn << "Resume" << oendl;
// hide the main window
infoForm->hide();
// open zsafe again
m_password = "";
selectedItem = NULL;
// clear the password list
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
@@ -1809,34 +1804,34 @@ bool ZSafe::openDocument(const char* _filename, const char* )
int pwdOk = 0;
int numberOfTries = 3;
for (int i=0; i < numberOfTries; i++)
{
QFile f(_filename);
if (f.exists())
{
// ask with a dialog for the password
if (m_password.isEmpty())
getDocPassword(tr("Enter Password"));
if (m_password.isEmpty() && validationFlag == 0)
{
- qWarning ("Wrong password");
+ owarn << "Wrong password" << oendl;
QMessageBox::critical( 0, tr("ZSafe"),
tr("Wrong password.\n\nZSafe will now exit.") );
exitZs (1);
}
retval = loadInit(_filename, m_password);
if (retval != PWERR_GOOD)
{
- qWarning ("Error loading Document");
+ owarn << "Error loading Document" << oendl;
return false;
}
}
else
{
#ifdef WIN32
this->setCaption("Qt ZSafe");
#else
this->setCaption("ZSafe");
#endif
filename = "";
return false;
@@ -2292,25 +2287,25 @@ bool ZSafe::saveDocument(const char* _filename,
}
PasswordForm *newPwdDialog;
bool newPwdDialogResult = false;
void ZSafe::setPasswordDialogDone()
{
newPwdDialogResult = true;
newPwdDialog->close();
}
void ZSafe::getDocPassword(QString title)
{
-qWarning ("getDocPassword");
+ owarn << "getDocPassword" << oendl;
// open the 'Password' dialog
PasswordForm *dialog = new PasswordForm(this, title, TRUE);
newPwdDialog = dialog;
newPwdDialogResult = false;
connect( dialog->PasswordField, SIGNAL( returnPressed() ),
this, SLOT( setPasswordDialogDone() ) );
// CS: !!!
// int pos = filename.findRev ('/');
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
#ifdef WIN32
@@ -2471,25 +2466,25 @@ int ZSafe::saveFinalize(void)
ciphertext[count1] = iv[count1] ^ plaintext[count1];
if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA;
if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA;
}
fclose (fd);
free(buffer);
return retval;
}
void ZSafe::quitMe ()
{
- qWarning ("QUIT...");
+ owarn << "QUIT..." << oendl;
if (modified)
{
switch( QMessageBox::information( this, tr("ZSafe"),
tr("Do you want to save\nbefore exiting?"),
tr("&Save"),
tr("S&ave with\nnew\npassword"),
tr("&Don't Save"),
0 // Enter == button 0
) )
{ // Escape == button 2
case 0: // Save clicked, Alt-S or Enter pressed.
@@ -2675,25 +2670,25 @@ void ZSafe::addCategory()
#endif
QString category;
QString icon;
QString fullIconPath;
QPixmap *pix;
if (result == Accepted)
{
modified = true;
category = dialog->CategoryField->currentText();
icon = dialog->IconField->currentText()+".png";
- qWarning (category);
+ owarn << category << oendl;
QListViewItem *li = new ShadedListItem( 1, ListView );
Category *c1 = new Category();
c1->setCategoryName(category);
// if (!icon.isEmpty() && !icon.isNull())
if (icon != "predefined.png")
{
// build the full path
fullIconPath = iconPath + icon;
pix = new QPixmap (fullIconPath);
// pix->resize(14, 14);
@@ -3183,25 +3178,25 @@ void ZSafe::editCategory()
{
// #ifndef WIN32
conf->removeEntry (category);
// #endif
saveConf();
cat->setIcon (*getPredefinedIcon(category));
}
// change the category name of the selected category
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
- qWarning (category);
+ owarn << category << oendl;
catItem->setText( 0, tr( category ) );
cat->setCategoryName (tr(category));
cat->initListItem();
categories.insert (category, cat);
}
}
saveCategoryDialogFields(dialog);
}
else
{
// delete dialog;
@@ -3584,25 +3579,25 @@ void ZSafe::paintEvent( QPaintEvent * )
{
if (raiseFlag)
{
raiseFlag = false;
raiseTimer.start (1, true);
if (infoForm->isVisible())
infoForm->raise();
}
}
void ZSafe::resizeEvent ( QResizeEvent * )
{
- // qWarning ("resizeEvent");
+ // owarn << "resizeEvent" << oendl;
#ifndef DESKTOP
DeskW = appl->desktop()->width();
DeskH = appl->desktop()->height();
#else
DeskW = this->width();
DeskH = this->height();
#endif
if (New)
New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) );
if (Edit)
Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) );