summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (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
-rw-r--r--noncore/comm/keypebble/krfbdecoder.cpp108
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp6
-rw-r--r--noncore/graphics/opie-eye/gui/viewmodebutton.cpp5
-rw-r--r--noncore/net/opietooth/lib/device.cc95
-rw-r--r--noncore/net/opietooth/lib/manager.cc65
-rw-r--r--noncore/net/opietooth/lib/parser.cc60
-rw-r--r--noncore/settings/mediummount/mediumglobal.cc11
-rw-r--r--noncore/styles/theme/othemebase.h981
20 files changed, 1037 insertions, 998 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
@@ -47,12 +47,15 @@
47// version to version without notice, or even be removed. 47// version to version without notice, or even be removed.
48// 48//
49// We mean it. 49// We mean it.
50// 50//
51// 51//
52 52
53#include <opie2/odebug.h>
54using namespace Opie::Core;
55
53#ifndef QT_H 56#ifndef QT_H
54#include "qstring.h" 57#include "qstring.h"
55#include "qlist.h" 58#include "qlist.h"
56#include "qrect.h" 59#include "qrect.h"
57#include "qfontmetrics.h" 60#include "qfontmetrics.h"
58#include "qintdict.h" 61#include "qintdict.h"
@@ -121,34 +124,34 @@ public:
121 QTextFormat *format() const; 124 QTextFormat *format() const;
122 QTextCustomItem *customItem() const; 125 QTextCustomItem *customItem() const;
123 void setFormat( QTextFormat *f ); 126 void setFormat( QTextFormat *f );
124 void setCustomItem( QTextCustomItem *i ); 127 void setCustomItem( QTextCustomItem *i );
125 struct CustomData 128 struct CustomData
126 { 129 {
127 QTextFormat *format; 130 QTextFormat *format;
128 QTextCustomItem *custom; 131 QTextCustomItem *custom;
129 QString anchorName; 132 QString anchorName;
130 QString anchorHref; 133 QString anchorHref;
131 }; 134 };
132 135
133 void loseCustomItem(); 136 void loseCustomItem();
134 137
135 union { 138 union {
136 QTextFormat* format; 139 QTextFormat* format;
137 CustomData* custom; 140 CustomData* custom;
138 } d; 141 } d;
139 142
140 bool isAnchor() const { return ( type & Anchor) != 0; } 143 bool isAnchor() const { return ( type & Anchor) != 0; }
141 QString anchorName() const; 144 QString anchorName() const;
142 QString anchorHref() const; 145 QString anchorHref() const;
143 void setAnchor( const QString& name, const QString& href ); 146 void setAnchor( const QString& name, const QString& href );
144 147
145private: 148private:
146 QTextStringChar &operator=( const QTextStringChar & ) { 149 QTextStringChar &operator=( const QTextStringChar & ) {
147 //abort(); 150 //abort();
148 return *this; 151 return *this;
149 } 152 }
150 friend class QComplexText; 153 friend class QComplexText;
151 friend class QTextParagraph; 154 friend class QTextParagraph;
152}; 155};
153 156
154#if defined(Q_TEMPLATEDLL) 157#if defined(Q_TEMPLATEDLL)
@@ -205,20 +208,20 @@ private:
205 uint dir : 5; 208 uint dir : 5;
206}; 209};
207 210
208inline bool QTextString::isBidi() const 211inline bool QTextString::isBidi() const
209{ 212{
210 if ( bidiDirty ) 213 if ( bidiDirty )
211 checkBidi(); 214 checkBidi();
212 return bidi; 215 return bidi;
213} 216}
214 217
215inline bool QTextString::isRightToLeft() const 218inline bool QTextString::isRightToLeft() const
216{ 219{
217 if ( bidiDirty ) 220 if ( bidiDirty )
218 checkBidi(); 221 checkBidi();
219 return rightToLeft; 222 return rightToLeft;
220} 223}
221 224
222inline QChar::Direction QTextString::direction() const 225inline QChar::Direction QTextString::direction() const
223{ 226{
224 return (QChar::Direction) dir; 227 return (QChar::Direction) dir;
@@ -381,13 +384,13 @@ inline QTextCommandHistory::~QTextCommandHistory()
381// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 384// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
382 385
383class Q_EXPORT QTextCustomItem 386class Q_EXPORT QTextCustomItem
384{ 387{
385public: 388public:
386 QTextCustomItem( QTextDocument *p ) 389 QTextCustomItem( QTextDocument *p )
387 : xpos(0), ypos(-1), width(-1), height(0), parent( p ) 390 : xpos(0), ypos(-1), width(-1), height(0), parent( p )
388 {} 391 {}
389 virtual ~QTextCustomItem(); 392 virtual ~QTextCustomItem();
390 virtual void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ) = 0; 393 virtual void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ) = 0;
391 394
392 virtual void adjustToPainter( QPainter* ); 395 virtual void adjustToPainter( QPainter* );
393 396
@@ -435,13 +438,13 @@ Q_TEMPLATE_EXTERN template class Q_EXPORT QMap<QString, QString>;
435#endif 438#endif
436 439
437class Q_EXPORT QTextImage : public QTextCustomItem 440class Q_EXPORT QTextImage : public QTextCustomItem
438{ 441{
439public: 442public:
440 QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context, 443 QTextImage( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context,
441 QMimeSourceFactory &factory ); 444 QMimeSourceFactory &factory );
442 virtual ~QTextImage(); 445 virtual ~QTextImage();
443 446
444 Placement placement() const { return place; } 447 Placement placement() const { return place; }
445 void adjustToPainter( QPainter* ); 448 void adjustToPainter( QPainter* );
446 int minimumWidth() const { return width; } 449 int minimumWidth() const { return width; }
447 450
@@ -460,13 +463,13 @@ private:
460}; 463};
461 464
462class Q_EXPORT QTextHorizontalLine : public QTextCustomItem 465class Q_EXPORT QTextHorizontalLine : public QTextCustomItem
463{ 466{
464public: 467public:
465 QTextHorizontalLine( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context, 468 QTextHorizontalLine( QTextDocument *p, const QMap<QString, QString> &attr, const QString& context,
466 QMimeSourceFactory &factory ); 469 QMimeSourceFactory &factory );
467 virtual ~QTextHorizontalLine(); 470 virtual ~QTextHorizontalLine();
468 471
469 void adjustToPainter( QPainter* ); 472 void adjustToPainter( QPainter* );
470 void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected ); 473 void draw(QPainter* p, int x, int y, int cx, int cy, int cw, int ch, const QColorGroup& cg, bool selected );
471 QString richText() const; 474 QString richText() const;
472 475
@@ -529,17 +532,17 @@ class QTextTable;
529class Q_EXPORT QTextTableCell : public QLayoutItem 532class Q_EXPORT QTextTableCell : public QLayoutItem
530{ 533{
531 friend class QTextTable; 534 friend class QTextTable;
532 535
533public: 536public:
534 QTextTableCell( QTextTable* table, 537 QTextTableCell( QTextTable* table,
535 int row, int column, 538 int row, int column,
536 const QMap<QString, QString> &attr, 539 const QMap<QString, QString> &attr,
537 const QStyleSheetItem* style, 540 const QStyleSheetItem* style,
538 const QTextFormat& fmt, const QString& context, 541 const QTextFormat& fmt, const QString& context,
539 QMimeSourceFactory &factory, QStyleSheet *sheet, const QString& doc ); 542 QMimeSourceFactory &factory, QStyleSheet *sheet, const QString& doc );
540 virtual ~QTextTableCell(); 543 virtual ~QTextTableCell();
541 544
542 QSize sizeHint() const ; 545 QSize sizeHint() const ;
543 QSize minimumSize() const ; 546 QSize minimumSize() const ;
544 QSize maximumSize() const ; 547 QSize maximumSize() const ;
545 QSizePolicy::ExpandData expanding() const; 548 QSizePolicy::ExpandData expanding() const;
@@ -603,13 +606,13 @@ public:
603 QTextTable( QTextDocument *p, const QMap<QString, QString> &attr ); 606 QTextTable( QTextDocument *p, const QMap<QString, QString> &attr );
604 virtual ~QTextTable(); 607 virtual ~QTextTable();
605 608
606 void adjustToPainter( QPainter *p ); 609 void adjustToPainter( QPainter *p );
607 void pageBreak( int y, QTextFlow* flow ); 610 void pageBreak( int y, QTextFlow* flow );
608 void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch, 611 void draw( QPainter* p, int x, int y, int cx, int cy, int cw, int ch,
609 const QColorGroup& cg, bool selected ); 612 const QColorGroup& cg, bool selected );
610 613
611 bool noErase() const { return TRUE; } 614 bool noErase() const { return TRUE; }
612 bool ownLine() const { return TRUE; } 615 bool ownLine() const { return TRUE; }
613 Placement placement() const { return place; } 616 Placement placement() const { return place; }
614 bool isNested() const { return TRUE; } 617 bool isNested() const { return TRUE; }
615 void resize( int nwidth ); 618 void resize( int nwidth );
@@ -681,15 +684,15 @@ class Q_EXPORT QTextDocument : public QObject
681 friend class QTextCursor; 684 friend class QTextCursor;
682 friend class QTextEdit; 685 friend class QTextEdit;
683 friend class QTextParagraph; 686 friend class QTextParagraph;
684 687
685public: 688public:
686 enum SelectionIds { 689 enum SelectionIds {
687 Standard = 0, 690 Standard = 0,
688 Temp = 32000 // This selection must not be drawn, it's used e.g. by undo/redo to 691 Temp = 32000 // This selection must not be drawn, it's used e.g. by undo/redo to
689 // remove multiple lines with removeSelectedText() 692 // remove multiple lines with removeSelectedText()
690 }; 693 };
691 694
692 QTextDocument( QTextDocument *p ); 695 QTextDocument( QTextDocument *p );
693 QTextDocument( QTextDocument *d, QTextFormatCollection *f ); 696 QTextDocument( QTextDocument *d, QTextFormatCollection *f );
694 virtual ~QTextDocument(); 697 virtual ~QTextDocument();
695 698
@@ -788,17 +791,17 @@ public:
788 void setPaper( QBrush *brush ) { if ( backBrush ) delete backBrush; backBrush = brush; } 791 void setPaper( QBrush *brush ) { if ( backBrush ) delete backBrush; backBrush = brush; }
789 QBrush *paper() const { return backBrush; } 792 QBrush *paper() const { return backBrush; }
790 793
791 void doLayout( QPainter *p, int w ); 794 void doLayout( QPainter *p, int w );
792 void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 ); 795 void draw( QPainter *p, const QRect& rect, const QColorGroup &cg, const QBrush *paper = 0 );
793 void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch, 796 void drawParagraph( QPainter *p, QTextParagraph *parag, int cx, int cy, int cw, int ch,
794 QPixmap *&doubleBuffer, const QColorGroup &cg, 797 QPixmap *&doubleBuffer, const QColorGroup &cg,
795 bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE ); 798 bool drawCursor, QTextCursor *cursor, bool resetChanged = TRUE );
796 QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg, 799 QTextParagraph *draw( QPainter *p, int cx, int cy, int cw, int ch, const QColorGroup &cg,
797 bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0, 800 bool onlyChanged = FALSE, bool drawCursor = FALSE, QTextCursor *cursor = 0,
798 bool resetChanged = TRUE ); 801 bool resetChanged = TRUE );
799 802
800 void registerCustomItem( QTextCustomItem *i, QTextParagraph *p ); 803 void registerCustomItem( QTextCustomItem *i, QTextParagraph *p );
801 void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p ); 804 void unregisterCustomItem( QTextCustomItem *i, QTextParagraph *p );
802 805
803 void setFlow( QTextFlow *f ); 806 void setFlow( QTextFlow *f );
804 void takeFlow(); 807 void takeFlow();
@@ -855,28 +858,28 @@ private:
855 void init(); 858 void init();
856 QPixmap *bufferPixmap( const QSize &s ); 859 QPixmap *bufferPixmap( const QSize &s );
857 // HTML parser 860 // HTML parser
858 bool hasPrefix(const QChar* doc, int length, int pos, QChar c); 861 bool hasPrefix(const QChar* doc, int length, int pos, QChar c);
859 bool hasPrefix(const QChar* doc, int length, int pos, const QString& s); 862 bool hasPrefix(const QChar* doc, int length, int pos, const QString& s);
860 QTextCustomItem* parseTable( const QMap<QString, QString> &attr, const QTextFormat &fmt, 863 QTextCustomItem* parseTable( const QMap<QString, QString> &attr, const QTextFormat &fmt,
861 const QChar* doc, int length, int& pos, QTextParagraph *curpar ); 864 const QChar* doc, int length, int& pos, QTextParagraph *curpar );
862 bool eatSpace(const QChar* doc, int length, int& pos, bool includeNbsp = FALSE ); 865 bool eatSpace(const QChar* doc, int length, int& pos, bool includeNbsp = FALSE );
863 bool eat(const QChar* doc, int length, int& pos, QChar c); 866 bool eat(const QChar* doc, int length, int& pos, QChar c);
864 QString parseOpenTag(const QChar* doc, int length, int& pos, QMap<QString, QString> &attr, bool& emptyTag); 867 QString parseOpenTag(const QChar* doc, int length, int& pos, QMap<QString, QString> &attr, bool& emptyTag);
865 QString parseCloseTag( const QChar* doc, int length, int& pos ); 868 QString parseCloseTag( const QChar* doc, int length, int& pos );
866 QChar parseHTMLSpecialChar(const QChar* doc, int length, int& pos); 869 QChar parseHTMLSpecialChar(const QChar* doc, int length, int& pos);
867 QString parseWord(const QChar* doc, int length, int& pos, bool lower = TRUE); 870 QString parseWord(const QChar* doc, int length, int& pos, bool lower = TRUE);
868 QChar parseChar(const QChar* doc, int length, int& pos, QStyleSheetItem::WhiteSpaceMode wsm ); 871 QChar parseChar(const QChar* doc, int length, int& pos, QStyleSheetItem::WhiteSpaceMode wsm );
869 void setRichTextInternal( const QString &text, QTextCursor* cursor = 0 ); 872 void setRichTextInternal( const QString &text, QTextCursor* cursor = 0 );
870 void setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheetItem> >& styles, QTextParagraph* stylesPar ); 873 void setRichTextMarginsInternal( QPtrList< QPtrVector<QStyleSheetItem> >& styles, QTextParagraph* stylesPar );
871 874
872private: 875private:
873 struct Q_EXPORT Focus { 876 struct Q_EXPORT Focus {
874 QTextParagraph *parag; 877 QTextParagraph *parag;
875 int start, len; 878 int start, len;
876 QString href; 879 QString href;
877 }; 880 };
878 881
879 int cx, cy, cw, vw; 882 int cx, cy, cw, vw;
880 QTextParagraph *fParag, *lParag; 883 QTextParagraph *fParag, *lParag;
881 QTextPreProcessor *pProcessor; 884 QTextPreProcessor *pProcessor;
882 QMap<int, QColor> selectionColors; 885 QMap<int, QColor> selectionColors;
@@ -928,13 +931,13 @@ private:
928 931
929 932
930class Q_EXPORT QTextDeleteCommand : public QTextCommand 933class Q_EXPORT QTextDeleteCommand : public QTextCommand
931{ 934{
932public: 935public:
933 QTextDeleteCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str, 936 QTextDeleteCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str,
934 const QByteArray& oldStyle ); 937 const QByteArray& oldStyle );
935 QTextDeleteCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str ); 938 QTextDeleteCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str );
936 virtual ~QTextDeleteCommand(); 939 virtual ~QTextDeleteCommand();
937 940
938 Commands type() const { return Delete; } 941 Commands type() const { return Delete; }
939 QTextCursor *execute( QTextCursor *c ); 942 QTextCursor *execute( QTextCursor *c );
940 QTextCursor *unexecute( QTextCursor *c ); 943 QTextCursor *unexecute( QTextCursor *c );
@@ -948,16 +951,16 @@ protected:
948}; 951};
949 952
950class Q_EXPORT QTextInsertCommand : public QTextDeleteCommand 953class Q_EXPORT QTextInsertCommand : public QTextDeleteCommand
951{ 954{
952public: 955public:
953 QTextInsertCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str, 956 QTextInsertCommand( QTextDocument *d, int i, int idx, const QMemArray<QTextStringChar> &str,
954 const QByteArray& oldStyleInfo ) 957 const QByteArray& oldStyleInfo )
955 : QTextDeleteCommand( d, i, idx, str, oldStyleInfo ) {} 958 : QTextDeleteCommand( d, i, idx, str, oldStyleInfo ) {}
956 QTextInsertCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str ) 959 QTextInsertCommand( QTextParagraph *p, int idx, const QMemArray<QTextStringChar> &str )
957 : QTextDeleteCommand( p, idx, str ) {} 960 : QTextDeleteCommand( p, idx, str ) {}
958 virtual ~QTextInsertCommand() {} 961 virtual ~QTextInsertCommand() {}
959 962
960 Commands type() const { return Insert; } 963 Commands type() const { return Insert; }
961 QTextCursor *execute( QTextCursor *c ) { return QTextDeleteCommand::unexecute( c ); } 964 QTextCursor *execute( QTextCursor *c ) { return QTextDeleteCommand::unexecute( c ); }
962 QTextCursor *unexecute( QTextCursor *c ) { return QTextDeleteCommand::execute( c ); } 965 QTextCursor *unexecute( QTextCursor *c ) { return QTextDeleteCommand::execute( c ); }
963 966
@@ -1008,43 +1011,43 @@ struct Q_EXPORT QTextParagraphSelection
1008}; 1011};
1009 1012
1010struct Q_EXPORT QTextLineStart 1013struct Q_EXPORT QTextLineStart
1011{ 1014{
1012 QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 ) 1015 QTextLineStart() : y( 0 ), baseLine( 0 ), h( 0 )
1013#ifndef QT_NO_COMPLEXTEXT 1016#ifndef QT_NO_COMPLEXTEXT
1014 , bidicontext( 0 ) 1017 , bidicontext( 0 )
1015#endif 1018#endif
1016 { } 1019 { }
1017 QTextLineStart( ushort y_, ushort bl, ushort h_ ) : y( y_ ), baseLine( bl ), h( h_ ), 1020 QTextLineStart( ushort y_, ushort bl, ushort h_ ) : y( y_ ), baseLine( bl ), h( h_ ),
1018 w( 0 ) 1021 w( 0 )
1019#ifndef QT_NO_COMPLEXTEXT 1022#ifndef QT_NO_COMPLEXTEXT
1020 , bidicontext( 0 ) 1023 , bidicontext( 0 )
1021#endif 1024#endif
1022 { } 1025 { }
1023#ifndef QT_NO_COMPLEXTEXT 1026#ifndef QT_NO_COMPLEXTEXT
1024 QTextLineStart( QBidiContext *c, QBidiStatus s ) : y(0), baseLine(0), h(0), 1027 QTextLineStart( QBidiContext *c, QBidiStatus s ) : y(0), baseLine(0), h(0),
1025 status( s ), bidicontext( c ) { if ( bidicontext ) bidicontext->ref(); } 1028 status( s ), bidicontext( c ) { if ( bidicontext ) bidicontext->ref(); }
1026#endif 1029#endif
1027 1030
1028 virtual ~QTextLineStart() 1031 virtual ~QTextLineStart()
1029 { 1032 {
1030#ifndef QT_NO_COMPLEXTEXT 1033#ifndef QT_NO_COMPLEXTEXT
1031 if ( bidicontext && bidicontext->deref() ) 1034 if ( bidicontext && bidicontext->deref() )
1032 delete bidicontext; 1035 delete bidicontext;
1033#endif 1036#endif
1034 } 1037 }
1035 1038
1036#ifndef QT_NO_COMPLEXTEXT 1039#ifndef QT_NO_COMPLEXTEXT
1037 void setContext( QBidiContext *c ) { 1040 void setContext( QBidiContext *c ) {
1038 if ( c == bidicontext ) 1041 if ( c == bidicontext )
1039 return; 1042 return;
1040 if ( bidicontext && bidicontext->deref() ) 1043 if ( bidicontext && bidicontext->deref() )
1041 delete bidicontext; 1044 delete bidicontext;
1042 bidicontext = c; 1045 bidicontext = c;
1043 if ( bidicontext ) 1046 if ( bidicontext )
1044 bidicontext->ref(); 1047 bidicontext->ref();
1045 } 1048 }
1046 QBidiContext *context() const { return bidicontext; } 1049 QBidiContext *context() const { return bidicontext; }
1047#endif 1050#endif
1048 1051
1049public: 1052public:
1050 ushort y, baseLine, h; 1053 ushort y, baseLine, h;
@@ -1180,13 +1183,13 @@ public:
1180 void setFormat( int index, int len, QTextFormat *f, bool useCollection = TRUE, int flags = -1 ); 1183 void setFormat( int index, int len, QTextFormat *f, bool useCollection = TRUE, int flags = -1 );
1181 1184
1182 void setAlignment( int a ); 1185 void setAlignment( int a );
1183 int alignment() const; 1186 int alignment() const;
1184 1187
1185 virtual void paint( QPainter &painter, const QColorGroup &cg, QTextCursor *cursor = 0, bool drawSelections = FALSE, 1188 virtual void paint( QPainter &painter, const QColorGroup &cg, QTextCursor *cursor = 0, bool drawSelections = FALSE,
1186 int clipx = -1, int clipy = -1, int clipw = -1, int cliph = -1 ); 1189 int clipx = -1, int clipy = -1, int clipw = -1, int cliph = -1 );
1187 1190
1188 virtual int topMargin() const; 1191 virtual int topMargin() const;
1189 virtual int bottomMargin() const; 1192 virtual int bottomMargin() const;
1190 virtual int leftMargin() const; 1193 virtual int leftMargin() const;
1191 virtual int firstLineMargin() const; 1194 virtual int firstLineMargin() const;
1192 virtual int rightMargin() const; 1195 virtual int rightMargin() const;
@@ -1243,15 +1246,15 @@ public:
1243 void readStyleInformation( QDataStream& stream ); 1246 void readStyleInformation( QDataStream& stream );
1244 void writeStyleInformation( QDataStream& stream ) const; 1247 void writeStyleInformation( QDataStream& stream ) const;
1245 1248
1246protected: 1249protected:
1247 virtual void drawLabel( QPainter* p, int x, int y, int w, int h, int base, const QColorGroup& cg ); 1250 virtual void drawLabel( QPainter* p, int x, int y, int w, int h, int base, const QColorGroup& cg );
1248 virtual void drawString( QPainter &painter, const QString &str, int start, int len, int xstart, 1251 virtual void drawString( QPainter &painter, const QString &str, int start, int len, int xstart,
1249 int y, int baseLine, int w, int h, int selection, 1252 int y, int baseLine, int w, int h, int selection,
1250 QTextStringChar *formatChar, const QColorGroup& cg, 1253 QTextStringChar *formatChar, const QColorGroup& cg,
1251 bool rightToLeft ); 1254 bool rightToLeft );
1252 1255
1253private: 1256private:
1254 QMap<int, QTextParagraphSelection> &selections() const; 1257 QMap<int, QTextParagraphSelection> &selections() const;
1255 QPtrList<QTextCustomItem> &floatingItems() const; 1258 QPtrList<QTextCustomItem> &floatingItems() const;
1256 QBrush backgroundBrush( const QColorGroup&cg ) { if ( bgcol ) return *bgcol; return cg.brush( QColorGroup::Base ); } 1259 QBrush backgroundBrush( const QColorGroup&cg ) { if ( bgcol ) return *bgcol; return cg.brush( QColorGroup::Base ); }
1257 void invalidateStyleCache(); 1260 void invalidateStyleCache();
@@ -1312,16 +1315,16 @@ public:
1312 int widthUsed() const { return thiswused; } 1315 int widthUsed() const { return thiswused; }
1313 1316
1314 static bool isBreakable( QTextString *string, int pos ); 1317 static bool isBreakable( QTextString *string, int pos );
1315 1318
1316protected: 1319protected:
1317 virtual QTextLineStart *formatLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start, 1320 virtual QTextLineStart *formatLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start,
1318 QTextStringChar *last, int align = Qt3::AlignAuto, int space = 0 ); 1321 QTextStringChar *last, int align = Qt3::AlignAuto, int space = 0 );
1319#ifndef QT_NO_COMPLEXTEXT 1322#ifndef QT_NO_COMPLEXTEXT
1320 virtual QTextLineStart *bidiReorderLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start, 1323 virtual QTextLineStart *bidiReorderLine( QTextParagraph *parag, QTextString *string, QTextLineStart *line, QTextStringChar *start,
1321 QTextStringChar *last, int align, int space ); 1324 QTextStringChar *last, int align, int space );
1322#endif 1325#endif
1323 void insertLineStart( QTextParagraph *parag, int index, QTextLineStart *ls ); 1326 void insertLineStart( QTextParagraph *parag, int index, QTextLineStart *ls );
1324 1327
1325 int thisminw; 1328 int thisminw;
1326 int thiswused; 1329 int thiswused;
1327 1330
@@ -1376,13 +1379,13 @@ public:
1376// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1379// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1377 1380
1378class Q_EXPORT QTextPreProcessor 1381class Q_EXPORT QTextPreProcessor
1379{ 1382{
1380public: 1383public:
1381 enum Ids { 1384 enum Ids {
1382 Standard = 0 1385 Standard = 0
1383 }; 1386 };
1384 1387
1385 QTextPreProcessor(); 1388 QTextPreProcessor();
1386 virtual ~QTextPreProcessor() {} 1389 virtual ~QTextPreProcessor() {}
1387 1390
1388 virtual void process( QTextDocument *doc, QTextParagraph *, int, bool = TRUE ) = 0; 1391 virtual void process( QTextDocument *doc, QTextParagraph *, int, bool = TRUE ) = 0;
@@ -1396,24 +1399,24 @@ class Q_EXPORT QTextFormat
1396{ 1399{
1397 friend class QTextFormatCollection; 1400 friend class QTextFormatCollection;
1398 friend class QTextDocument; 1401 friend class QTextDocument;
1399 1402
1400public: 1403public:
1401 enum Flags { 1404 enum Flags {
1402 NoFlags, 1405 NoFlags,
1403 Bold = 1, 1406 Bold = 1,
1404 Italic = 2, 1407 Italic = 2,
1405 Underline = 4, 1408 Underline = 4,
1406 Family = 8, 1409 Family = 8,
1407 Size = 16, 1410 Size = 16,
1408 Color = 32, 1411 Color = 32,
1409 Misspelled = 64, 1412 Misspelled = 64,
1410 VAlign = 128, 1413 VAlign = 128,
1411 StrikeOut= 256, 1414 StrikeOut= 256,
1412 Font = Bold | Italic | Underline | Family | Size | StrikeOut, 1415 Font = Bold | Italic | Underline | Family | Size | StrikeOut,
1413 Format = Font | Color | Misspelled | VAlign 1416 Format = Font | Color | Misspelled | VAlign
1414 }; 1417 };
1415 1418
1416 enum VerticalAlignment { AlignNormal, AlignSuperScript, AlignSubScript }; 1419 enum VerticalAlignment { AlignNormal, AlignSuperScript, AlignSubScript };
1417 1420
1418 QTextFormat(); 1421 QTextFormat();
1419 virtual ~QTextFormat(); 1422 virtual ~QTextFormat();
@@ -1726,20 +1729,20 @@ inline void QTextDocument::setTabStops( int tw )
1726 tStopWidth = tw; 1729 tStopWidth = tw;
1727} 1730}
1728 1731
1729inline QString QTextDocument::originalText() const 1732inline QString QTextDocument::originalText() const
1730{ 1733{
1731 if ( oTextValid ) 1734 if ( oTextValid )
1732 return oText; 1735 return oText;
1733 return text(); 1736 return text();
1734} 1737}
1735 1738
1736inline void QTextDocument::setFlow( QTextFlow *f ) 1739inline void QTextDocument::setFlow( QTextFlow *f )
1737{ 1740{
1738 if ( flow_ ) 1741 if ( flow_ )
1739 delete flow_; 1742 delete flow_;
1740 flow_ = f; 1743 flow_ = f;
1741} 1744}
1742 1745
1743inline void QTextDocument::takeFlow() 1746inline void QTextDocument::takeFlow()
1744{ 1747{
1745 flow_ = 0; 1748 flow_ = 0;
@@ -1783,17 +1786,17 @@ inline void QTextFormat::addRef()
1783} 1786}
1784 1787
1785inline void QTextFormat::removeRef() 1788inline void QTextFormat::removeRef()
1786{ 1789{
1787 ref--; 1790 ref--;
1788 if ( !collection ) 1791 if ( !collection )
1789 return; 1792 return;
1790 if ( this == collection->defFormat ) 1793 if ( this == collection->defFormat )
1791 return; 1794 return;
1792 if ( ref == 0 ) 1795 if ( ref == 0 )
1793 collection->remove( this ); 1796 collection->remove( this );
1794} 1797}
1795 1798
1796inline QString QTextFormat::key() const 1799inline QString QTextFormat::key() const
1797{ 1800{
1798 return k; 1801 return k;
1799} 1802}
@@ -1840,15 +1843,15 @@ inline void QTextParagraph::clearBackgroundColor()
1840 delete bgcol; bgcol = 0; setChanged( TRUE ); 1843 delete bgcol; bgcol = 0; setChanged( TRUE );
1841} 1844}
1842 1845
1843inline void QTextParagraph::append( const QString &s, bool reallyAtEnd ) 1846inline void QTextParagraph::append( const QString &s, bool reallyAtEnd )
1844{ 1847{
1845 if ( reallyAtEnd ) 1848 if ( reallyAtEnd )
1846 insert( str->length(), s ); 1849 insert( str->length(), s );
1847 else 1850 else
1848 insert( QMAX( str->length() - 1, 0 ), s ); 1851 insert( QMAX( str->length() - 1, 0 ), s );
1849} 1852}
1850 1853
1851inline QTextParagraph *QTextParagraph::prev() const 1854inline QTextParagraph *QTextParagraph::prev() const
1852{ 1855{
1853 return p; 1856 return p;
1854} 1857}
@@ -1863,13 +1866,13 @@ inline bool QTextParagraph::hasAnySelection() const
1863 return mSelections ? !selections().isEmpty() : FALSE; 1866 return mSelections ? !selections().isEmpty() : FALSE;
1864} 1867}
1865 1868
1866inline void QTextParagraph::setEndState( int s ) 1869inline void QTextParagraph::setEndState( int s )
1867{ 1870{
1868 if ( s == state ) 1871 if ( s == state )
1869 return; 1872 return;
1870 state = s; 1873 state = s;
1871} 1874}
1872 1875
1873inline int QTextParagraph::endState() const 1876inline int QTextParagraph::endState() const
1874{ 1877{
1875 return state; 1878 return state;
@@ -1880,13 +1883,13 @@ inline void QTextParagraph::setParagId( int i )
1880 id = i; 1883 id = i;
1881} 1884}
1882 1885
1883inline int QTextParagraph::paragId() const 1886inline int QTextParagraph::paragId() const
1884{ 1887{
1885 if ( id == -1 ) 1888 if ( id == -1 )
1886 qWarning( "invalid parag id!!!!!!!! (%p)", (void*)this ); 1889 owarn << "invalid parag id!!!!!!!! (" << (void*)this << ")" << oendl;
1887 return id; 1890 return id;
1888} 1891}
1889 1892
1890inline bool QTextParagraph::firstPreProcess() const 1893inline bool QTextParagraph::firstPreProcess() const
1891{ 1894{
1892 return firstPProcess; 1895 return firstPProcess;
@@ -1907,20 +1910,20 @@ inline QTextString *QTextParagraph::string() const
1907 return str; 1910 return str;
1908} 1911}
1909 1912
1910inline QTextDocument *QTextParagraph::document() const 1913inline QTextDocument *QTextParagraph::document() const
1911{ 1914{
1912 if ( hasdoc ) 1915 if ( hasdoc )
1913 return (QTextDocument*) docOrPseudo; 1916 return (QTextDocument*) docOrPseudo;
1914 return 0; 1917 return 0;
1915} 1918}
1916 1919
1917inline QTextParagraphPseudoDocument *QTextParagraph::pseudoDocument() const 1920inline QTextParagraphPseudoDocument *QTextParagraph::pseudoDocument() const
1918{ 1921{
1919 if ( hasdoc ) 1922 if ( hasdoc )
1920 return 0; 1923 return 0;
1921 return (QTextParagraphPseudoDocument*) docOrPseudo; 1924 return (QTextParagraphPseudoDocument*) docOrPseudo;
1922} 1925}
1923 1926
1924 1927
1925inline QTextTableCell *QTextParagraph::tableCell() const 1928inline QTextTableCell *QTextParagraph::tableCell() const
1926{ 1929{
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
@@ -13,39 +13,41 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "browsekeyentry.h" 20#include "browsekeyentry.h"
21 21
22/* OPIE */
23#include <opie2/odebug.h>
24using namespace Opie::Core;
25
26/* QT */
22#include <qtoolbutton.h> 27#include <qtoolbutton.h>
23#include <qwidgetstack.h> 28#include <qwidgetstack.h>
24#include <qlayout.h> 29#include <qlayout.h>
25#include <qlineedit.h> 30#include <qlineedit.h>
26#include <qpushbutton.h> 31#include <qpushbutton.h>
27#include <qpopupmenu.h> 32#include <qpopupmenu.h>
28#include <qhbox.h> 33#include <qhbox.h>
29#include <qdatetime.h> 34#include <qdatetime.h>
30 35
31//#include <iostream.h>
32#include <qheader.h>
33// For qWarning(const char *)
34 36
35/*! 37/*!
36 \class TVBrowseKeyEntry 38 \class TVBrowseKeyEntry
37 \brief a Widget used enter keys into the TVBrowseViewWidget 39 \brief a Widget used enter keys into the TVBrowseViewWidget
38 40
39 The TVBrowseKeyEntry Widget provides the facility to enter 41 The TVBrowseKeyEntry Widget provides the facility to enter
40 various key types to be search on in the table. The key can be changed 42 various key types to be search on in the table. The key can be changed
41 and the entry field will update to the correct sort of widget appropriately 43 and the entry field will update to the correct sort of widget appropriately
42*/ 44*/
43 45
44/*! 46/*!
45 Constructs the widget 47 Constructs the widget
46*/ 48*/
47TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) 49TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
48 : QWidget(parent, name, f) 50 : QWidget(parent, name, f)
49{ 51{
50 int stack_elem = 0; 52 int stack_elem = 0;
51 QHBoxLayout *h_layout = new QHBoxLayout(this); 53 QHBoxLayout *h_layout = new QHBoxLayout(this);
@@ -77,43 +79,43 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
77 ws = new QWidgetStack(this, 0); 79 ws = new QWidgetStack(this, 0);
78 ws->addWidget(textKey, stack_elem++); 80 ws->addWidget(textKey, stack_elem++);
79 ws->addWidget(timeKey, stack_elem++); 81 ws->addWidget(timeKey, stack_elem++);
80 ws->addWidget(dateKey, stack_elem++); 82 ws->addWidget(dateKey, stack_elem++);
81 83
82 ws->raiseWidget(0); 84 ws->raiseWidget(0);
83 85
84 // TODO connect slots and signals.... 86 // TODO connect slots and signals....
85 connect(changeKeyButton, SIGNAL(clicked()), 87 connect(changeKeyButton, SIGNAL(clicked()),
86 this, SLOT(changeKeyMenuSlot())); 88 this, SLOT(changeKeyMenuSlot()));
87 connect(resetButton, SIGNAL(clicked()), 89 connect(resetButton, SIGNAL(clicked()),
88 this, SLOT(resetKeySlot())); 90 this, SLOT(resetKeySlot()));
89 91
90 connect(textKey, SIGNAL(textChanged(const QString&)), 92 connect(textKey, SIGNAL(textChanged(const QString&)),
91 this, SLOT(searchOnText())); 93 this, SLOT(searchOnText()));
92 94
93 connect(dayKey, SIGNAL(textChanged(const QString&)), 95 connect(dayKey, SIGNAL(textChanged(const QString&)),
94 this, SLOT(searchOnText())); 96 this, SLOT(searchOnText()));
95 connect(monthKey, SIGNAL(textChanged(const QString&)), 97 connect(monthKey, SIGNAL(textChanged(const QString&)),
96 this, SLOT(searchOnText())); 98 this, SLOT(searchOnText()));
97 connect(yearKey, SIGNAL(textChanged(const QString&)), 99 connect(yearKey, SIGNAL(textChanged(const QString&)),
98 this, SLOT(searchOnText())); 100 this, SLOT(searchOnText()));
99 101
100 connect(secondKey, SIGNAL(textChanged(const QString&)), 102 connect(secondKey, SIGNAL(textChanged(const QString&)),
101 this, SLOT(searchOnText())); 103 this, SLOT(searchOnText()));
102 connect(minuteKey, SIGNAL(textChanged(const QString&)), 104 connect(minuteKey, SIGNAL(textChanged(const QString&)),
103 this, SLOT(searchOnText())); 105 this, SLOT(searchOnText()));
104 connect(hourKey, SIGNAL(textChanged(const QString&)), 106 connect(hourKey, SIGNAL(textChanged(const QString&)),
105 this, SLOT(searchOnText())); 107 this, SLOT(searchOnText()));
106 108
107 h_layout->addWidget(ws); 109 h_layout->addWidget(ws);
108 h_layout->addWidget(resetButton); 110 h_layout->addWidget(resetButton);
109 h_layout->addWidget(changeKeyButton); 111 h_layout->addWidget(changeKeyButton);
110} 112}
111 113
112/*! 114/*!
113 Destructs the widget 115 Destructs the widget
114*/ 116*/
115TVBrowseKeyEntry::~TVBrowseKeyEntry() 117TVBrowseKeyEntry::~TVBrowseKeyEntry()
116{ 118{
117} 119}
118 120
119/*! 121/*!
@@ -133,23 +135,23 @@ void TVBrowseKeyEntry::changeKeySlot(int id_param)
133 case kt_time: 135 case kt_time:
134 ws->raiseWidget(1); 136 ws->raiseWidget(1);
135 break; 137 break;
136 case kt_date: 138 case kt_date:
137 ws->raiseWidget(2); 139 ws->raiseWidget(2);
138 break; 140 break;
139 default: 141 default:
140 return; 142 return;
141 } 143 }
142} 144}
143 145
144/*! 146/*!
145 Opens the change key menu 147 Opens the change key menu
146*/ 148*/
147void TVBrowseKeyEntry::changeKeyMenuSlot() 149void TVBrowseKeyEntry::changeKeyMenuSlot()
148{ 150{
149 if(ts) 151 if(ts)
150 keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0))); 152 keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0)));
151} 153}
152/*! 154/*!
153 Blanks the key entry widget 155 Blanks the key entry widget
154 \TODO the actual implmentation 156 \TODO the actual implmentation
155*/ 157*/
@@ -162,21 +164,21 @@ void TVBrowseKeyEntry::setTableState(TableState *t) {
162 ts = t; 164 ts = t;
163 165
164 /* clear the old */ 166 /* clear the old */
165 keyMenu->clear(); 167 keyMenu->clear();
166 168
167 for (i = 0; i < t->kRep->getNumFields(); i++) { 169 for (i = 0; i < t->kRep->getNumFields(); i++) {
168 keyMenu->insertItem(ts->kRep->getKeyName(i), this, 170 keyMenu->insertItem(ts->kRep->getKeyName(i), this,
169 SLOT(changeKeySlot(int)), 0, i); 171 SLOT(changeKeySlot(int)), 0, i);
170 keyMenu->setItemParameter(i, i); 172 keyMenu->setItemParameter(i, i);
171 } 173 }
172} 174}
173 175
174/*! 176/*!
175 Searches on the current value of the key entry provided that the 177 Searches on the current value of the key entry provided that the
176 current key is of type text WARNING, TODO fix memory leaks 178 current key is of type text WARNING, TODO fix memory leaks
177*/ 179*/
178void TVBrowseKeyEntry::searchOnText() 180void TVBrowseKeyEntry::searchOnText()
179{ 181{
180 void *sendkey; 182 void *sendkey;
181 int tmp; 183 int tmp;
182 184
@@ -225,18 +227,17 @@ void TVBrowseKeyEntry::searchOnText()
225 if(!QDate::isValid(y, m, d)) 227 if(!QDate::isValid(y, m, d))
226 return; 228 return;
227 sendkey = (void *) new QDate(y, m, d); 229 sendkey = (void *) new QDate(y, m, d);
228 break; 230 break;
229 } 231 }
230 default: 232 default:
231 qWarning("TVBrowseKeyEntry::searchOnText() " 233 owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl;
232 "cannot work out data type");
233 return; 234 return;
234 } 235 }
235 emit searchOnKey(ts->current_column, sendkey); 236 emit searchOnKey(ts->current_column, sendkey);
236} 237}
237 238
238/*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, void *v) 239/*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, void *v)
239 240
240 This signal indicates that a search on key index currentKeyId should be 241 This signal indicates that a search on key index currentKeyId should be
241 done searching for the value v. 242 done searching for the value v.
242*/ 243*/
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
@@ -13,14 +13,14 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "common.h" 20#include "common.h"
21#include "datacache.h" 21#include "datacache.h"
22 22
23/* OPIE */ 23/* OPIE */
24#include <opie2/odebug.h> 24#include <opie2/odebug.h>
25#include <qpe/timestring.h> 25#include <qpe/timestring.h>
26using namespace Opie::Core; 26using namespace Opie::Core;
@@ -85,19 +85,19 @@ int parseNextNumber(QString *q) {
85 </UL> 85 </UL>
86*/ 86*/
87int QStringVector::compareItems(Item a, Item b) 87int QStringVector::compareItems(Item a, Item b)
88{ 88{
89 QString *qa = (QString *)a; 89 QString *qa = (QString *)a;
90 QString *qb = (QString *)b; 90 QString *qb = (QString *)b;
91 91
92 return QString::compare(*qa, *qb); 92 return QString::compare(*qa, *qb);
93} 93}
94 94
95/*! 95/*!
96 \class TVVariant 96 \class TVVariant
97 A way of abstracting void * and keeping information on 97 A way of abstracting void * and keeping information on
98 the keytypes and behaviours in one place 98 the keytypes and behaviours in one place
99*/ 99*/
100 100
101TVVariantPrivate::TVVariantPrivate() 101TVVariantPrivate::TVVariantPrivate()
102{ 102{
103 typ = TVVariant::Invalid; 103 typ = TVVariant::Invalid;
@@ -317,13 +317,13 @@ void TVVariant::load(QDataStream &s )
317 int x; 317 int x;
318 s >> x; 318 s >> x;
319 d->value.i = x; 319 d->value.i = x;
320 } 320 }
321 break; 321 break;
322 default: 322 default:
323 ofatal << "Unrecognized data type" << oendl; 323 ofatal << "Unrecognized data type" << oendl;
324 } 324 }
325} 325}
326 326
327void TVVariant::save( QDataStream &s ) const 327void TVVariant::save( QDataStream &s ) const
328{ 328{
329 s << type(); 329 s << type();
@@ -379,13 +379,13 @@ const QString TVVariant::toString() const
379 case String: 379 case String:
380 return *((QString*)d->value.ptr); 380 return *((QString*)d->value.ptr);
381 case Date: 381 case Date:
382 return ((QDate*)d->value.ptr)->toString(); 382 return ((QDate*)d->value.ptr)->toString();
383 case Time: 383 case Time:
384 return ((QTime*)d->value.ptr)->toString(); 384 return ((QTime*)d->value.ptr)->toString();
385 case Int: 385 case Int:
386 return QString::number(d->value.i); 386 return QString::number(d->value.i);
387 case Invalid: 387 case Invalid:
388 default: 388 default:
389 return QString::null; 389 return QString::null;
390 } 390 }
391 return QString::null; 391 return QString::null;
@@ -421,22 +421,22 @@ const QDate TVVariant::toDate() const
421 int month = parseNextNumber(&q); 421 int month = parseNextNumber(&q);
422 int year = parseNextNumber(&q); 422 int year = parseNextNumber(&q);
423 if (!QDate::isValid(year, month, day)) 423 if (!QDate::isValid(year, month, day))
424 return QDate(); 424 return QDate();
425 return QDate(year, month, day); 425 return QDate(year, month, day);
426 } 426 }
427 427
428 428
429 return QDate(); 429 return QDate();
430} 430}
431 431
432const QTime TVVariant::toTime() const 432const QTime TVVariant::toTime() const
433{ 433{
434 if(d->typ == Time) 434 if(d->typ == Time)
435 return *((QTime *)d->value.ptr); 435 return *((QTime *)d->value.ptr);
436 436
437 if(d->typ == String) { 437 if(d->typ == String) {
438 QString q = toString(); 438 QString q = toString();
439 int hour = parseNextNumber(&q); 439 int hour = parseNextNumber(&q);
440 int minute = parseNextNumber(&q); 440 int minute = parseNextNumber(&q);
441 int second = parseNextNumber(&q); 441 int second = parseNextNumber(&q);
442 int msecond = parseNextNumber(&q); 442 int msecond = parseNextNumber(&q);
@@ -451,13 +451,13 @@ const QTime TVVariant::toTime() const
451#define TV_VARIANT_AS( f ) Q##f& TVVariant::as##f() { \ 451#define TV_VARIANT_AS( f ) Q##f& TVVariant::as##f() { \
452 if ( d->typ != f ) \ 452 if ( d->typ != f ) \
453 *this = TVVariant( to##f() ); \ 453 *this = TVVariant( to##f() ); \
454 else \ 454 else \
455 detach(); \ 455 detach(); \
456 return *((Q##f*)d->value.ptr); } 456 return *((Q##f*)d->value.ptr); }
457 457
458TV_VARIANT_AS(String) 458TV_VARIANT_AS(String)
459TV_VARIANT_AS(Date) 459TV_VARIANT_AS(Date)
460TV_VARIANT_AS(Time) 460TV_VARIANT_AS(Time)
461 461
462#undef TV_VARIANT_AS 462#undef TV_VARIANT_AS
463 463
@@ -557,66 +557,66 @@ bool TVVariant::operator>( const TVVariant &v ) const
557 557
558/*! True if n is closer to this than o */ 558/*! True if n is closer to this than o */
559bool TVVariant::closer(TVVariant n, TVVariant o) 559bool TVVariant::closer(TVVariant n, TVVariant o)
560{ 560{
561 /* Nothing is close to an invalid, so nothing can be closer */ 561 /* Nothing is close to an invalid, so nothing can be closer */
562 if(d->typ == Invalid) 562 if(d->typ == Invalid)
563 return FALSE; 563 return FALSE;
564 564
565 /* can't be closer if of different type */ 565 /* can't be closer if of different type */
566 if(n.type() != type()) 566 if(n.type() != type())
567 return FALSE; 567 return FALSE;
568 568
569 /* if new shares type, and old doesn't, then new is closer */ 569 /* if new shares type, and old doesn't, then new is closer */
570 if(o.type() != type()) 570 if(o.type() != type())
571 return TRUE; 571 return TRUE;
572 572
573 switch(type()){ 573 switch(type()){
574 case String: { 574 case String: {
575 /* case for strings is close is a substring.. closer is 575 /* case for strings is close is a substring.. closer is
576 * earlier alphabetically */ 576 * earlier alphabetically */
577 QString qs1 = n.toString().lower(); 577 QString qs1 = n.toString().lower();
578 QString qs2 = o.toString().lower(); 578 QString qs2 = o.toString().lower();
579 QString qsv = toString().lower(); 579 QString qsv = toString().lower();
580 580
581 if (!qs1.startsWith(qsv)) 581 if (!qs1.startsWith(qsv))
582 return FALSE; 582 return FALSE;
583 583
584 /* contains sub-str, if later than is not closer */ 584 /* contains sub-str, if later than is not closer */
585 if(QString::compare(qs1, qs2) > 0) 585 if(QString::compare(qs1, qs2) > 0)
586 return FALSE; 586 return FALSE;
587 return TRUE; 587 return TRUE;
588 } 588 }
589 case Int: { 589 case Int: {
590 /* case for int is smallest absolute difference */ 590 /* case for int is smallest absolute difference */
591 int i1 = n.toInt(); 591 int i1 = n.toInt();
592 int i2 = o.toInt(); 592 int i2 = o.toInt();
593 int iv = toInt(); 593 int iv = toInt();
594 594
595 int diff1 = (i1 - iv); 595 int diff1 = (i1 - iv);
596 if (diff1 < 0) 596 if (diff1 < 0)
597 diff1 = -diff1; 597 diff1 = -diff1;
598 int diff2 = (i2 - iv); 598 int diff2 = (i2 - iv);
599 if (diff2 < 0) 599 if (diff2 < 0)
600 diff2 = -diff2; 600 diff2 = -diff2;
601 601
602 if (diff1 < diff2) 602 if (diff1 < diff2)
603 return TRUE; 603 return TRUE;
604 return FALSE; 604 return FALSE;
605 } 605 }
606 case Date: { 606 case Date: {
607 QDate i1 = n.toDate(); 607 QDate i1 = n.toDate();
608 QDate i2 = o.toDate(); 608 QDate i2 = o.toDate();
609 QDate iv = toDate(); 609 QDate iv = toDate();
610 610
611 /* definition of closer is the least difference in days */ 611 /* definition of closer is the least difference in days */
612 int diff1 = i1.daysTo(iv); 612 int diff1 = i1.daysTo(iv);
613 if (diff1 < 0) 613 if (diff1 < 0)
614 diff1 = -diff1; 614 diff1 = -diff1;
615 int diff2 = i2.daysTo(iv); 615 int diff2 = i2.daysTo(iv);
616 if (diff2 < 0) 616 if (diff2 < 0)
617 diff2 = -diff2; 617 diff2 = -diff2;
618 618
619 if (diff1 < diff2) 619 if (diff1 < diff2)
620 return TRUE; 620 return TRUE;
621 return FALSE; 621 return FALSE;
622 } 622 }
@@ -624,16 +624,16 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
624 QTime i1 = n.toTime(); 624 QTime i1 = n.toTime();
625 QTime i2 = o.toTime(); 625 QTime i2 = o.toTime();
626 QTime iv = toTime(); 626 QTime iv = toTime();
627 627
628 /* definition of closer is the least difference in days */ 628 /* definition of closer is the least difference in days */
629 int diff1 = i1.msecsTo(iv); 629 int diff1 = i1.msecsTo(iv);
630 if (diff1 < 0) 630 if (diff1 < 0)
631 diff1 = -diff1; 631 diff1 = -diff1;
632 int diff2 = i2.msecsTo(iv); 632 int diff2 = i2.msecsTo(iv);
633 if (diff2 < 0) 633 if (diff2 < 0)
634 diff2 = -diff2; 634 diff2 = -diff2;
635 if (diff1 < diff2) 635 if (diff1 < diff2)
636 return TRUE; 636 return TRUE;
637 return FALSE; 637 return FALSE;
638 } 638 }
639 default: 639 default:
@@ -646,30 +646,30 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
646 646
647/*! True if n is close to this */ 647/*! True if n is close to this */
648bool TVVariant::close(TVVariant n) 648bool TVVariant::close(TVVariant n)
649{ 649{
650 /* Nothing is close to an invalid, so nothing can be closer */ 650 /* Nothing is close to an invalid, so nothing can be closer */
651 if(type() == Invalid) 651 if(type() == Invalid)
652 return FALSE; 652 return FALSE;
653 653
654 /* can't be close if of different type */ 654 /* can't be close if of different type */
655 if(n.type() != type()) 655 if(n.type() != type())
656 return FALSE; 656 return FALSE;
657 657
658 switch(type()){ 658 switch(type()){
659 case String: { 659 case String: {
660 /* case for strings is close is a substring.. closer is 660 /* case for strings is close is a substring.. closer is
661 * earlier alphabetically */ 661 * earlier alphabetically */
662 QString qs1 = n.toString().lower(); 662 QString qs1 = n.toString().lower();
663 QString qsv = toString().lower(); 663 QString qsv = toString().lower();
664 664
665 if (!qs1.startsWith(qsv)) 665 if (!qs1.startsWith(qsv))
666 return FALSE; 666 return FALSE;
667 return TRUE; 667 return TRUE;
668 } 668 }
669 case Int: 669 case Int:
670 case Date: 670 case Date:
671 case Time: 671 case Time:
672 return TRUE; 672 return TRUE;
673 default: 673 default:
674 /* don't know how to do 'closer' on this type, hence never closer 674 /* don't know how to do 'closer' on this type, hence never closer
675 * or even close */ 675 * or even close */
@@ -678,29 +678,29 @@ bool TVVariant::close(TVVariant n)
678 return FALSE; 678 return FALSE;
679} 679}
680 680
681/*! 681/*!
682 \class Key 682 \class Key
683 \brief document me! 683 \brief document me!
684 684
685 document me! 685 document me!
686*/ 686*/
687 687
688Key::Key() : kname(), kexample(), kflags(0) { } 688Key::Key() : kname(), kexample(), kflags(0) { }
689 689
690Key::Key(QString name, TVVariant example, int flags) : 690Key::Key(QString name, TVVariant example, int flags) :
691 kname(name), kexample(example), kflags(flags) { } 691 kname(name), kexample(example), kflags(flags) { }
692 692
693Key::Key(const Key &other) 693Key::Key(const Key &other)
694{ 694{
695 kname = other.kname; 695 kname = other.kname;
696 kexample = other.kexample; 696 kexample = other.kexample;
697 kflags = other.kflags; 697 kflags = other.kflags;
698} 698}
699 699
700Key& Key::operator=(const Key& key) 700Key& Key::operator=(const Key& key)
701{ 701{
702 kname = key.kname; 702 kname = key.kname;
703 kexample = key.kexample; 703 kexample = key.kexample;
704 kflags = key.kflags; 704 kflags = key.kflags;
705 return *this; 705 return *this;
706} 706}
@@ -774,19 +774,19 @@ void Key::setNewFlag(bool v)
774 headings by DBStore. It stores the names and types of the keys 774 headings by DBStore. It stores the names and types of the keys
775*/ 775*/
776 776
777/*! 777/*!
778 Constructs a KeyList 778 Constructs a KeyList
779*/ 779*/
780KeyList::KeyList() : QIntDict<Key>(20) 780KeyList::KeyList() : QIntDict<Key>(20)
781{ 781{
782 setAutoDelete(TRUE); 782 setAutoDelete(TRUE);
783} 783}
784 784
785/* Should be deep copy, but isn't */ 785/* Should be deep copy, but isn't */
786KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k) 786KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k)
787{ 787{
788 KeyListIterator it(k); 788 KeyListIterator it(k);
789 while(it.current()) { 789 while(it.current()) {
790 replace(it.currentKey(), new Key(*it.current())); 790 replace(it.currentKey(), new Key(*it.current()));
791 ++it; 791 ++it;
792 } 792 }
@@ -819,13 +819,13 @@ bool KeyList::operator!=(const KeyList &other)
819 return FALSE; 819 return FALSE;
820} 820}
821 821
822/*! 822/*!
823 Returns the number of keys stored in the KeyList 823 Returns the number of keys stored in the KeyList
824*/ 824*/
825int KeyList::getNumFields() const 825int KeyList::getNumFields() const
826{ 826{
827 return count(); 827 return count();
828} 828}
829 829
830/*! 830/*!
831 Adds a new key to the KeyList 831 Adds a new key to the KeyList
@@ -844,67 +844,66 @@ int KeyList::addKey(QString name, TVVariant example)
844 844
845int KeyList::addKey(QString name, TVVariant::KeyType type) 845int KeyList::addKey(QString name, TVVariant::KeyType type)
846{ 846{
847 /* generate a valid type for the example? */ 847 /* generate a valid type for the example? */
848 TVVariant e = TVVariant("0"); 848 TVVariant e = TVVariant("0");
849 switch(type) { 849 switch(type) {
850 case TVVariant::String: 850 case TVVariant::String:
851 return addKey(name, TVVariant("<undefined>").asString()); 851 return addKey(name, TVVariant("<undefined>").asString());
852 break; 852 break;
853 case TVVariant::Date: 853 case TVVariant::Date:
854 return addKey(name, TVVariant(QDate::currentDate()).asDate()); 854 return addKey(name, TVVariant(QDate::currentDate()).asDate());
855 break; 855 break;
856 case TVVariant::Time: 856 case TVVariant::Time:
857 return addKey(name, TVVariant(QTime(0,0,0)).toTime()); 857 return addKey(name, TVVariant(QTime(0,0,0)).toTime());
858 break; 858 break;
859 case TVVariant::Int: 859 case TVVariant::Int:
860 return addKey(name, TVVariant(0).toInt()); 860 return addKey(name, TVVariant(0).toInt());
861 break; 861 break;
862 default: 862 default:
863 qWarning(QObject::tr("KeyList::addKey() Cannot make default " 863 owarn << "KeyList::addKey() Cannot make default value for type " << type << ", Key not added." << oendl;
864 "value for type %1, Key not added.").arg(type));
865 break; 864 break;
866 } 865 }
867 return -1; 866 return -1;
868} 867}
869 868
870void KeyList::setKeyFlags(int i, int flag) 869void KeyList::setKeyFlags(int i, int flag)
871{ 870{
872 if(find(i)) 871 if(find(i))
873 find(i)->setFlags(flag); 872 find(i)->setFlags(flag);
874} 873}
875 874
876int KeyList::getKeyFlags(int i) const 875int KeyList::getKeyFlags(int i) const
877{ 876{
878 if(find(i)) 877 if(find(i))
879 return find(i)->flags(); 878 return find(i)->flags();
880 return 0; 879 return 0;
881} 880}
882 881
883bool KeyList::checkNewFlag(int i) const 882bool KeyList::checkNewFlag(int i) const
884{ 883{
885 if (find(i)) 884 if (find(i))
886 return find(i)->newFlag(); 885 return find(i)->newFlag();
887 return false; 886 return false;
888} 887}
889 888
890void KeyList::setNewFlag(int i, bool f) 889void KeyList::setNewFlag(int i, bool f)
891{ 890{
892 if(!find(i)) 891 if(!find(i))
893 return; 892 return;
894 find(i)->setNewFlag(f); 893 find(i)->setNewFlag(f);
895} 894}
896 895
897bool KeyList::checkDeleteFlag(int i) const 896bool KeyList::checkDeleteFlag(int i) const
898{ 897{
899 if (find(i)) 898 if (find(i))
900 return find(i)->delFlag(); 899 return find(i)->delFlag();
901 return false; 900 return false;
902} 901}
903 902
904void KeyList::setDeleteFlag(int i, bool f) 903void KeyList::setDeleteFlag(int i, bool f)
905{ 904{
906 if(!find(i)) 905 if(!find(i))
907 return; 906 return;
908 find(i)->setDelFlag(f); 907 find(i)->setDelFlag(f);
909} 908}
910 909
@@ -915,13 +914,13 @@ QString KeyList::getKeyName(int i) const
915{ 914{
916 if (find (i)) 915 if (find (i))
917 return find(i)->name(); 916 return find(i)->name();
918 return QString(); 917 return QString();
919} 918}
920 919
921void KeyList::setKeyName(int i, const QString &n) 920void KeyList::setKeyName(int i, const QString &n)
922{ 921{
923 if(find(i)) 922 if(find(i))
924 find(i)->setName(n); 923 find(i)->setName(n);
925} 924}
926 925
927/*! 926/*!
@@ -931,13 +930,13 @@ TVVariant::KeyType KeyList::getKeyType(int i) const
931{ 930{
932 if(find(i)) 931 if(find(i))
933 return find(i)->type(); 932 return find(i)->type();
934 return TVVariant::Invalid; 933 return TVVariant::Invalid;
935} 934}
936 935
937void KeyList::setKeyType(int i, TVVariant::KeyType t) 936void KeyList::setKeyType(int i, TVVariant::KeyType t)
938{ 937{
939 if(!find(i)) 938 if(!find(i))
940 return; 939 return;
941 switch(t) { 940 switch(t) {
942 case TVVariant::String: 941 case TVVariant::String:
943 find(i)->setExample(TVVariant(QString("default"))); 942 find(i)->setExample(TVVariant(QString("default")));
@@ -1037,15 +1036,15 @@ QDataStream &operator>>( QDataStream &s, KeyList &k)
1037 1036
1038 This class holds the data of a row in a table. 1037 This class holds the data of a row in a table.
1039*/ 1038*/
1040 1039
1041 1040
1042/*! 1041/*!
1043 Constructs a DataElem. This function needs a container because the 1042 Constructs a DataElem. This function needs a container because the
1044 size, types of keys and primary key are all defined by the containing 1043 size, types of keys and primary key are all defined by the containing
1045 database 1044 database
1046*/ 1045*/
1047DataElem::DataElem(DBStore *c) : values(20) 1046DataElem::DataElem(DBStore *c) : values(20)
1048{ 1047{
1049 int size; 1048 int size;
1050 contained = c; 1049 contained = c;
1051 size = c->getNumFields(); 1050 size = c->getNumFields();
@@ -1083,13 +1082,13 @@ QDataStream &operator>>( QDataStream &s, DataElem &d)
1083 int size; 1082 int size;
1084 TVVariant t; 1083 TVVariant t;
1085 Q_UINT16 index = 0; 1084 Q_UINT16 index = 0;
1086 1085
1087 s >> size; /* redundent data but makes streaming easier */ 1086 s >> size; /* redundent data but makes streaming easier */
1088 if (size != d.getNumFields()) { 1087 if (size != d.getNumFields()) {
1089 owarn << "DataSize mis-match" << oendl; 1088 owarn << "DataSize mis-match" << oendl;
1090 return s; /* sanity check failed.. don't load */ 1089 return s; /* sanity check failed.. don't load */
1091 } 1090 }
1092 1091
1093 for(i = 0; i < size; i++) { 1092 for(i = 0; i < size; i++) {
1094 s >> index; 1093 s >> index;
1095 s >> t; 1094 s >> t;
@@ -1106,68 +1105,68 @@ int DataElem::getNumFields() const
1106 1105
1107KeyList DataElem::getKeys() const 1106KeyList DataElem::getKeys() const
1108{ 1107{
1109 return *(contained->getKeys()); 1108 return *(contained->getKeys());
1110} 1109}
1111 1110
1112/*! 1111/*!
1113 This function determines whether field index i of the element has been 1112 This function determines whether field index i of the element has been
1114 set yet. 1113 set yet.
1115 1114
1116 \return A boolean value that is TRUE if the specfied field of this 1115 \return A boolean value that is TRUE if the specfied field of this
1117 element has been set and FALSE if the field has not yet been set 1116 element has been set and FALSE if the field has not yet been set
1118*/ 1117*/
1119bool DataElem::hasValidValue(int i) const 1118bool DataElem::hasValidValue(int i) const
1120{ 1119{
1121 if(!values.find(i)) 1120 if(!values.find(i))
1122 return FALSE; 1121 return FALSE;
1123 if(!contained->getKeys()->validIndex(i)) 1122 if(!contained->getKeys()->validIndex(i))
1124 return FALSE; 1123 return FALSE;
1125 return values.find(i)->isValid(); 1124 return values.find(i)->isValid();
1126} 1125}
1127 1126
1128/*! 1127/*!
1129 This function determines whether field name qs of the element has been 1128 This function determines whether field name qs of the element has been
1130 set yet. 1129 set yet.
1131 1130
1132 \return A boolean value that is TRUE if the specfied field of this 1131 \return A boolean value that is TRUE if the specfied field of this
1133 element has been set and FALSE if the field has not yet been set 1132 element has been set and FALSE if the field has not yet been set
1134*/ 1133*/
1135bool DataElem::hasValidValue(QString qs) const 1134bool DataElem::hasValidValue(QString qs) const
1136{ 1135{
1137 int i = contained->getKeyIndex(qs); 1136 int i = contained->getKeyIndex(qs);
1138 return hasValidValue(i); 1137 return hasValidValue(i);
1139} 1138}
1140 1139
1141/*! returns the type of the field specified by index i */ 1140/*! returns the type of the field specified by index i */
1142TVVariant::KeyType DataElem::getFieldType(int i) const 1141TVVariant::KeyType DataElem::getFieldType(int i) const
1143{ 1142{
1144 return contained->getKeyType(i); 1143 return contained->getKeyType(i);
1145} 1144}
1146 1145
1147/*! returns the type of the field specified by name qs */ 1146/*! returns the type of the field specified by name qs */
1148TVVariant::KeyType DataElem::getFieldType(QString qs) const 1147TVVariant::KeyType DataElem::getFieldType(QString qs) const
1149{ 1148{
1150 int i = contained->getKeyIndex(qs); 1149 int i = contained->getKeyIndex(qs);
1151 return contained->getKeyType(i); 1150 return contained->getKeyType(i);
1152} 1151}
1153 1152
1154/*! 1153/*!
1155 returns a pointer to the data stored in field index i for this 1154 returns a pointer to the data stored in field index i for this
1156 data element, (value may not be valid) 1155 data element, (value may not be valid)
1157*/ 1156*/
1158TVVariant DataElem::getField(int i) const 1157TVVariant DataElem::getField(int i) const
1159{ 1158{
1160 if(hasValidValue(i)) 1159 if(hasValidValue(i))
1161 return TVVariant(*values.find(i)); 1160 return TVVariant(*values.find(i));
1162 return TVVariant(); 1161 return TVVariant();
1163} 1162}
1164 1163
1165/*! 1164/*!
1166 returns a pointer to the data stored in field name qs for this 1165 returns a pointer to the data stored in field name qs for this
1167 data element, (value may not be valid) 1166 data element, (value may not be valid)
1168*/ 1167*/
1169TVVariant DataElem::getField(QString qs) const 1168TVVariant DataElem::getField(QString qs) const
1170{ 1169{
1171 int i = contained->getKeyIndex(qs); 1170 int i = contained->getKeyIndex(qs);
1172 return getField(i); 1171 return getField(i);
1173} 1172}
@@ -1176,13 +1175,13 @@ TVVariant DataElem::getField(QString qs) const
1176 Sets the value of the elements field index i to the value represented in 1175 Sets the value of the elements field index i to the value represented in
1177 the QString q. 1176 the QString q.
1178 1177
1179 \param i index of the field to set 1178 \param i index of the field to set
1180 \param q a string that can be parsed to get the value to be set 1179 \param q a string that can be parsed to get the value to be set
1181*/ 1180*/
1182void DataElem::setField(int i, QString q) 1181void DataElem::setField(int i, QString q)
1183{ 1182{
1184 /* from the type of the field, parse q and store */ 1183 /* from the type of the field, parse q and store */
1185 TVVariant::KeyType kt = contained->getKeyType(i); 1184 TVVariant::KeyType kt = contained->getKeyType(i);
1186 1185
1187 TVVariant t = TVVariant(q); 1186 TVVariant t = TVVariant(q);
1188 1187
@@ -1205,26 +1204,24 @@ void DataElem::setField(int i, QString q)
1205 case TVVariant::Time: { 1204 case TVVariant::Time: {
1206 t.asTime(); 1205 t.asTime();
1207 setField(i, t); 1206 setField(i, t);
1208 return; 1207 return;
1209 } 1208 }
1210 default: 1209 default:
1211 qWarning( 1210 owarn << "DataElem::setField(" << i << ", " << q << ") No valid type found" << oendl;
1212 QObject::tr("DataElem::setField(%1, %2) No valid type found").arg(i).arg(q)
1213 );
1214 } 1211 }
1215} 1212}
1216 1213
1217/*! 1214/*!
1218 Sets the value of the elements field index i to the value at the pointer 1215 Sets the value of the elements field index i to the value at the pointer
1219 value. 1216 value.
1220 1217
1221 \param i index of the field to set 1218 \param i index of the field to set
1222 \param value a pointer to the (already allocated) value to set 1219 \param value a pointer to the (already allocated) value to set
1223*/ 1220*/
1224void DataElem::setField(int i, TVVariant value) 1221void DataElem::setField(int i, TVVariant value)
1225{ 1222{
1226 if (value.isValid()) { 1223 if (value.isValid()) {
1227 values.remove(i); 1224 values.remove(i);
1228 values.replace(i, new TVVariant(value)); 1225 values.replace(i, new TVVariant(value));
1229 } 1226 }
1230} 1227}
@@ -1233,25 +1230,25 @@ void DataElem::setField(int i, TVVariant value)
1233 Sets the value of the elements field name qs to the value represented in 1230 Sets the value of the elements field name qs to the value represented in
1234 the QString q. 1231 the QString q.
1235 1232
1236 \param qs name of the field to set 1233 \param qs name of the field to set
1237 \param q a string that can be parsed to get the value to be set 1234 \param q a string that can be parsed to get the value to be set
1238*/ 1235*/
1239void DataElem::setField(QString qs, QString q) 1236void DataElem::setField(QString qs, QString q)
1240{ 1237{
1241 /* from the type of the field, parse q and store */ 1238 /* from the type of the field, parse q and store */
1242 int i = contained->getKeyIndex(qs); 1239 int i = contained->getKeyIndex(qs);
1243 setField(i, qs); 1240 setField(i, qs);
1244} 1241}
1245 1242
1246/*! 1243/*!
1247 Sets the value of the elements field name qs to the value at the pointer 1244 Sets the value of the elements field name qs to the value at the pointer
1248 value. 1245 value.
1249 1246
1250 \param qs name of the field to set 1247 \param qs name of the field to set
1251 \param value a pointer to the (already allocated) value to set 1248 \param value a pointer to the (already allocated) value to set
1252*/ 1249*/
1253void DataElem::setField(QString qs, TVVariant value) 1250void DataElem::setField(QString qs, TVVariant value)
1254{ 1251{
1255 int i = contained->getKeyIndex(qs); 1252 int i = contained->getKeyIndex(qs);
1256 setField(i, value); 1253 setField(i, value);
1257} 1254}
@@ -1264,13 +1261,13 @@ void DataElem::unsetField(QString qs)
1264{ 1261{
1265 int i = contained->getKeyIndex(qs); 1262 int i = contained->getKeyIndex(qs);
1266 unsetField(i); 1263 unsetField(i);
1267} 1264}
1268 1265
1269/*! 1266/*!
1270 Converts the data element to a Rich Text QString 1267 Converts the data element to a Rich Text QString
1271*/ 1268*/
1272QString DataElem::toQString() const 1269QString DataElem::toQString() const
1273{ 1270{
1274 /* lets make an attempt at this function */ 1271 /* lets make an attempt at this function */
1275 int i; 1272 int i;
1276 QString scratch = ""; 1273 QString scratch = "";
@@ -1287,21 +1284,21 @@ QString DataElem::toQString() const
1287 ++it; 1284 ++it;
1288 } 1285 }
1289 return scratch; 1286 return scratch;
1290} 1287}
1291 1288
1292/*! formats individual fields to strings so can be displayed */ 1289/*! formats individual fields to strings so can be displayed */
1293QString DataElem::toQString(int i) const 1290QString DataElem::toQString(int i) const
1294{ 1291{
1295 if(hasValidValue(i)) { 1292 if(hasValidValue(i)) {
1296 return getField(i).toString(); 1293 return getField(i).toString();
1297 } 1294 }
1298 return ""; 1295 return "";
1299} 1296}
1300/*! formats individual fields to strings so can be sorted by QListView */ 1297/*! formats individual fields to strings so can be sorted by QListView */
1301QString DataElem::toSortableQString(int i) const 1298QString DataElem::toSortableQString(int i) const
1302{ 1299{
1303 QString scratch = ""; 1300 QString scratch = "";
1304 if(hasValidValue(i)) { 1301 if(hasValidValue(i)) {
1305 switch (contained->getKeyType(i)) { 1302 switch (contained->getKeyType(i)) {
1306 case TVVariant::String: { 1303 case TVVariant::String: {
1307 scratch += getField(i).toString(); 1304 scratch += getField(i).toString();
@@ -1310,19 +1307,19 @@ QString DataElem::toSortableQString(int i) const
1310 case TVVariant::Int: { 1307 case TVVariant::Int: {
1311 scratch.sprintf("%08d", getField(i).toInt()); 1308 scratch.sprintf("%08d", getField(i).toInt());
1312 break; 1309 break;
1313 } 1310 }
1314 case TVVariant::Date: { 1311 case TVVariant::Date: {
1315 static QDate epochD(1800, 1, 1); 1312 static QDate epochD(1800, 1, 1);
1316 scratch.sprintf("%08d", 1313 scratch.sprintf("%08d",
1317 epochD.daysTo(getField(i).toDate())); 1314 epochD.daysTo(getField(i).toDate()));
1318 break; 1315 break;
1319 } 1316 }
1320 case TVVariant::Time: { 1317 case TVVariant::Time: {
1321 static QTime epochT(0, 0, 0); 1318 static QTime epochT(0, 0, 0);
1322 scratch.sprintf("%08d", 1319 scratch.sprintf("%08d",
1323 epochT.msecsTo(getField(i).toTime())); 1320 epochT.msecsTo(getField(i).toTime()));
1324 break; 1321 break;
1325 } 1322 }
1326 default: 1323 default:
1327 scratch += "Unknown type"; 1324 scratch += "Unknown type";
1328 break; 1325 break;
@@ -1377,18 +1374,18 @@ bool DataElem::contains(int i, TVVariant v) const
1377 if (qs1.contains(qs2) > 0) return TRUE; 1374 if (qs1.contains(qs2) > 0) return TRUE;
1378 break; 1375 break;
1379 } 1376 }
1380 /* meaningless for ints */ 1377 /* meaningless for ints */
1381 /* meaningless for time */ 1378 /* meaningless for time */
1382 /* meaningless for dates */ 1379 /* meaningless for dates */
1383 case TVVariant::Int: 1380 case TVVariant::Int:
1384 case TVVariant::Time: 1381 case TVVariant::Time:
1385 case TVVariant::Date: 1382 case TVVariant::Date:
1386 break; 1383 break;
1387 default: 1384 default:
1388 owarn << "Tried to compare unknown data type" << oendl; 1385 owarn << "Tried to compare unknown data type" << oendl;
1389 } 1386 }
1390 return FALSE; 1387 return FALSE;
1391} 1388}
1392 1389
1393bool DataElem::startsWith(int i, TVVariant v) const 1390bool DataElem::startsWith(int i, TVVariant v) const
1394{ 1391{
@@ -1403,18 +1400,18 @@ bool DataElem::startsWith(int i, TVVariant v) const
1403 QString qs2 = v.toString().lower(); 1400 QString qs2 = v.toString().lower();
1404 return qs1.startsWith(qs2); 1401 return qs1.startsWith(qs2);
1405 } 1402 }
1406 /* meaningless for ints */ 1403 /* meaningless for ints */
1407 /* meaningless for time */ 1404 /* meaningless for time */
1408 /* meaningless for dates */ 1405 /* meaningless for dates */
1409 case TVVariant::Int: 1406 case TVVariant::Int:
1410 case TVVariant::Time: 1407 case TVVariant::Time:
1411 case TVVariant::Date: 1408 case TVVariant::Date:
1412 return FALSE; 1409 return FALSE;
1413 default: 1410 default:
1414 owarn << "Tried to compare unknown data type" << oendl; 1411 owarn << "Tried to compare unknown data type" << oendl;
1415 } 1412 }
1416 return FALSE; 1413 return FALSE;
1417} 1414}
1418 1415
1419bool DataElem::endsWith(int i, TVVariant v) const 1416bool DataElem::endsWith(int i, TVVariant v) const
1420{ 1417{
@@ -1429,50 +1426,50 @@ bool DataElem::endsWith(int i, TVVariant v) const
1429 QString qs2 = v.toString().lower(); 1426 QString qs2 = v.toString().lower();
1430 return qs1.startsWith(qs2); 1427 return qs1.startsWith(qs2);
1431 } 1428 }
1432 /* meaningless for ints */ 1429 /* meaningless for ints */
1433 /* meaningless for time */ 1430 /* meaningless for time */
1434 /* meaningless for dates */ 1431 /* meaningless for dates */
1435 case TVVariant::Int: 1432 case TVVariant::Int:
1436 case TVVariant::Time: 1433 case TVVariant::Time:
1437 case TVVariant::Date: 1434 case TVVariant::Date:
1438 return FALSE; 1435 return FALSE;
1439 default: 1436 default:
1440 owarn << "Tried to compare unknown data type" << oendl; 1437 owarn << "Tried to compare unknown data type" << oendl;
1441 } 1438 }
1442 return FALSE; 1439 return FALSE;
1443} 1440}
1444 1441
1445/*! 1442/*!
1446 Determins which of the first to parameters are closer to the third, target 1443 Determins which of the first to parameters are closer to the third, target
1447 parameter. 1444 parameter.
1448 1445
1449 \return 1446 \return
1450 <UL> 1447 <UL>
1451 <LI>TRUE if the first element is a closer match to the target than the 1448 <LI>TRUE if the first element is a closer match to the target than the
1452 second element</LI> 1449 second element</LI>
1453 <LI>FALSE if the first element is not a closer match to the target than 1450 <LI>FALSE if the first element is not a closer match to the target than
1454 the second element</LI> 1451 the second element</LI>
1455 </UL> 1452 </UL>
1456*/ 1453*/
1457bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column) 1454bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
1458{ 1455{
1459 int type; 1456 int type;
1460 1457
1461 if(!d1) return FALSE; 1458 if(!d1) return FALSE;
1462 1459
1463 if (!d1->hasValidValue(column)) return FALSE; 1460 if (!d1->hasValidValue(column)) return FALSE;
1464 1461
1465 if(!target.isValid()) return FALSE; 1462 if(!target.isValid()) return FALSE;
1466 1463
1467 type = d1->getField(column).type(); 1464 type = d1->getField(column).type();
1468 1465
1469 if(d2) { 1466 if(d2) {
1470 if (type != d2->getField(column).type()) { 1467 if (type != d2->getField(column).type()) {
1471 /* can't do compare */ 1468 /* can't do compare */
1472 owarn << "Tried to compare two incompatable types" << oendl; 1469 owarn << "Tried to compare two incompatable types" << oendl;
1473 return FALSE; 1470 return FALSE;
1474 } 1471 }
1475 return target.closer(d1->getField(column), d2->getField(column)); 1472 return target.closer(d1->getField(column), d2->getField(column));
1476 } 1473 }
1477 return target.close(d1->getField(column)); 1474 return target.close(d1->getField(column));
1478} 1475}
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
@@ -13,13 +13,13 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20/* 20/*
21 * This file is used to load the xml files that represent the database. 21 * This file is used to load the xml files that represent the database.
22 * The main requirment for said file is each data entry must contain a key, 22 * The main requirment for said file is each data entry must contain a key,
23 * otherwise any other data headings are allowed. 23 * otherwise any other data headings are allowed.
24 */ 24 */
25 25
@@ -60,16 +60,16 @@ DBStore::DBStore()
60 table_size = INIT_TABLE_SIZE; 60 table_size = INIT_TABLE_SIZE;
61 61
62 current_elem = 0; 62 current_elem = 0;
63 archive = 0; 63 archive = 0;
64} 64}
65 65
66//TODO 66//TODO
67/*! 67/*!
68 Reinitializes the table to empty (include a resize of the master table, 68 Reinitializes the table to empty (include a resize of the master table,
69 which should free some memory) 69 which should free some memory)
70*/ 70*/
71void DBStore::freeTable() 71void DBStore::freeTable()
72{ 72{
73 name = ""; 73 name = "";
74 if(archive) { 74 if(archive) {
75 delete archive; 75 delete archive;
@@ -90,62 +90,62 @@ void DBStore::freeTable()
90DBStore::~DBStore() 90DBStore::~DBStore()
91{ 91{
92 freeTable(); 92 freeTable();
93} 93}
94 94
95/*! 95/*!
96 This function opens the given xml file, loads it and sets up the 96 This function opens the given xml file, loads it and sets up the
97 appropriate data structures. 97 appropriate data structures.
98 98
99 \param file_name A string representing the name of the file to be opened 99 \param file_name A string representing the name of the file to be opened
100 \return true if successful, false otherwise. 100 \return true if successful, false otherwise.
101*/ 101*/
102bool DBStore::openSource(QIODevice *inDev, const QString &source) { 102bool DBStore::openSource(QIODevice *inDev, const QString &source) {
103 103
104 /* first check if db is already open, if contains data.. then clear */ 104 /* first check if db is already open, if contains data.. then clear */
105 if(number_elems > 0) { 105 if(number_elems > 0) {
106 freeTable(); 106 freeTable();
107 } 107 }
108 108
109 if (source == "text/x-xml-tableviewer") { 109 if (source == "text/x-xml-tableviewer") {
110 archive = new DBXml(this); 110 archive = new DBXml(this);
111 } else if (source == "text/csv") { 111 } else if (source == "text/csv") {
112 archive = new DBCsv(this); 112 archive = new DBCsv(this);
113 } else 113 } else
114 return false; 114 return false;
115 115
116 return (archive->openSource(inDev)); 116 return (archive->openSource(inDev));
117} 117}
118 118
119bool DBStore::saveSource(QIODevice *outDev, const QString &source) 119bool DBStore::saveSource(QIODevice *outDev, const QString &source)
120{ 120{
121 /* saving a new file */ 121 /* saving a new file */
122 if(!archive) { 122 if(!archive) {
123 if (source == "text/x-xml-tableviewer") { 123 if (source == "text/x-xml-tableviewer") {
124 archive = new DBXml(this); 124 archive = new DBXml(this);
125 } else if (source == "text/x-xml-tableviewer") { 125 } else if (source == "text/x-xml-tableviewer") {
126 archive = new DBCsv(this); 126 archive = new DBCsv(this);
127 } else 127 } else
128 return false; 128 return false;
129 } 129 }
130 130
131 /* changing file type */ 131 /* changing file type */
132 if(archive->type() != source) { 132 if(archive->type() != source) {
133 delete archive; 133 delete archive;
134 if (source == "text/x-xml-tableviewer") { 134 if (source == "text/x-xml-tableviewer") {
135 archive = new DBXml(this); 135 archive = new DBXml(this);
136 } else if (source == "text/x-xml-tableviewer") { 136 } else if (source == "text/x-xml-tableviewer") {
137 archive = new DBCsv(this); 137 archive = new DBCsv(this);
138 } else 138 } else
139 return false; 139 return false;
140 } 140 }
141 141
142 return (archive->saveSource(outDev)); 142 return (archive->saveSource(outDev));
143} 143}
144 144
145/*! 145/*!
146 This function is used to add new elements to the database. If the database 146 This function is used to add new elements to the database. If the database
147 has already reached the maximum allowable size this function does not alter 147 has already reached the maximum allowable size this function does not alter
148 the database. 148 the database.
149 149
150 \param delm An already allocated and initialized data element to be added 150 \param delm An already allocated and initialized data element to be added
151*/ 151*/
@@ -153,15 +153,15 @@ void DBStore::addItem(DataElem *delem)
153{ 153{
154 addItemInternal(delem); 154 addItemInternal(delem);
155} 155}
156 156
157void DBStore::addItemInternal(DataElem *delem) 157void DBStore::addItemInternal(DataElem *delem)
158{ 158{
159 /* if already full, don't over fill, do a qWarning though */ 159 /* if already full, don't over fill, do a owarn though */
160 if (full) { 160 if (full) {
161 owarn << "Attempted to add items to already full table" << oendl; 161 owarn << "Attempted to add items to already full table" << oendl;
162 return; 162 return;
163 } 163 }
164 164
165 master_table.insert(number_elems, delem); 165 master_table.insert(number_elems, delem);
166 166
167 current_elem = number_elems; 167 current_elem = number_elems;
@@ -182,43 +182,43 @@ void DBStore::addItemInternal(DataElem *delem)
182 } 182 }
183} 183}
184 184
185void DBStore::removeItem(DataElem *r) 185void DBStore::removeItem(DataElem *r)
186{ 186{
187 int position = master_table.findRef(r); 187 int position = master_table.findRef(r);
188 if(position != -1) { 188 if(position != -1) {
189 /* there is at least one item, this is it */ 189 /* there is at least one item, this is it */
190 /* replace this with the last element, decrease the element count */ 190 /* replace this with the last element, decrease the element count */
191 master_table.insert(position, master_table.at(--number_elems)); 191 master_table.insert(position, master_table.at(--number_elems));
192 master_table.remove(number_elems); 192 master_table.remove(number_elems);
193 delete r; 193 delete r;
194 } 194 }
195} 195}
196 196
197/*! 197/*!
198 Sets the name of the database 198 Sets the name of the database
199 199
200 \param n A string representing the new name of the database. 200 \param n A string representing the new name of the database.
201*/ 201*/
202void DBStore::setName(const QString &n) 202void DBStore::setName(const QString &n)
203{ 203{
204 name = n; 204 name = n;
205} 205}
206 206
207/*! 207/*!
208 Gets the name of the database 208 Gets the name of the database
209 209
210 \return A string representing the name of the database. 210 \return A string representing the name of the database.
211*/ 211*/
212QString DBStore::getName() 212QString DBStore::getName()
213{ 213{
214 return name; 214 return name;
215} 215}
216 216
217/*! 217/*!
218 Retrieves a pointer to the key representation of the database for 218 Retrieves a pointer to the key representation of the database for
219 other classes to use as reference. 219 other classes to use as reference.
220 220
221 \return a pointer to the databases key representaion 221 \return a pointer to the databases key representaion
222*/ 222*/
223KeyList *DBStore::getKeys() 223KeyList *DBStore::getKeys()
224{ 224{
@@ -232,21 +232,21 @@ KeyList *DBStore::getKeys()
232void DBStore::setKeys(KeyList *k) 232void DBStore::setKeys(KeyList *k)
233{ 233{
234 kRep = k; 234 kRep = k;
235} 235}
236 236
237/*! 237/*!
238 Sets the current element to the first element of the database 238 Sets the current element to the first element of the database
239*/ 239*/
240void DBStore::first() 240void DBStore::first()
241{ 241{
242 current_elem = 0; 242 current_elem = 0;
243} 243}
244 244
245/*! 245/*!
246 Sets the current element to the last element of the database 246 Sets the current element to the last element of the database
247*/ 247*/
248void DBStore::last() 248void DBStore::last()
249{ 249{
250 current_elem = number_elems - 1; 250 current_elem = number_elems - 1;
251} 251}
252 252
@@ -254,13 +254,13 @@ void DBStore::last()
254 Sets the current element to the next element of the database if 254 Sets the current element to the next element of the database if
255 there exists an element after the current one. 255 there exists an element after the current one.
256*/ 256*/
257bool DBStore::next() 257bool DBStore::next()
258{ 258{
259 unsigned int new_current_elem = current_elem + 1; 259 unsigned int new_current_elem = current_elem + 1;
260 if (current_elem < number_elems) 260 if (current_elem < number_elems)
261 /* was valid before inc (it is possible but unlikely that inc current 261 /* was valid before inc (it is possible but unlikely that inc current
262 elem will change it from invalid to valid) */ 262 elem will change it from invalid to valid) */
263 if (new_current_elem < number_elems) { 263 if (new_current_elem < number_elems) {
264 /* is valid after inc */ 264 /* is valid after inc */
265 current_elem = new_current_elem; 265 current_elem = new_current_elem;
266 return true; 266 return true;
@@ -275,27 +275,27 @@ bool DBStore::next()
275bool DBStore::previous() 275bool DBStore::previous()
276{ 276{
277 unsigned int new_current_elem = current_elem -1; 277 unsigned int new_current_elem = current_elem -1;
278 if (current_elem < number_elems) 278 if (current_elem < number_elems)
279 /* was valid */ 279 /* was valid */
280 if (new_current_elem < number_elems) { 280 if (new_current_elem < number_elems) {
281 /* still is (if was 0, then now -1, but as is unsigned will wrap 281 /* still is (if was 0, then now -1, but as is unsigned will wrap
282 and hence be invalid */ 282 and hence be invalid */
283 current_elem = new_current_elem; 283 current_elem = new_current_elem;
284 return true; 284 return true;
285 } 285 }
286 return false; 286 return false;
287} 287}
288 288
289/*! 289/*!
290 Returns the current data element in the database. Which element is current 290 Returns the current data element in the database. Which element is current
291 is affected by newly added items, findItem, next, previous, first and 291 is affected by newly added items, findItem, next, previous, first and
292 last functions 292 last functions
293 293
294 \return a pointer to the current data element 294 \return a pointer to the current data element
295*/ 295*/
296DataElem *DBStore::getCurrentData() 296DataElem *DBStore::getCurrentData()
297{ 297{
298 if (current_elem >= number_elems) 298 if (current_elem >= number_elems)
299 return NULL; 299 return NULL;
300 return master_table[current_elem]; 300 return master_table[current_elem];
301} 301}
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
@@ -24,15 +24,21 @@
24 * otherwise any other data headings are allowed. 24 * otherwise any other data headings are allowed.
25 */ 25 */
26 26
27#ifndef __DATACACHE_H__ 27#ifndef __DATACACHE_H__
28#define __DATACACHE_H__ 28#define __DATACACHE_H__
29 29
30#include "common.h"
31
32/* OPIE */
33#include <opie2/odebug.h>
34using namespace Opie::Core;
35
36/* QT */
30#include <qstring.h> 37#include <qstring.h>
31#include <qvector.h> 38#include <qvector.h>
32#include "common.h"
33 39
34class DBStore; 40class DBStore;
35 41
36/*! Abstract class that defines how database stuff can be accessed */ 42/*! Abstract class that defines how database stuff can be accessed */
37class DBAccess { 43class DBAccess {
38public: 44public:
@@ -42,18 +48,18 @@ public:
42 48
43 virtual QString type() { 49 virtual QString type() {
44 return QString(); 50 return QString();
45 } 51 }
46 52
47 virtual bool openSource(QIODevice *) { 53 virtual bool openSource(QIODevice *) {
48 qWarning("DBAccess::openSource not yet implemented"); 54 owarn << "DBAccess::openSource not yet implemented" << oendl;
49 return false; 55 return false;
50 } 56 }
51 57
52 virtual bool saveSource(QIODevice *) { 58 virtual bool saveSource(QIODevice *) {
53 qWarning("DBAccess::saveSource(QString) not yet implemented"); 59 owarn << "DBAccess::saveSource(QString) not yet implemented" << oendl;
54 return false; 60 return false;
55 } 61 }
56 62
57protected: 63protected:
58 DBStore *dstore; 64 DBStore *dstore;
59 QString source_name; 65 QString source_name;
@@ -67,13 +73,13 @@ public:
67 bool openSource(QIODevice *, const QString &source); 73 bool openSource(QIODevice *, const QString &source);
68 bool saveSource(QIODevice *, const QString &source); 74 bool saveSource(QIODevice *, const QString &source);
69 75
70 // Add an item 76 // Add an item
71 void addItem(DataElem *); 77 void addItem(DataElem *);
72 void addItemInternal(DataElem *); 78 void addItemInternal(DataElem *);
73 void removeItem(DataElem *); 79 void removeItem(DataElem *);
74 80
75 // Set the name of the database 81 // Set the name of the database
76 void setName(const QString &name); 82 void setName(const QString &name);
77 83
78 // Get the name of the database 84 // Get the name of the database
79 QString getName(); 85 QString getName();
@@ -103,28 +109,28 @@ public:
103 109
104// Access functions.. iterator type stuff 110// Access functions.. iterator type stuff
105 111
106 void first(); 112 void first();
107 void last(); 113 void last();
108 114
109 bool next(); 115 bool next();
110 bool previous(); 116 bool previous();
111 117
112 DataElem* getCurrentData(); 118 DataElem* getCurrentData();
113 119
114private: 120private:
115 /* does the work of freeing used memory */ 121 /* does the work of freeing used memory */
116 void freeTable(); 122 void freeTable();
117 QString name; 123 QString name;
118 124
119 QVector<DataElem> master_table; 125 QVector<DataElem> master_table;
120 DBAccess *archive; 126 DBAccess *archive;
121 127
122 KeyList *kRep; 128 KeyList *kRep;
123 129
124 unsigned int number_elems; 130 unsigned int number_elems;
125 unsigned int table_size; /* should always be a power of 2 */ 131 unsigned int table_size; /* should always be a power of 2 */
126 bool full; /* since because we are using an int for indexing there is 132 bool full; /* since because we are using an int for indexing there is
127 an upper limit on the number of items we can store. */ 133 an upper limit on the number of items we can store. */
128 unsigned int current_elem; 134 unsigned int current_elem;
129}; 135};
130#endif 136#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
@@ -13,39 +13,39 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "browsekeyentry.h" 20#include "browsekeyentry.h"
21#include "commonwidgets.h" 21#include "commonwidgets.h"
22 22
23#include <opie2/odebug.h>
24using namespace Opie::Core;
25
23#include <qtoolbutton.h> 26#include <qtoolbutton.h>
24#include <qwidgetstack.h> 27#include <qwidgetstack.h>
25#include <qlayout.h> 28#include <qlayout.h>
26#include <qlineedit.h> 29#include <qlineedit.h>
27#include <qpushbutton.h> 30#include <qpushbutton.h>
28#include <qpopupmenu.h> 31#include <qpopupmenu.h>
29#include <qhbox.h> 32#include <qhbox.h>
30#include <qdatetime.h> 33#include <qdatetime.h>
31 34
32#include <qheader.h>
33// For qWarning(const char *)
34
35/*! 35/*!
36 \class TVBrowseKeyEntry 36 \class TVBrowseKeyEntry
37 \brief a Widget used enter keys into the TVBrowseViewWidget 37 \brief a Widget used enter keys into the TVBrowseViewWidget
38 38
39 The TVBrowseKeyEntry Widget provides the facility to enter 39 The TVBrowseKeyEntry Widget provides the facility to enter
40 various key types to be search on in the table. The key can be changed 40 various key types to be search on in the table. The key can be changed
41 and the entry field will update to the correct sort of widget appropriately 41 and the entry field will update to the correct sort of widget appropriately
42*/ 42*/
43 43
44/*! 44/*!
45 Constructs the widget 45 Constructs the widget
46*/ 46*/
47TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) 47TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
48 : QWidget(parent, name, f) 48 : QWidget(parent, name, f)
49{ 49{
50 QHBoxLayout *h_layout = new QHBoxLayout(this); 50 QHBoxLayout *h_layout = new QHBoxLayout(this);
51 51
@@ -70,42 +70,42 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
70 ws->addWidget(textKey, TVVariant::String); 70 ws->addWidget(textKey, TVVariant::String);
71 ws->addWidget(intKey, TVVariant::Int); 71 ws->addWidget(intKey, TVVariant::Int);
72 ws->addWidget(timeKey, TVVariant::Time); 72 ws->addWidget(timeKey, TVVariant::Time);
73 ws->addWidget(dateKey, TVVariant::Date); 73 ws->addWidget(dateKey, TVVariant::Date);
74 74
75 ws->raiseWidget(TVVariant::String); 75 ws->raiseWidget(TVVariant::String);
76 76
77 // TODO connect slots and signals.... 77 // TODO connect slots and signals....
78 connect(changeKeyButton, SIGNAL(clicked()), 78 connect(changeKeyButton, SIGNAL(clicked()),
79 this, SLOT(changeKeyMenuSlot())); 79 this, SLOT(changeKeyMenuSlot()));
80 80
81 connect(resetButton, SIGNAL(clicked()), 81 connect(resetButton, SIGNAL(clicked()),
82 textKey, SLOT(clear())); 82 textKey, SLOT(clear()));
83 connect(resetButton, SIGNAL(clicked()), 83 connect(resetButton, SIGNAL(clicked()),
84 intKey, SLOT(clear())); 84 intKey, SLOT(clear()));
85 connect(resetButton, SIGNAL(clicked()), 85 connect(resetButton, SIGNAL(clicked()),
86 dateKey, SLOT(clear())); 86 dateKey, SLOT(clear()));
87 connect(resetButton, SIGNAL(clicked()), 87 connect(resetButton, SIGNAL(clicked()),
88 timeKey, SLOT(clear())); 88 timeKey, SLOT(clear()));
89 89
90 h_layout->addWidget(ws); 90 h_layout->addWidget(ws);
91 h_layout->addWidget(resetButton); 91 h_layout->addWidget(resetButton);
92 h_layout->addWidget(changeKeyButton); 92 h_layout->addWidget(changeKeyButton);
93 93
94 connect(textKey, SIGNAL(textChanged(const QString&)), 94 connect(textKey, SIGNAL(textChanged(const QString&)),
95 this, SLOT(searchOnText())); 95 this, SLOT(searchOnText()));
96 connect(intKey, SIGNAL(valueChanged(int)), 96 connect(intKey, SIGNAL(valueChanged(int)),
97 this, SLOT(searchOnText())); 97 this, SLOT(searchOnText()));
98 connect(dateKey, SIGNAL(valueChanged(const QDate&)), 98 connect(dateKey, SIGNAL(valueChanged(const QDate&)),
99 this, SLOT(searchOnText())); 99 this, SLOT(searchOnText()));
100 connect(timeKey, SIGNAL(valueChanged(const QTime&)), 100 connect(timeKey, SIGNAL(valueChanged(const QTime&)),
101 this, SLOT(searchOnText())); 101 this, SLOT(searchOnText()));
102} 102}
103 103
104/*! 104/*!
105 Destructs the widget 105 Destructs the widget
106*/ 106*/
107TVBrowseKeyEntry::~TVBrowseKeyEntry() 107TVBrowseKeyEntry::~TVBrowseKeyEntry()
108{ 108{
109} 109}
110 110
111/*! 111/*!
@@ -123,13 +123,13 @@ void TVBrowseKeyEntry::changeKeySlot(int id_param)
123 123
124/*! 124/*!
125 Opens the change key menu 125 Opens the change key menu
126*/ 126*/
127void TVBrowseKeyEntry::changeKeyMenuSlot() 127void TVBrowseKeyEntry::changeKeyMenuSlot()
128{ 128{
129 if(ts) 129 if(ts)
130 keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0))); 130 keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0)));
131} 131}
132 132
133 133
134void TVBrowseKeyEntry::setTableState(TableState *t) { 134void TVBrowseKeyEntry::setTableState(TableState *t) {
135 ts = t; 135 ts = t;
@@ -143,13 +143,13 @@ void TVBrowseKeyEntry::rebuildKeys() {
143 /* clear the old */ 143 /* clear the old */
144 keyMenu->clear(); 144 keyMenu->clear();
145 145
146 KeyListIterator it(*ts->kRep); 146 KeyListIterator it(*ts->kRep);
147 147
148 for (i = 0; i < ts->kRep->getNumFields(); i++) { 148 for (i = 0; i < ts->kRep->getNumFields(); i++) {
149 keyMenu->insertItem(it.current()->name(), this, 149 keyMenu->insertItem(it.current()->name(), this,
150 SLOT(changeKeySlot(int)), 0, i); 150 SLOT(changeKeySlot(int)), 0, i);
151 keyMenu->setItemParameter(i, it.currentKey()); 151 keyMenu->setItemParameter(i, it.currentKey());
152 ++it; 152 ++it;
153 } 153 }
154} 154}
155 155
@@ -160,14 +160,14 @@ void TVBrowseKeyEntry::reset()
160 dateKey->clear(); 160 dateKey->clear();
161 timeKey->clear(); 161 timeKey->clear();
162 162
163 keyMenu->clear(); 163 keyMenu->clear();
164} 164}
165/*! 165/*!
166 Searches on the current value of the key entry provided that the 166 Searches on the current value of the key entry provided that the
167 current key is of type text WARNING, TODO fix memory leaks 167 current key is of type text WARNING, TODO fix memory leaks
168*/ 168*/
169void TVBrowseKeyEntry::searchOnText() 169void TVBrowseKeyEntry::searchOnText()
170{ 170{
171 TVVariant sendkey; 171 TVVariant sendkey;
172 172
173 if (!ts) 173 if (!ts)
@@ -186,21 +186,20 @@ void TVBrowseKeyEntry::searchOnText()
186 break; 186 break;
187 } 187 }
188 case TVVariant::Date: { 188 case TVVariant::Date: {
189 sendkey = TVVariant(QDate(dateKey->date())); 189 sendkey = TVVariant(QDate(dateKey->date()));
190 break; 190 break;
191 } 191 }
192 case TVVariant::Invalid: 192 case TVVariant::Invalid:
193 break; 193 break;
194 default: 194 default:
195 qWarning("TVBrowseKeyEntry::searchOnText() " 195 owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl;
196 "cannot work out data type");
197 return; 196 return;
198 } 197 }
199 emit searchOnKey(ts->current_column, sendkey); 198 emit searchOnKey(ts->current_column, sendkey);
200} 199}
201 200
202/*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, TVVariant) 201/*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, TVVariant)
203 202
204 This signal indicates that a search on key index currentKeyId should be 203 This signal indicates that a search on key index currentKeyId should be
205 done searching for the value v. 204 done searching for the value v.
206*/ 205*/
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
@@ -13,16 +13,21 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "filterkeyentry.h" 20#include "filterkeyentry.h"
21#include "commonwidgets.h" 21#include "commonwidgets.h"
22 22
23/* OPIE */
24#include <opie2/odebug.h>
25using namespace Opie::Core;
26
27/* QT */
23#include <qwidgetstack.h> 28#include <qwidgetstack.h>
24#include <qcombobox.h> 29#include <qcombobox.h>
25#include <qlayout.h> 30#include <qlayout.h>
26#include <qlineedit.h> 31#include <qlineedit.h>
27#include <qsizepolicy.h> 32#include <qsizepolicy.h>
28#include <qdatetime.h> 33#include <qdatetime.h>
@@ -95,19 +100,19 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f)
95 ws->addWidget(textEntry, TVVariant::String); 100 ws->addWidget(textEntry, TVVariant::String);
96 ws->addWidget(intEntry, TVVariant::Int); 101 ws->addWidget(intEntry, TVVariant::Int);
97 ws->addWidget(timeEntry, TVVariant::Time); 102 ws->addWidget(timeEntry, TVVariant::Time);
98 ws->addWidget(dateEntry, TVVariant::Date); 103 ws->addWidget(dateEntry, TVVariant::Date);
99 104
100 /* connect the signals down */ 105 /* connect the signals down */
101 connect(textKey, SIGNAL(textChanged(const QString&)), 106 connect(textKey, SIGNAL(textChanged(const QString&)),
102 this, SIGNAL(valueChanged())); 107 this, SIGNAL(valueChanged()));
103 connect(intKey, SIGNAL(valueChanged(int)), 108 connect(intKey, SIGNAL(valueChanged(int)),
104 this, SIGNAL(valueChanged())); 109 this, SIGNAL(valueChanged()));
105 connect(dateKey, SIGNAL(valueChanged(const QDate&)), 110 connect(dateKey, SIGNAL(valueChanged(const QDate&)),
106 this, SIGNAL(valueChanged())); 111 this, SIGNAL(valueChanged()));
107 connect(timeKey, SIGNAL(valueChanged(const QTime&)), 112 connect(timeKey, SIGNAL(valueChanged(const QTime&)),
108 this, SIGNAL(valueChanged())); 113 this, SIGNAL(valueChanged()));
109 114
110 connect(intCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged())); 115 connect(intCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
111 connect(textCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged())); 116 connect(textCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
112 connect(timeCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged())); 117 connect(timeCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
113 connect(dateCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged())); 118 connect(dateCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
@@ -116,19 +121,19 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f)
116 layout->addWidget(ws); 121 layout->addWidget(ws);
117 122
118 current_type = TVVariant::String; 123 current_type = TVVariant::String;
119} 124}
120 125
121/*! 126/*!
122 Destructs the widget 127 Destructs the widget
123*/ 128*/
124TVFilterKeyEntry::~TVFilterKeyEntry() 129TVFilterKeyEntry::~TVFilterKeyEntry()
125{ 130{
126} 131}
127 132
128void TVFilterKeyEntry::setKey(int i) 133void TVFilterKeyEntry::setKey(int i)
129{ 134{
130 135
131 if (!ts) return; 136 if (!ts) return;
132 if (!ts->kRep) return; 137 if (!ts->kRep) return;
133 138
134 /* set up to raise appropriate widget set */ 139 /* set up to raise appropriate widget set */
@@ -180,29 +185,28 @@ CmpType TVFilterKeyEntry::getCompareType()
180TVVariant TVFilterKeyEntry::getCompareValue() 185TVVariant TVFilterKeyEntry::getCompareValue()
181{ 186{
182 TVVariant sendkey; 187 TVVariant sendkey;
183 int tmp; 188 int tmp;
184 189
185 switch(current_type) { 190 switch(current_type) {
186 case TVVariant::String: 191 case TVVariant::String:
187 sendkey = TVVariant(QString(textKey->text())); 192 sendkey = TVVariant(QString(textKey->text()));
188 break; 193 break;
189 case TVVariant::Int: { 194 case TVVariant::Int: {
190 sendkey = TVVariant(intKey->value()); 195 sendkey = TVVariant(intKey->value());
191 break; 196 break;
192 } 197 }
193 case TVVariant::Time: { 198 case TVVariant::Time: {
194 sendkey = TVVariant(QTime(timeKey->time())); 199 sendkey = TVVariant(QTime(timeKey->time()));
195 break; 200 break;
196 } 201 }
197 case TVVariant::Date: { 202 case TVVariant::Date: {
198 sendkey = TVVariant(QDate(dateKey->date())); 203 sendkey = TVVariant(QDate(dateKey->date()));
199 break; 204 break;
200 } 205 }
201 default: { 206 default: {
202 sendkey = TVVariant(0); 207 sendkey = TVVariant(0);
203 qWarning("TVFilterKeyEntry::getCompareValue() " 208 owarn << "TVFilterKeyEntry::getCompareValue() cannot work out data type" << oendl;
204 "cannot work out data type");
205 } 209 }
206 } 210 }
207 return sendkey; 211 return sendkey;
208} 212}
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
@@ -15,27 +15,33 @@
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "tvfilterview.h" 20#include "tvfilterview.h"
21
22/* OPIE */
23#include <opie2/odebug.h>
24#include <qpe/qpeapplication.h>
25using namespace Opie::Core;
26
27/* QT */
21#include <qtoolbutton.h> 28#include <qtoolbutton.h>
22#include <qcombobox.h> 29#include <qcombobox.h>
23#include <qlistview.h> 30#include <qlistview.h>
24#include <qlayout.h> 31#include <qlayout.h>
25#include <qheader.h> 32#include <qheader.h>
26#include <qpushbutton.h> 33#include <qpushbutton.h>
27#include <qlabel.h> 34#include <qlabel.h>
28 35
29#include <qpe/qpeapplication.h>
30 36
31TVFilterView::TVFilterView(TableState *t, QWidget* parent, 37TVFilterView::TVFilterView(TableState *t, QWidget* parent,
32 const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl) 38 const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl)
33{ 39{
34 if ( !name ) 40 if ( !name )
35 setName( "Filter View" ); 41 setName( "Filter View" );
36 42
37 QVBoxLayout *vlayout = new QVBoxLayout(this); 43 QVBoxLayout *vlayout = new QVBoxLayout(this);
38 44
39 display = new QListView(this, "display"); 45 display = new QListView(this, "display");
40 display->addColumn("Key"); 46 display->addColumn("Key");
41 display->addColumn("Constraint"); 47 display->addColumn("Constraint");
@@ -85,27 +91,27 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent,
85 connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm())); 91 connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm()));
86 connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms())); 92 connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms()));
87 93
88 connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() )); 94 connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() ));
89 connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() )); 95 connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() ));
90 96
91 connect(display, SIGNAL(selectionChanged(QListViewItem*)), this, 97 connect(display, SIGNAL(selectionChanged(QListViewItem*)), this,
92 SLOT(setTerm(QListViewItem*))); 98 SLOT(setTerm(QListViewItem*)));
93 99
94 ts = t; 100 ts = t;
95 current = 0; 101 current = 0;
96 terms.setAutoDelete(true); 102 terms.setAutoDelete(true);
97 do_filter = false; 103 do_filter = false;
98 104
99#ifdef Q_WS_QWS 105#ifdef Q_WS_QWS
100 QPEApplication::showDialog( this ); 106 QPEApplication::showDialog( this );
101#endif 107#endif
102} 108}
103 109
104/*! 110/*!
105 Destroys the TVFilterView widget 111 Destroys the TVFilterView widget
106*/ 112*/
107TVFilterView::~TVFilterView() 113TVFilterView::~TVFilterView()
108{ 114{
109} 115}
110 116
111void TVFilterView::rebuildData() 117void TVFilterView::rebuildData()
@@ -115,41 +121,41 @@ void TVFilterView::rebuildData()
115void TVFilterView::reset() 121void TVFilterView::reset()
116{ 122{
117 keyNameCombo->clear(); 123 keyNameCombo->clear();
118 keyIds.clear(); 124 keyIds.clear();
119} 125}
120 126
121void TVFilterView::rebuildKeys() 127void TVFilterView::rebuildKeys()
122{ 128{
123 int i; 129 int i;
124 130
125 if (!ts) return; 131 if (!ts) return;
126 if(!ts->kRep) return; 132 if(!ts->kRep) return;
127 keyEntry->setTableState(ts); 133 keyEntry->setTableState(ts);
128 134
129 /* set up the list of keys that can be compared on */ 135 /* set up the list of keys that can be compared on */
130 keyNameCombo->clear(); 136 keyNameCombo->clear();
131 KeyListIterator it(*ts->kRep); 137 KeyListIterator it(*ts->kRep);
132 138
133 i = 0; 139 i = 0;
134 while(it.current()) { 140 while(it.current()) {
135 if(ts->kRep->validIndex(it.currentKey())) { 141 if(ts->kRep->validIndex(it.currentKey())) {
136 keyNameCombo->insertItem(it.current()->name()); 142 keyNameCombo->insertItem(it.current()->name());
137 keyIds.insert(i, it.currentKey()); 143 keyIds.insert(i, it.currentKey());
138 ++i; 144 ++i;
139 } 145 }
140 ++it; 146 ++it;
141 } 147 }
142} 148}
143 149
144bool TVFilterView::passesFilter(DataElem *d) { 150bool TVFilterView::passesFilter(DataElem *d) {
145 if (!filterActive()) return true; 151 if (!filterActive()) return true;
146 152
147 153
148 FilterTerm *t; 154 FilterTerm *t;
149 155
150 for (t = terms.first(); t != 0; t = terms.next() ) { 156 for (t = terms.first(); t != 0; t = terms.next() ) {
151 /* check against filter */ 157 /* check against filter */
152 switch(t->ct) { 158 switch(t->ct) {
153 case ct_less: 159 case ct_less:
154 if (!d->lessThan(t->keyIndex, t->value)) 160 if (!d->lessThan(t->keyIndex, t->value))
155 return false; 161 return false;
@@ -172,14 +178,13 @@ bool TVFilterView::passesFilter(DataElem *d) {
172 break; 178 break;
173 case ct_endswith: 179 case ct_endswith:
174 if (!d->endsWith(t->keyIndex, t->value)) 180 if (!d->endsWith(t->keyIndex, t->value))
175 return false; 181 return false;
176 break; 182 break;
177 default: 183 default:
178 qWarning("TVFilterView::passesFilter() " 184 owarn << "TVFilterView::passesFilter() unrecognized filter type" << oendl;
179 "unrecognized filter type");
180 return false; 185 return false;
181 } 186 }
182 } 187 }
183 return true; 188 return true;
184} 189}
185 190
@@ -191,13 +196,13 @@ bool TVFilterView::filterActive() const
191 if (terms.isEmpty()) 196 if (terms.isEmpty())
192 return false; 197 return false;
193 return true; 198 return true;
194} 199}
195 200
196/* SLOTS */ 201/* SLOTS */
197void TVFilterView::newTerm() 202void TVFilterView::newTerm()
198{ 203{
199 if (!ts) return; 204 if (!ts) return;
200 205
201 FilterTerm *term = new FilterTerm; 206 FilterTerm *term = new FilterTerm;
202 current = term; 207 current = term;
203 208
@@ -209,13 +214,13 @@ void TVFilterView::newTerm()
209 terms.append(term); 214 terms.append(term);
210 215
211 keyEntry->setEnabled(true); 216 keyEntry->setEnabled(true);
212 keyNameCombo->setEnabled(true); 217 keyNameCombo->setEnabled(true);
213} 218}
214 219
215void TVFilterView::updateTerm() 220void TVFilterView::updateTerm()
216{ 221{
217 FilterTerm *term; 222 FilterTerm *term;
218 /* Read the widget values (keyname, compare type, value) 223 /* Read the widget values (keyname, compare type, value)
219 * and build the lists */ 224 * and build the lists */
220 if (!ts) return; 225 if (!ts) return;
221 if (!current) return; 226 if (!current) return;
@@ -228,13 +233,13 @@ void TVFilterView::updateTerm()
228 233
229 /* create new list item, set initial values, enable widgets */ 234 /* create new list item, set initial values, enable widgets */
230 term->keyIndex = keyIds[keyNameCombo->currentItem()]; 235 term->keyIndex = keyIds[keyNameCombo->currentItem()];
231 keyEntry->setKey(term->keyIndex); /* so the next two items make sense */ 236 keyEntry->setKey(term->keyIndex); /* so the next two items make sense */
232 term->ct = keyEntry->getCompareType(), 237 term->ct = keyEntry->getCompareType(),
233 term->value = keyEntry->getCompareValue(); 238 term->value = keyEntry->getCompareValue();
234 239
235 keyString = keyNameCombo->currentText(); 240 keyString = keyNameCombo->currentText();
236 241
237 switch(term->ct) { 242 switch(term->ct) {
238 case ct_less: 243 case ct_less:
239 cmpString = " less than "; 244 cmpString = " less than ";
240 break; 245 break;
@@ -257,20 +262,20 @@ void TVFilterView::updateTerm()
257 cmpString = " ERROR "; 262 cmpString = " ERROR ";
258 } 263 }
259 264
260 vString = term->value.toString(); 265 vString = term->value.toString();
261 266
262 /* remove old view */ 267 /* remove old view */
263 if (term->view) 268 if (term->view)
264 delete(term->view); 269 delete(term->view);
265 term->view = new QListViewItem(display, 0, keyString, cmpString, vString); 270 term->view = new QListViewItem(display, 0, keyString, cmpString, vString);
266 display->setSelected(term->view, true); 271 display->setSelected(term->view, true);
267} 272}
268 273
269/* deletes current term */ 274/* deletes current term */
270void TVFilterView::deleteTerm() 275void TVFilterView::deleteTerm()
271{ 276{
272 if(!current) return; 277 if(!current) return;
273 if (current->view) 278 if (current->view)
274 delete(current->view); 279 delete(current->view);
275 280
276 terms.removeRef(current); 281 terms.removeRef(current);
@@ -281,26 +286,26 @@ void TVFilterView::deleteTerm()
281 keyEntry->setEnabled(false); 286 keyEntry->setEnabled(false);
282 keyNameCombo->setEnabled(false); 287 keyNameCombo->setEnabled(false);
283 } 288 }
284} 289}
285 290
286/* clears all terminations */ 291/* clears all terminations */
287void TVFilterView::clearTerms() 292void TVFilterView::clearTerms()
288{ 293{
289 while(current) 294 while(current)
290 deleteTerm(); 295 deleteTerm();
291} 296}
292 297
293void TVFilterView::setTerm(QListViewItem *target) 298void TVFilterView::setTerm(QListViewItem *target)
294{ 299{
295 /* Iterate through the list to find item with view=target.. 300 /* Iterate through the list to find item with view=target..
296 * set as current, delete */ 301 * set as current, delete */
297 FilterTerm *term = current; 302 FilterTerm *term = current;
298 303
299 for (current = terms.first(); current != 0; current = terms.next() ) 304 for (current = terms.first(); current != 0; current = terms.next() )
300 if (current->view == target) 305 if (current->view == target)
301 break; 306 break;
302 307
303 if (!current) { 308 if (!current) {
304 current = term; 309 current = term;
305 } 310 }
306} 311}
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
@@ -21,12 +21,13 @@
21#define QTOPIA_INTERNAL_LANGLIST 21#define QTOPIA_INTERNAL_LANGLIST
22#include "kateconfig.h" 22#include "kateconfig.h"
23 23
24/* OPIE */ 24/* OPIE */
25#include <opie2/odebug.h> 25#include <opie2/odebug.h>
26#include <qpe/global.h> 26#include <qpe/global.h>
27using namespace Opie::Core;
27 28
28/* QT */ 29/* QT */
29#include <qdir.h> 30#include <qdir.h>
30#include <qmessagebox.h> 31#include <qmessagebox.h>
31#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 32#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
32#include <qtextcodec.h> 33#include <qtextcodec.h>
@@ -553,14 +554,13 @@ void KateConfig::write( const QString &fn )
553 return; 554 return;
554 } 555 }
555 556
556 f.close(); 557 f.close();
557 // now rename the file... 558 // now rename the file...
558 if ( rename( strNewFile, filename ) < 0 ) { 559 if ( rename( strNewFile, filename ) < 0 ) {
559 qWarning( "problem renaming the file %s to %s", strNewFile.latin1(), 560 owarn << "problem renaming the file " << strNewFile.latin1() << " to " << filename.latin1() << oendl;
560 filename.latin1() );
561 QFile::remove( strNewFile ); 561 QFile::remove( strNewFile );
562 } 562 }
563} 563}
564 564
565/*! 565/*!
566 Returns whether the KateConfig is in a valid state. 566 Returns whether the KateConfig is in a valid state.
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
@@ -5,17 +5,25 @@
5** 5**
6** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html 6** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
7*/ 7*/
8 8
9 9
10#include "zsafe.h" 10#include "zsafe.h"
11
12/* OPIE */
13#include <opie2/odebug.h>
14using namespace Opie::Core;
15
16/* QT */
11#ifdef DESKTOP 17#ifdef DESKTOP
12#include <qapplication.h> 18#include <qapplication.h>
13#else 19#else
14#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
15#endif 21#endif
22
23/* STD */
16#include <stdio.h> 24#include <stdio.h>
17#include <signal.h> 25#include <signal.h>
18 26
19ZSafe *zs; 27ZSafe *zs;
20#ifdef DESKTOP 28#ifdef DESKTOP
21QApplication *appl; 29QApplication *appl;
@@ -55,41 +63,38 @@ int main( int argc, char ** argv )
55 if (argc >= 3) 63 if (argc >= 3)
56 { 64 {
57#ifndef WIN32 65#ifndef WIN32
58 DeskW = atoi(argv[1]); 66 DeskW = atoi(argv[1]);
59 DeskH = atoi(argv[2]); 67 DeskH = atoi(argv[2]);
60#else 68#else
61 int w, h; 69 int w, h;
62 sscanf (argv[1], "%d", &w); 70 sscanf (argv[1], "%d", &w);
63 sscanf (argv[2], "%d", &h); 71 sscanf (argv[2], "%d", &h);
64 DeskW = w; 72 DeskW = w;
65 DeskH = h; 73 DeskH = h;
66#endif 74#endif
67 } 75 }
68 else 76 else
69 { 77 {
70 DeskW = 600; 78 DeskW = 600;
71 DeskH = 400; 79 DeskH = 400;
72 } 80 }
73#else 81#else
74 DeskW = a.desktop()->width(); 82 DeskW = a.desktop()->width();
75 DeskH = a.desktop()->height(); 83 DeskH = a.desktop()->height();
76 84
77 char buf[128]; 85 owarn << "Width: " << DeskW << " Height: " << DeskH << oendl;
78 sprintf (buf, "Width: %d Height: %d\n", DeskW, DeskH);
79 qWarning (buf);
80 86
81#ifdef JPATCH_HDE 87#ifdef JPATCH_HDE
82 // nothings 88 // nothings
83#else 89#else
84 if (DeskW > 240) 90 if (DeskW > 240)
85 { 91 {
86 DeskW -= 20; 92 DeskW -= 20;
87 DeskH += 25; 93 DeskH += 25;
88 sprintf (buf, "Changed width: %d Height: %d\n", DeskW, DeskH); 94 owarn << "Changed width: " << DeskW << " Height: " << DeskH << oendl;
89 qWarning (buf);
90 } 95 }
91#endif 96#endif
92 97
93#endif 98#endif
94 99
95 ZSafe mw; 100 ZSafe mw;
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,29 +1,32 @@
1/* 1/*
2** $Id$ 2** $Id$
3*/ 3*/
4 4
5#include "zlistview.h" 5#include "zlistview.h"
6#include <stdio.h>
7#include "zsafe.h" 6#include "zsafe.h"
8 7
8/* OPIE */
9//#include <opie2/odebug.h>
10
11/* STD */
12#include <stdio.h>
13
9ZListView::ZListView (ZSafe *zsafe, const char *id) : QListView(zsafe, id) 14ZListView::ZListView (ZSafe *zsafe, const char *id) : QListView(zsafe, id)
10{ 15{
11 zs = zsafe; 16 zs = zsafe;
12} 17}
13 18
14ZListView::~ZListView() 19ZListView::~ZListView()
15{ 20{
16} 21}
17 22
18void ZListView::keyPressEvent ( QKeyEvent *e ) 23void ZListView::keyPressEvent ( QKeyEvent *e )
19{ 24{
20/* 25/*
21 char buf[64]; 26 owarn << "key: " << e->key() << oendl;
22 sprintf (buf, "key: %d\n", e->key());
23 qWarning (buf);
24*/ 27*/
25 28
26 switch (e->key()) 29 switch (e->key())
27 { 30 {
28 case 32: // middle cursor key pressed 31 case 32: // middle cursor key pressed
29 zs->showInfo (zs->selectedItem); 32 zs->showInfo (zs->selectedItem);
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
@@ -878,13 +878,13 @@ void ZSafe::findPwd()
878 QString comment; 878 QString comment;
879 if (result == Accepted) 879 if (result == Accepted)
880 { 880 {
881 name = dialog->NameField->text(); 881 name = dialog->NameField->text();
882 username = dialog->UsernameField->text(); 882 username = dialog->UsernameField->text();
883 comment = dialog->CommentField->text(); 883 comment = dialog->CommentField->text();
884 qWarning (name); 884 owarn << name << oendl;
885 } 885 }
886 else 886 else
887 { 887 {
888 delete dialog; 888 delete dialog;
889 return; 889 return;
890 } 890 }
@@ -924,13 +924,13 @@ void ZSafe::findPwd()
924 else 924 else
925 i = ListView->firstChild(); 925 i = ListView->firstChild();
926 for (; 926 for (;
927 i != NULL; 927 i != NULL;
928 i = i->nextSibling()) 928 i = i->nextSibling())
929 { 929 {
930 qWarning (i->text(0)); 930 owarn << i->text(0) << oendl;
931 i->setSelected(FALSE); 931 i->setSelected(FALSE);
932 932
933 // step through all subitems 933 // step through all subitems
934 QListViewItem *si; 934 QListViewItem *si;
935 if (lastSearchedItem) 935 if (lastSearchedItem)
936 si = lastSearchedItem; 936 si = lastSearchedItem;
@@ -938,13 +938,13 @@ void ZSafe::findPwd()
938 si = i->firstChild(); 938 si = i->firstChild();
939 // for (si = i->firstChild(); 939 // for (si = i->firstChild();
940 for (; 940 for (;
941 si != NULL; 941 si != NULL;
942 si = si->nextSibling()) 942 si = si->nextSibling())
943 { 943 {
944 qWarning (si->text(0)); 944 owarn << si->text(0) << oendl;
945 if (si->isSelected()) 945 if (si->isSelected())
946 si->setSelected(FALSE); 946 si->setSelected(FALSE);
947 // ListView->repaintItem(si); 947 // ListView->repaintItem(si);
948 948
949 bool n=TRUE; 949 bool n=TRUE;
950 bool u=TRUE; 950 bool u=TRUE;
@@ -955,13 +955,13 @@ void ZSafe::findPwd()
955 u = (si->text(1)).contains (username, FALSE); 955 u = (si->text(1)).contains (username, FALSE);
956 if (!comment.isEmpty()) 956 if (!comment.isEmpty())
957 c = (si->text(3)).contains (comment, FALSE); 957 c = (si->text(3)).contains (comment, FALSE);
958 958
959 if ((n && u && c ) && !found) 959 if ((n && u && c ) && !found)
960 { 960 {
961 qWarning ("Found"); 961 owarn << "Found" << oendl;
962 selectedItem = si; 962 selectedItem = si;
963 si->setSelected(TRUE); 963 si->setSelected(TRUE);
964 ListView->setCurrentItem(si); 964 ListView->setCurrentItem(si);
965 ListView->ensureItemVisible(si); 965 ListView->ensureItemVisible(si);
966 ListView->triggerUpdate(); 966 ListView->triggerUpdate();
967 967
@@ -1225,14 +1225,13 @@ void ZSafe::removeAsciiFile()
1225 1225
1226 if (fn && fn.length() > 0 ) 1226 if (fn && fn.length() > 0 )
1227 { 1227 {
1228 QFile f( fn ); 1228 QFile f( fn );
1229 if ( !f.remove() ) 1229 if ( !f.remove() )
1230 { 1230 {
1231 qWarning( QString("Could not remove file %1").arg(fn), 1231 owarn << "Could not remove file " << fn << oendl;
1232 2000 );
1233 QMessageBox::critical( 0, tr("ZSafe"), 1232 QMessageBox::critical( 0, tr("ZSafe"),
1234 tr("Could not remove text file.") ); 1233 tr("Could not remove text file.") );
1235 return; 1234 return;
1236 } 1235 }
1237 } 1236 }
1238} 1237}
@@ -1275,14 +1274,13 @@ void ZSafe::writeAllEntries()
1275 1274
1276 // open the new document 1275 // open the new document
1277 if (fn && fn.length() > 0 ) 1276 if (fn && fn.length() > 0 )
1278 { 1277 {
1279 QFile f( fn ); 1278 QFile f( fn );
1280 if ( !f.open( IO_WriteOnly ) ) { 1279 if ( !f.open( IO_WriteOnly ) ) {
1281 qWarning( QString("Could not write to file %1").arg(fn), 1280 owarn << "Could not write to file " << fn << oendl;
1282 2000 );
1283 QMessageBox::critical( 0, "ZSafe", 1281 QMessageBox::critical( 0, "ZSafe",
1284 QString("Could not export to text file.") ); 1282 QString("Could not export to text file.") );
1285 return; 1283 return;
1286 } 1284 }
1287 QTextStream t( &f ); 1285 QTextStream t( &f );
1288 1286
@@ -1319,16 +1317,16 @@ void ZSafe::writeAllEntries()
1319 oneEntry += "\""; 1317 oneEntry += "\"";
1320 oneEntry += si->text(4); 1318 oneEntry += si->text(4);
1321 oneEntry += "\";"; 1319 oneEntry += "\";";
1322 oneEntry += "\""; 1320 oneEntry += "\"";
1323 oneEntry += si->text(5); 1321 oneEntry += si->text(5);
1324 oneEntry += "\""; 1322 oneEntry += "\"";
1325 // qWarning (oneEntry); 1323 // owarn << oneEntry << oendl;
1326 t << oneEntry << endl; 1324 t << oneEntry << endl;
1327 1325
1328 // qWarning (si->text(0)); 1326 // owarn << si->text(0) << oendl;
1329 } 1327 }
1330 } 1328 }
1331 f.close(); 1329 f.close();
1332 } 1330 }
1333} 1331}
1334 1332
@@ -1370,14 +1368,13 @@ void ZSafe::readAllEntries()
1370 1368
1371 if (fn && fn.length() > 0 ) 1369 if (fn && fn.length() > 0 )
1372 { 1370 {
1373 QFile f( fn ); 1371 QFile f( fn );
1374 if ( !f.open( IO_ReadOnly ) ) 1372 if ( !f.open( IO_ReadOnly ) )
1375 { 1373 {
1376 qWarning( QString("Could not read file %1").arg(fn), 1374 owarn << "Could not read file " << fn << oendl;
1377 2000 );
1378 QMessageBox::critical( 0, "ZSafe", 1375 QMessageBox::critical( 0, "ZSafe",
1379 QString("Could not import text file.") ); 1376 QString("Could not import text file.") );
1380 return; 1377 return;
1381 } 1378 }
1382 1379
1383 modified = true; 1380 modified = true;
@@ -1400,13 +1397,13 @@ void ZSafe::readAllEntries()
1400 si = si->nextSibling(); 1397 si = si->nextSibling();
1401 i->takeItem(_si); // remove from view list 1398 i->takeItem(_si); // remove from view list
1402 if (_si) delete _si; 1399 if (_si) delete _si;
1403 } 1400 }
1404 } 1401 }
1405 1402
1406 qWarning ("ReadAllEntries(): "); 1403 owarn << "ReadAllEntries(): " << oendl;
1407 1404
1408 QTextStream t(&f); 1405 QTextStream t(&f);
1409 while ( !t.eof() ) 1406 while ( !t.eof() )
1410 { 1407 {
1411 QString s = t.readLine(); 1408 QString s = t.readLine();
1412 s.replace (QRegExp("\";\""), "\"|\""); 1409 s.replace (QRegExp("\";\""), "\"|\"");
@@ -1551,14 +1548,13 @@ void ZSafe::readAllEntries()
1551void ZSafe::writeAllEntries() 1548void ZSafe::writeAllEntries()
1552{ 1549{
1553 // open the file for writing 1550 // open the file for writing
1554 QString fn = filename + ".txt"; 1551 QString fn = filename + ".txt";
1555 QFile f( fn ); 1552 QFile f( fn );
1556 if ( !f.open( IO_WriteOnly ) ) { 1553 if ( !f.open( IO_WriteOnly ) ) {
1557 qWarning( QString("Could not write to file %1").arg(fn), 1554 owarn << "Could not write to file " << fn << oendl;
1558 2000 );
1559 QMessageBox::critical( 0, tr("ZSafe"), 1555 QMessageBox::critical( 0, tr("ZSafe"),
1560 tr("Could not export to text file.") ); 1556 tr("Could not export to text file.") );
1561 return; 1557 return;
1562 } 1558 }
1563 QTextStream t( &f ); 1559 QTextStream t( &f );
1564 1560
@@ -1590,29 +1586,28 @@ void ZSafe::writeAllEntries()
1590 oneEntry += "\""; 1586 oneEntry += "\"";
1591 // oneEntry += si->text(3); 1587 // oneEntry += si->text(3);
1592 QString comment = si->text(3); 1588 QString comment = si->text(3);
1593 comment.replace (QRegExp("\n"), "<br>"); 1589 comment.replace (QRegExp("\n"), "<br>");
1594 oneEntry += comment; 1590 oneEntry += comment;
1595 oneEntry += "\""; 1591 oneEntry += "\"";
1596 // qWarning (oneEntry); 1592 // owarn << oneEntry << oendl;
1597 t << oneEntry << endl; 1593 t << oneEntry << endl;
1598 1594
1599 // qWarning (si->text(0)); 1595 // owarn << si->text(0) << oendl;
1600 } 1596 }
1601 } 1597 }
1602 f.close(); 1598 f.close();
1603} 1599}
1604 1600
1605void ZSafe::readAllEntries() 1601void ZSafe::readAllEntries()
1606{ 1602{
1607 QString fn = filename + ".txt"; 1603 QString fn = filename + ".txt";
1608 QFile f( fn ); 1604 QFile f( fn );
1609 if ( !f.open( IO_ReadOnly ) ) 1605 if ( !f.open( IO_ReadOnly ) )
1610 { 1606 {
1611 qWarning( QString("Could not read file %1").arg(fn), 1607 owarn << "Could not read file " << fn << oendl;
1612 2000 );
1613 QMessageBox::critical( 0, tr("ZSafe"), 1608 QMessageBox::critical( 0, tr("ZSafe"),
1614 tr("Could not import text file.") ); 1609 tr("Could not import text file.") );
1615 return; 1610 return;
1616 } 1611 }
1617 1612
1618 modified = true; 1613 modified = true;
@@ -1635,13 +1630,13 @@ void ZSafe::readAllEntries()
1635 si = si->nextSibling(); 1630 si = si->nextSibling();
1636 i->takeItem(_si); // remove from view list 1631 i->takeItem(_si); // remove from view list
1637 if (_si) delete _si; 1632 if (_si) delete _si;
1638 } 1633 }
1639 } 1634 }
1640 1635
1641 qWarning ("ReadAllEntries(): "); 1636 owarn << "ReadAllEntries(): " << oendl;
1642 1637
1643 QTextStream t(&f); 1638 QTextStream t(&f);
1644 while ( !t.eof() ) 1639 while ( !t.eof() )
1645 { 1640 {
1646 QString s = t.readLine(); 1641 QString s = t.readLine();
1647 s.replace (QRegExp("\";\""), "\"|\""); 1642 s.replace (QRegExp("\";\""), "\"|\"");
@@ -1759,13 +1754,13 @@ void ZSafe::readAllEntries()
1759 1754
1760} 1755}
1761#endif // UNUSED 1756#endif // UNUSED
1762 1757
1763void ZSafe::resume(int) 1758void ZSafe::resume(int)
1764{ 1759{
1765 qWarning ("Resume"); 1760 owarn << "Resume" << oendl;
1766 // hide the main window 1761 // hide the main window
1767 1762
1768 infoForm->hide(); 1763 infoForm->hide();
1769 // open zsafe again 1764 // open zsafe again
1770 m_password = ""; 1765 m_password = "";
1771 selectedItem = NULL; 1766 selectedItem = NULL;
@@ -1815,22 +1810,22 @@ bool ZSafe::openDocument(const char* _filename, const char* )
1815 { 1810 {
1816 // ask with a dialog for the password 1811 // ask with a dialog for the password
1817 if (m_password.isEmpty()) 1812 if (m_password.isEmpty())
1818 getDocPassword(tr("Enter Password")); 1813 getDocPassword(tr("Enter Password"));
1819 if (m_password.isEmpty() && validationFlag == 0) 1814 if (m_password.isEmpty() && validationFlag == 0)
1820 { 1815 {
1821 qWarning ("Wrong password"); 1816 owarn << "Wrong password" << oendl;
1822 QMessageBox::critical( 0, tr("ZSafe"), 1817 QMessageBox::critical( 0, tr("ZSafe"),
1823 tr("Wrong password.\n\nZSafe will now exit.") ); 1818 tr("Wrong password.\n\nZSafe will now exit.") );
1824 exitZs (1); 1819 exitZs (1);
1825 } 1820 }
1826 1821
1827 retval = loadInit(_filename, m_password); 1822 retval = loadInit(_filename, m_password);
1828 if (retval != PWERR_GOOD) 1823 if (retval != PWERR_GOOD)
1829 { 1824 {
1830 qWarning ("Error loading Document"); 1825 owarn << "Error loading Document" << oendl;
1831 return false; 1826 return false;
1832 } 1827 }
1833 } 1828 }
1834 else 1829 else
1835 { 1830 {
1836#ifdef WIN32 1831#ifdef WIN32
@@ -2298,13 +2293,13 @@ void ZSafe::setPasswordDialogDone()
2298 newPwdDialogResult = true; 2293 newPwdDialogResult = true;
2299 newPwdDialog->close(); 2294 newPwdDialog->close();
2300} 2295}
2301 2296
2302void ZSafe::getDocPassword(QString title) 2297void ZSafe::getDocPassword(QString title)
2303{ 2298{
2304qWarning ("getDocPassword"); 2299 owarn << "getDocPassword" << oendl;
2305 // open the 'Password' dialog 2300 // open the 'Password' dialog
2306 PasswordForm *dialog = new PasswordForm(this, title, TRUE); 2301 PasswordForm *dialog = new PasswordForm(this, title, TRUE);
2307 newPwdDialog = dialog; 2302 newPwdDialog = dialog;
2308 newPwdDialogResult = false; 2303 newPwdDialogResult = false;
2309 2304
2310 connect( dialog->PasswordField, SIGNAL( returnPressed() ), 2305 connect( dialog->PasswordField, SIGNAL( returnPressed() ),
@@ -2477,13 +2472,13 @@ int ZSafe::saveFinalize(void)
2477 free(buffer); 2472 free(buffer);
2478 return retval; 2473 return retval;
2479} 2474}
2480 2475
2481void ZSafe::quitMe () 2476void ZSafe::quitMe ()
2482{ 2477{
2483 qWarning ("QUIT..."); 2478 owarn << "QUIT..." << oendl;
2484 2479
2485 if (modified) 2480 if (modified)
2486 { 2481 {
2487 switch( QMessageBox::information( this, tr("ZSafe"), 2482 switch( QMessageBox::information( this, tr("ZSafe"),
2488 tr("Do you want to save\nbefore exiting?"), 2483 tr("Do you want to save\nbefore exiting?"),
2489 tr("&Save"), 2484 tr("&Save"),
@@ -2681,13 +2676,13 @@ void ZSafe::addCategory()
2681 if (result == Accepted) 2676 if (result == Accepted)
2682 { 2677 {
2683 modified = true; 2678 modified = true;
2684 category = dialog->CategoryField->currentText(); 2679 category = dialog->CategoryField->currentText();
2685 icon = dialog->IconField->currentText()+".png"; 2680 icon = dialog->IconField->currentText()+".png";
2686 2681
2687 qWarning (category); 2682 owarn << category << oendl;
2688 2683
2689 QListViewItem *li = new ShadedListItem( 1, ListView ); 2684 QListViewItem *li = new ShadedListItem( 1, ListView );
2690 Category *c1 = new Category(); 2685 Category *c1 = new Category();
2691 c1->setCategoryName(category); 2686 c1->setCategoryName(category);
2692 2687
2693 // if (!icon.isEmpty() && !icon.isNull()) 2688 // if (!icon.isEmpty() && !icon.isNull())
@@ -3189,13 +3184,13 @@ void ZSafe::editCategory()
3189 } 3184 }
3190 3185
3191 // change the category name of the selected category 3186 // change the category name of the selected category
3192 QListViewItem *catItem = cat->getListItem(); 3187 QListViewItem *catItem = cat->getListItem();
3193 if (catItem) 3188 if (catItem)
3194 { 3189 {
3195 qWarning (category); 3190 owarn << category << oendl;
3196 catItem->setText( 0, tr( category ) ); 3191 catItem->setText( 0, tr( category ) );
3197 cat->setCategoryName (tr(category)); 3192 cat->setCategoryName (tr(category));
3198 3193
3199 cat->initListItem(); 3194 cat->initListItem();
3200 categories.insert (category, cat); 3195 categories.insert (category, cat);
3201 } 3196 }
@@ -3590,13 +3585,13 @@ void ZSafe::paintEvent( QPaintEvent * )
3590 infoForm->raise(); 3585 infoForm->raise();
3591 } 3586 }
3592} 3587}
3593 3588
3594void ZSafe::resizeEvent ( QResizeEvent * ) 3589void ZSafe::resizeEvent ( QResizeEvent * )
3595{ 3590{
3596 // qWarning ("resizeEvent"); 3591 // owarn << "resizeEvent" << oendl;
3597#ifndef DESKTOP 3592#ifndef DESKTOP
3598 DeskW = appl->desktop()->width(); 3593 DeskW = appl->desktop()->width();
3599 DeskH = appl->desktop()->height(); 3594 DeskH = appl->desktop()->height();
3600#else 3595#else
3601 DeskW = this->width(); 3596 DeskW = this->width();
3602 DeskH = this->height(); 3597 DeskH = this->height();
diff --git a/noncore/comm/keypebble/krfbdecoder.cpp b/noncore/comm/keypebble/krfbdecoder.cpp
index d61433f..837fcc5 100644
--- a/noncore/comm/keypebble/krfbdecoder.cpp
+++ b/noncore/comm/keypebble/krfbdecoder.cpp
@@ -22,15 +22,15 @@ const int endianTest = 1;
22 22
23#define Swap16IfLE(s) \ 23#define Swap16IfLE(s) \
24 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) 24 (*(char *)&endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
25 25
26#define Swap32IfLE(l) \ 26#define Swap32IfLE(l) \
27 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \ 27 (*(char *)&endianTest ? ((((l) & 0xff000000) >> 24) | \
28 (((l) & 0x00ff0000) >> 8) | \ 28 (((l) & 0x00ff0000) >> 8) | \
29 (((l) & 0x0000ff00) << 8) | \ 29 (((l) & 0x0000ff00) << 8) | \
30 (((l) & 0x000000ff) << 24)) : (l)) 30 (((l) & 0x000000ff) << 24)) : (l))
31 31
32// 32//
33// The lengths of the messages we need to wait for 33// The lengths of the messages we need to wait for
34// 34//
35const int ServerInitLength = 24; 35const int ServerInitLength = 24;
36const int UpdateHeaderLength = 4; 36const int UpdateHeaderLength = 4;
@@ -137,25 +137,25 @@ void KRFBDecoder::start()
137 137
138void KRFBDecoder::sendClientInit() 138void KRFBDecoder::sendClientInit()
139{ 139{
140 con->write( &( con->options()->shared ), 1 ); 140 con->write( &( con->options()->shared ), 1 );
141 141
142 // Wait for server init 142 // Wait for server init
143 owarn << "Waiting for server init" << oendl; 143 owarn << "Waiting for server init" << oendl;
144 144
145 static QString statusMsg = tr( "Waiting for server initialization..." ); 145 static QString statusMsg = tr( "Waiting for server initialization..." );
146 emit status( statusMsg ); 146 emit status( statusMsg );
147 147
148 currentState = AwaitingServerInit; 148 currentState = AwaitingServerInit;
149 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerInit() ) ); 149 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerInit() ) );
150 con->waitForData( ServerInitLength ); 150 con->waitForData( ServerInitLength );
151} 151}
152 152
153void KRFBDecoder::gotServerInit() 153void KRFBDecoder::gotServerInit()
154{ 154{
155 owarn << "Got server init" << oendl; 155 owarn << "Got server init" << oendl;
156 disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) ); 156 disconnect( con, SIGNAL( gotEnoughData() ), this, SLOT( gotServerInit() ) );
157 157
158 if ( info ) 158 if ( info )
159 delete info; 159 delete info;
160 info = new KRFBServerInfo; 160 info = new KRFBServerInfo;
161 CHECK_PTR( info ); 161 CHECK_PTR( info );
@@ -183,24 +183,23 @@ void KRFBDecoder::gotServerInit()
183 183
184 con->read( info->padding, 3 ); 184 con->read( info->padding, 3 );
185 185
186 con->read( &(info->nameLength), 4 ); 186 con->read( &(info->nameLength), 4 );
187 info->nameLength = Swap32IfLE( info->nameLength ); 187 info->nameLength = Swap32IfLE( info->nameLength );
188 188
189 owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl; 189 owarn << "Width = " << info->width << ", Height = " << info->height << "" << oendl;
190 qWarning( "Bpp = %d, Depth = %d, Big = %d, True = %d", 190 owarn << "Bpp = " << info->bpp << ", Depth = " << info->depth << ", Big = " << info->bigEndian
191 info->bpp, info->depth, info->bigEndian, info->trueColor ); 191 << ", True = " << info->trueColor << oendl;
192 qWarning( "RedMax = %d, GreenMax = %d, BlueMax = %d", 192 owarn << "RedMax = " << info->redMax << ", GreenMax = " << info->greenMax << ", BlueMax = " << info->blueMax << oendl;
193 info->redMax, info->greenMax, info->blueMax ); 193 owarn << "RedShift = " << info->redShift << ", GreenShift = " << info->greenShift
194 qWarning( "RedShift = %d, GreenShift = %d, BlueShift = %d", 194 << ", BlueShift = " << info-> blueShift << oendl;
195 info->redShift, info->greenShift,info-> blueShift );
196 195
197 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor); 196 buf->resize( info->width/con->options()->scaleFactor, info->height /con->options()->scaleFactor);
198 197
199 // Wait for desktop name 198 // Wait for desktop name
200 owarn << "Waiting for desktop name" << oendl; 199 owarn << "Waiting for desktop name" << oendl;
201 200
202 static QString statusMsg = tr( "Waiting for desktop name..." ); 201 static QString statusMsg = tr( "Waiting for desktop name..." );
203 emit status( statusMsg ); 202 emit status( statusMsg );
204 203
205 currentState = AwaitingDesktopName; 204 currentState = AwaitingDesktopName;
206 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) ); 205 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotDesktopName() ) );
@@ -209,25 +208,25 @@ void KRFBDecoder::gotServerInit()
209 208
210void KRFBDecoder::gotDesktopName() 209void KRFBDecoder::gotDesktopName()
211{ 210{
212 assert( info ); 211 assert( info );
213 assert( currentState == AwaitingDesktopName ); 212 assert( currentState == AwaitingDesktopName );
214 213
215 owarn << "Got desktop name" << oendl; 214 owarn << "Got desktop name" << oendl;
216 215
217 disconnect( con, SIGNAL( gotEnoughData() ), 216 disconnect( con, SIGNAL( gotEnoughData() ),
218 this, SLOT( gotDesktopName() ) ); 217 this, SLOT( gotDesktopName() ) );
219 218
220 char *buf = new char[ info->nameLength + 1 ]; 219 char *buf = new char[ info->nameLength + 1 ];
221 CHECK_PTR( buf ); 220 CHECK_PTR( buf );
222 221
223 con->read( buf, info->nameLength ); 222 con->read( buf, info->nameLength );
224 buf[ info->nameLength ] = '\0'; 223 buf[ info->nameLength ] = '\0';
225 info->name = buf; 224 info->name = buf;
226 225
227 owarn << "Desktop: " << info->name.latin1() << "" << oendl; 226 owarn << "Desktop: " << info->name.latin1() << "" << oendl;
228 227
229 delete buf; 228 delete buf;
230 229
231 // Get the format we'll really use and tell the server 230 // Get the format we'll really use and tell the server
232 decidePixelFormat(); 231 decidePixelFormat();
233 sendPixelFormat(); 232 sendPixelFormat();
@@ -261,18 +260,15 @@ void KRFBDecoder::decidePixelFormat()
261 260
262 if ( con->options()->colors256 ) 261 if ( con->options()->colors256 )
263 chosenDepth = 8; 262 chosenDepth = 8;
264 else 263 else
265 chosenDepth = bestDepth; 264 chosenDepth = bestDepth;
266 265
267 qWarning( "Screen depth=%d, server depth=%d, best depth=%d, " \ 266 owarn << "Screen depth=" << screenDepth << ", server depth=" << info->depth
268 "eight bit %d, chosenDepth=%d", 267 << ", best depth=" << bestDepth << "eight bit " << con->options()->colors256
269 screenDepth, 268 << ", chosenDepth=" << chosenDepth << oendl;
270 info->depth,
271 bestDepth,
272 con->options()->colors256, chosenDepth );
273 269
274 format->depth = chosenDepth; 270 format->depth = chosenDepth;
275 271
276 // If we're using the servers native depth 272 // If we're using the servers native depth
277 if ( chosenDepth == info->depth ) { 273 if ( chosenDepth == info->depth ) {
278 // Use the servers native format 274 // Use the servers native format
@@ -373,16 +369,16 @@ void KRFBDecoder::sendUpdateRequest( bool incremental )
373} 369}
374 370
375void KRFBDecoder::gotUpdateHeader() 371void KRFBDecoder::gotUpdateHeader()
376{ 372{
377 assert( currentState == AwaitingUpdate ); 373 assert( currentState == AwaitingUpdate );
378 374
379 // owarn << "Got update header" << oendl; 375 // owarn << "Got update header" << oendl;
380 376
381 disconnect( con, SIGNAL( gotEnoughData() ), 377 disconnect( con, SIGNAL( gotEnoughData() ),
382 this, SLOT( gotUpdateHeader() ) ); 378 this, SLOT( gotUpdateHeader() ) );
383 379
384 CARD8 msgType; 380 CARD8 msgType;
385 con->read( &msgType, 1 ); 381 con->read( &msgType, 1 );
386 382
387 if ( msgType != UpdateId ) { 383 if ( msgType != UpdateId ) {
388 // We might have a bell or server cut 384 // We might have a bell or server cut
@@ -408,28 +404,28 @@ void KRFBDecoder::gotUpdateHeader()
408 CARD8 padding; 404 CARD8 padding;
409 con->read( &padding, 1 ); 405 con->read( &padding, 1 );
410 406
411 con->read( &noRects, 2 ); 407 con->read( &noRects, 2 );
412 noRects = Swap16IfLE( noRects ); 408 noRects = Swap16IfLE( noRects );
413 409
414 // owarn << "Expecting " << noRects << " rects" << oendl; 410 // owarn << "Expecting " << noRects << " rects" << oendl;
415 411
416 // Now wait for the data 412 // Now wait for the data
417 currentState = AwaitingRectHeader; 413 currentState = AwaitingRectHeader;
418 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); 414 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
419 con->waitForData( RectHeaderLength ); 415 con->waitForData( RectHeaderLength );
420} 416}
421 417
422void KRFBDecoder::gotRectHeader() 418void KRFBDecoder::gotRectHeader()
423{ 419{
424 assert( currentState == AwaitingRectHeader ); 420 assert( currentState == AwaitingRectHeader );
425 421
426 // owarn << "Got rect header" << oendl; 422 // owarn << "Got rect header" << oendl;
427 423
428 disconnect( con, SIGNAL( gotEnoughData() ), 424 disconnect( con, SIGNAL( gotEnoughData() ),
429 this, SLOT( gotRectHeader() ) ); 425 this, SLOT( gotRectHeader() ) );
430 426
431 con->read( &x, 2 ); 427 con->read( &x, 2 );
432 x = Swap16IfLE( x ); 428 x = Swap16IfLE( x );
433 con->read( &y, 2 ); 429 con->read( &y, 2 );
434 y = Swap16IfLE( y ); 430 y = Swap16IfLE( y );
435 431
@@ -438,47 +434,47 @@ void KRFBDecoder::gotRectHeader()
438 con->read( &h, 2 ); 434 con->read( &h, 2 );
439 h = Swap16IfLE( h ); 435 h = Swap16IfLE( h );
440 436
441 con->read( &encoding, 4 ); 437 con->read( &encoding, 4 );
442 438
443 // CARD32 encodingLocal = Swap32IfLE( encoding ); 439 // CARD32 encodingLocal = Swap32IfLE( encoding );
444 // qWarning( "Rect: x=%d, y= %d, w=%d, h=%d, encoding=%ld", 440 // owarn << "Rect: x=" << x << ", y= " << y << ", w=" << w << ", h=" << h
445 // x, y, w, h, encodingLocal ); 441 // << ", encoding= " << encodingLocal << oendl;
446 442
447 // 443 //
448 // Each encoding needs to be handled differently. Some require 444 // Each encoding needs to be handled differently. Some require
449 // waiting for more data, but others like a copyrect do not. 445 // waiting for more data, but others like a copyrect do not.
450 // Our constants have already been byte swapped, so we use 446 // Our constants have already been byte swapped, so we use
451 // the remote value as is. 447 // the remote value as is.
452 // 448 //
453 if ( encoding == RawEncoding ) { 449 if ( encoding == RawEncoding ) {
454 // owarn << "Raw encoding" << oendl; 450 // owarn << "Raw encoding" << oendl;
455 handleRawRect(); 451 handleRawRect();
456 } 452 }
457 else if ( encoding == CopyRectEncoding ) { 453 else if ( encoding == CopyRectEncoding ) {
458// owarn << "CopyRect encoding" << oendl; 454// owarn << "CopyRect encoding" << oendl;
459 handleCopyRect(); 455 handleCopyRect();
460 } 456 }
461 else if ( encoding == RreEncoding ) { 457 else if ( encoding == RreEncoding ) {
462 owarn << "RRE encoding" << oendl; 458 owarn << "RRE encoding" << oendl;
463 handleRRERect(); 459 handleRRERect();
464 } 460 }
465 else if ( encoding == CorreEncoding ) { 461 else if ( encoding == CorreEncoding ) {
466 owarn << "CoRRE encoding" << oendl; 462 owarn << "CoRRE encoding" << oendl;
467 handleCoRRERect(); 463 handleCoRRERect();
468 } 464 }
469 else if ( encoding == HexTileEncoding ) { 465 else if ( encoding == HexTileEncoding ) {
470 owarn << "HexTile encoding" << oendl; 466 owarn << "HexTile encoding" << oendl;
471 handleHexTileRect(); 467 handleHexTileRect();
472 } 468 }
473 else { 469 else {
474 int msg = Swap32IfLE( encoding ); 470 int msg = Swap32IfLE( encoding );
475 QString protocolError = tr( "Protocol Error: An unknown encoding was " 471 QString protocolError = tr( "Protocol Error: An unknown encoding was "
476 "used by the server %1" ).arg( msg ); 472 "used by the server %1" ).arg( msg );
477 currentState = Error; 473 currentState = Error;
478 owarn << "Unknown encoding, " << msg << "" << oendl; 474 owarn << "Unknown encoding, " << msg << "" << oendl;
479 emit error( protocolError ); 475 emit error( protocolError );
480 return; 476 return;
481 } 477 }
482} 478}
483 479
484// 480//
@@ -488,13 +484,13 @@ void KRFBDecoder::gotRectHeader()
488void KRFBDecoder::handleRawRect() 484void KRFBDecoder::handleRawRect()
489{ 485{
490 // We need something a bit cleverer here to handle large 486 // We need something a bit cleverer here to handle large
491 // rectanges nicely. The chunking should be based on the 487 // rectanges nicely. The chunking should be based on the
492 // overall size (but has to be in complete lines). 488 // overall size (but has to be in complete lines).
493 489
494 // owarn << "Handling a raw rect chunk" << oendl; 490 // owarn << "Handling a raw rect chunk" << oendl;
495 491
496 // CARD32 lineCount = w * format->bpp / 8; 492 // CARD32 lineCount = w * format->bpp / 8;
497 493
498 if ( h > RectChunkSize ) { 494 if ( h > RectChunkSize ) {
499 // if ( con->sock->size() / lineCount ) { 495 // if ( con->sock->size() / lineCount ) {
500 // getRawRectChunk( con->sock->size() / lineCount ); 496 // getRawRectChunk( con->sock->size() / lineCount );
@@ -511,13 +507,13 @@ void KRFBDecoder::handleRawRect()
511void KRFBDecoder::getRawRectChunk( int lines ) 507void KRFBDecoder::getRawRectChunk( int lines )
512{ 508{
513 this->lines = lines; 509 this->lines = lines;
514 CARD32 count = lines * w * format->bpp / 8; 510 CARD32 count = lines * w * format->bpp / 8;
515 511
516 // Wait for server init 512 // Wait for server init
517 // owarn << "Waiting for raw rect chunk, " << count << "" << oendl; 513 // owarn << "Waiting for raw rect chunk, " << count << "" << oendl;
518 514
519 currentState = AwaitingRawRectChunk; 515 currentState = AwaitingRawRectChunk;
520 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) ); 516 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRawRectChunk() ) );
521 con->waitForData( count ); 517 con->waitForData( count );
522} 518}
523 519
@@ -525,13 +521,13 @@ void KRFBDecoder::gotRawRectChunk()
525{ 521{
526 assert( currentState == AwaitingRawRectChunk ); 522 assert( currentState == AwaitingRawRectChunk );
527 523
528 disconnect( con, SIGNAL( gotEnoughData() ), 524 disconnect( con, SIGNAL( gotEnoughData() ),
529 this, SLOT( gotRawRectChunk() ) ); 525 this, SLOT( gotRawRectChunk() ) );
530 526
531 // owarn << "Got raw rect chunk" << oendl; 527 // owarn << "Got raw rect chunk" << oendl;
532 528
533 // 529 //
534 // Read the rect data and copy it to the buffer. 530 // Read the rect data and copy it to the buffer.
535 // 531 //
536 532
537 // TODO: Replace this! 533 // TODO: Replace this!
@@ -548,13 +544,13 @@ void KRFBDecoder::gotRawRectChunk()
548 if ( h > 0 ) { 544 if ( h > 0 ) {
549 handleRawRect(); 545 handleRawRect();
550 } 546 }
551 else { 547 else {
552 noRects--; 548 noRects--;
553 549
554 // owarn << "There are " << noRects << " rects left" << oendl; 550 // owarn << "There are " << noRects << " rects left" << oendl;
555 551
556 if ( noRects ) { 552 if ( noRects ) {
557 currentState = AwaitingRectHeader; 553 currentState = AwaitingRectHeader;
558 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); 554 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
559 con->waitForData( RectHeaderLength ); 555 con->waitForData( RectHeaderLength );
560 } 556 }
@@ -592,36 +588,36 @@ void KRFBDecoder::gotCopyRectPos()
592 srcY = Swap16IfLE( srcY ); 588 srcY = Swap16IfLE( srcY );
593 589
594 buf->copyRect( srcX, srcY, x, y, w, h ); 590 buf->copyRect( srcX, srcY, x, y, w, h );
595 591
596 noRects--; 592 noRects--;
597 593
598 // owarn << "There are " << noRects << " rects left" << oendl; 594 // owarn << "There are " << noRects << " rects left" << oendl;
599 595
600 if ( noRects ) { 596 if ( noRects ) {
601 currentState = AwaitingRectHeader; 597 currentState = AwaitingRectHeader;
602 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) ); 598 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotRectHeader() ) );
603 con->waitForData( RectHeaderLength ); 599 con->waitForData( RectHeaderLength );
604 } 600 }
605 else 601 else
606 currentState = Idle; 602 currentState = Idle;
607} 603}
608 604
609void KRFBDecoder::handleRRERect() 605void KRFBDecoder::handleRRERect()
610{ 606{
611 owarn << "RRE not implemented" << oendl; 607 owarn << "RRE not implemented" << oendl;
612} 608}
613 609
614void KRFBDecoder::handleCoRRERect() 610void KRFBDecoder::handleCoRRERect()
615{ 611{
616 owarn << "CoRRE not implemented" << oendl; 612 owarn << "CoRRE not implemented" << oendl;
617} 613}
618 614
619void KRFBDecoder::handleHexTileRect() 615void KRFBDecoder::handleHexTileRect()
620{ 616{
621 owarn << "HexTile not implemented" << oendl; 617 owarn << "HexTile not implemented" << oendl;
622} 618}
623 619
624void KRFBDecoder::sendMouseEvent( QMouseEvent *e ) 620void KRFBDecoder::sendMouseEvent( QMouseEvent *e )
625{ 621{
626 // Deal with the buttons 622 // Deal with the buttons
627 if ( e->type() != QEvent::MouseMove ) { 623 if ( e->type() != QEvent::MouseMove ) {
@@ -641,15 +637,15 @@ void KRFBDecoder::sendMouseEvent( QMouseEvent *e )
641 buttonMask |= 0x03; 637 buttonMask |= 0x03;
642 if ( e->button() & RightButton ) 638 if ( e->button() & RightButton )
643 buttonMask |= 0x05; 639 buttonMask |= 0x05;
644 } 640 }
645 } 641 }
646 642
647 // HACK: Scaling 643 // HACK: Scaling
648 CARD16 x = Swap16IfLE( e->x() * con->options()->scaleFactor ); 644 CARD16 x = Swap16IfLE( e->x() * con->options()->scaleFactor );
649 CARD16 y = Swap16IfLE( e->y() *con->options()->scaleFactor ); 645 CARD16 y = Swap16IfLE( e->y() * con->options()->scaleFactor );
650 646
651 con->write( &PointerEventId, 1 ); 647 con->write( &PointerEventId, 1 );
652 con->write( &buttonMask, 1 ); 648 con->write( &buttonMask, 1 );
653 con->write( &x, 2 ); 649 con->write( &x, 2 );
654 con->write( &y, 2 ); 650 con->write( &y, 2 );
655} 651}
@@ -675,13 +671,13 @@ void KRFBDecoder::sendCutEvent( const QString &unicode )
675 con->write( &length, 4 ); 671 con->write( &length, 4 );
676 con->write( text.data(), length ); 672 con->write( text.data(), length );
677} 673}
678 674
679void KRFBDecoder::gotServerCut() 675void KRFBDecoder::gotServerCut()
680{ 676{
681 owarn << "Got server cut" << oendl; 677 owarn << "Got server cut" << oendl;
682 678
683 currentState = AwaitingServerCutLength; 679 currentState = AwaitingServerCutLength;
684 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) ); 680 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotServerCutLength() ) );
685 con->waitForData( ServerCutLenLength ); 681 con->waitForData( ServerCutLenLength );
686} 682}
687 683
@@ -723,13 +719,13 @@ void KRFBDecoder::gotServerCutText()
723 719
724 con->read( cutbuf, serverCutTextLen ); 720 con->read( cutbuf, serverCutTextLen );
725 cutbuf[ serverCutTextLen ] = '\0'; 721 cutbuf[ serverCutTextLen ] = '\0';
726 722
727 /* For some reason QApplication::clipboard()->setText() segfaults when called 723 /* For some reason QApplication::clipboard()->setText() segfaults when called
728 * from within keypebble's mass of signals and slots 724 * from within keypebble's mass of signals and slots
729 owarn << "Server cut: " << cutbuf << "" << oendl; 725 owarn << "Server cut: " << cutbuf << "" << oendl;
730 726
731 QString cutText( cutbuf ); // DANGER!! 727 QString cutText( cutbuf ); // DANGER!!
732 qApp->clipboard()->setText( cutText ); 728 qApp->clipboard()->setText( cutText );
733 */ 729 */
734 730
735 delete cutbuf; 731 delete cutbuf;
@@ -740,33 +736,33 @@ void KRFBDecoder::gotServerCutText()
740 con->waitForData( UpdateHeaderLength ); 736 con->waitForData( UpdateHeaderLength );
741 } 737 }
742 else if ( oldState == Idle ) { 738 else if ( oldState == Idle ) {
743 currentState = Idle; 739 currentState = Idle;
744 } 740 }
745 else { 741 else {
746 owarn << "Async handled in weird state" << oendl; 742 owarn << "Async handled in weird state" << oendl;
747 currentState = oldState; 743 currentState = oldState;
748 }; 744 };
749} 745}
750 746
751void KRFBDecoder::gotBell() 747void KRFBDecoder::gotBell()
752{ 748{
753 owarn << "Got server bell" << oendl; 749 owarn << "Got server bell" << oendl;
754 buf->soundBell(); 750 buf->soundBell();
755 751
756 // Now wait for the update (again) 752 // Now wait for the update (again)
757 if ( oldState == AwaitingUpdate ) { 753 if ( oldState == AwaitingUpdate ) {
758 currentState = AwaitingUpdate; 754 currentState = AwaitingUpdate;
759 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) ); 755 connect( con, SIGNAL( gotEnoughData() ), SLOT( gotUpdateHeader() ) );
760 con->waitForData( UpdateHeaderLength ); 756 con->waitForData( UpdateHeaderLength );
761 } 757 }
762 else if ( oldState == Idle ) { 758 else if ( oldState == Idle ) {
763 currentState = Idle; 759 currentState = Idle;
764 } 760 }
765 else { 761 else {
766 owarn << "Async handled in weird state" << oendl; 762 owarn << "Async handled in weird state" << oendl;
767 currentState = oldState; 763 currentState = oldState;
768 }; 764 };
769} 765}
770 766
771void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event ) 767void KRFBDecoder::sendKeyPressEvent( QKeyEvent *event )
772{ 768{
@@ -816,17 +812,17 @@ int KRFBDecoder::toKeySym( QKeyEvent *k )
816{ 812{
817 813
818 // 814 //
819 // Try and map these "other common keys" first. 815 // Try and map these "other common keys" first.
820 // 816 //
821 if ((k->key() >= Qt::Key_Escape) && (k->key() <= Qt::Key_F12)) { 817 if ((k->key() >= Qt::Key_Escape) && (k->key() <= Qt::Key_F12)) {
822 for(int i = 0; keyMap[i].keycode != 0; i++) { 818 for(int i = 0; keyMap[i].keycode != 0; i++) {
823 if (k->key() == keyMap[i].keycode) { 819 if (k->key() == keyMap[i].keycode) {
824 return keyMap[i].keysym; 820 return keyMap[i].keysym;
825 } 821 }
826 } 822 }
827 } 823 }
828 824
829 // 825 //
830 // If these keys aren't matched, return the ascii code and let the 826 // If these keys aren't matched, return the ascii code and let the
831 // server figure it out. We don't return k->key(), as the data in 827 // server figure it out. We don't return k->key(), as the data in
832 // key differs between input methods, and we don't want special cases. 828 // key differs between input methods, and we don't want special cases.
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 6c5f5ea..211314b 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -107,15 +107,15 @@ namespace {
107 { 107 {
108 m_Pixset = true; 108 m_Pixset = true;
109 calcRect(text()); 109 calcRect(text());
110 } 110 }
111 111
112 inline QPixmap* IconViewItem::pixmap()const { 112 inline QPixmap* IconViewItem::pixmap()const {
113// qWarning( "Name is " + m_path.right( 15 ) + " rect is %d %d %d %d | %d %d", 113// owarn << "Name is " << m_path.right( 15 ) << " rect is " << rect().x() << " " << rect().y()
114// rect().x(),rect().y(),rect().width(),rect().height(), 114// << " " << rect().width() << " " << rect().height() << " | " << iconView()->contentsX()
115// iconView()->contentsX(), iconView()->contentsY()); 115// << " " << iconView()->contentsY() << oendl;
116 116
117 if (textOnly()&&!m_isDir) { 117 if (textOnly()&&!m_isDir) {
118 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1); 118 if (!_emptyPix) _emptyPix = new QPixmap(0,0,1);
119 return _emptyPix; 119 return _emptyPix;
120 } 120 }
121 if ( m_isDir ) 121 if ( m_isDir )
diff --git a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
index 36e5dcf..aa15d31 100644
--- a/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
+++ b/noncore/graphics/opie-eye/gui/viewmodebutton.cpp
@@ -1,10 +1,13 @@
1#include "viewmodebutton.h" 1#include "viewmodebutton.h"
2 2
3/* OPIE */
3#include <opie2/odebug.h> 4#include <opie2/odebug.h>
5using namespace Opie::Core;
4 6
7/* QT */
5#include <qtoolbar.h> 8#include <qtoolbar.h>
6#include <qpopupmenu.h> 9#include <qpopupmenu.h>
7 10
8ViewModeButton::ViewModeButton( QToolBar* bar,int def ) 11ViewModeButton::ViewModeButton( QToolBar* bar,int def )
9 : QToolButton( bar ) 12 : QToolButton( bar )
10{ 13{
@@ -37,9 +40,9 @@ void ViewModeButton::slotChange( int i ) {
37 break; 40 break;
38 case 3: 41 case 3:
39 name = "opie-eye/opie-eye-textview"; 42 name = "opie-eye/opie-eye-textview";
40 break; 43 break;
41 } 44 }
42 45
43 qWarning("foo %d" +name, i ); 46 owarn << "foo " << name << oendl;
44 setIconSet( Resource::loadIconSet( name ) ); 47 setIconSet( Resource::loadIconSet( name ) );
45} 48}
diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc
index 04c50d9..f81066e 100644
--- a/noncore/net/opietooth/lib/device.cc
+++ b/noncore/net/opietooth/lib/device.cc
@@ -1,152 +1,157 @@
1 1
2#include <signal.h> 2#include "device.h"
3 3
4/* OPIE */
4#include <opie2/oprocess.h> 5#include <opie2/oprocess.h>
6#include <opie2/odebug.h>
7using namespace Opie::Core;
8
9/* STD */
10#include <signal.h>
5 11
6#include "device.h"
7 12
8using namespace OpieTooth; 13using namespace OpieTooth;
9 14
10using Opie::Core::OProcess; 15using Opie::Core::OProcess;
11namespace { 16namespace {
12 int parsePid( const QCString& par ){ 17 int parsePid( const QCString& par ){
13 int id=0; 18 int id=0;
14 QString string( par ); 19 QString string( par );
15 QStringList list = QStringList::split( '\n', string ); 20 QStringList list = QStringList::split( '\n', string );
16 for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ 21 for( QStringList::Iterator it = list.begin(); it != list.end(); ++it ){
17 qWarning("parsePID: %s", (*it).latin1() ); 22 owarn << "parsePID: " << (*it).latin1() << oendl;
18 if( !(*it).startsWith("CSR") ){ 23 if( !(*it).startsWith("CSR") ){
19 id = (*it).toInt(); 24 id = (*it).toInt();
20 break; 25 break;
21 } 26 }
22 } 27 }
23 return id; 28 return id;
24 } 29 }
25} 30}
26 31
27Device::Device(const QString &device, const QString &mode, const QString &speed ) 32Device::Device(const QString &device, const QString &mode, const QString &speed )
28 : QObject(0, "device") { 33 : QObject(0, "device") {
29 34
30 qWarning("OpieTooth::Device create" ); 35 owarn << "OpieTooth::Device create" << oendl;
31 m_hci = 0; 36 m_hci = 0;
32 m_process = 0; 37 m_process = 0;
33 m_attached = false; 38 m_attached = false;
34 m_device = device; 39 m_device = device;
35 m_mode = mode; 40 m_mode = mode;
36 m_speed = speed; 41 m_speed = speed;
37 attach(); 42 attach();
38} 43}
39Device::~Device(){ 44Device::~Device(){
40 detach(); 45 detach();
41} 46}
42void Device::attach(){ 47void Device::attach(){
43 qWarning("attaching %s %s %s", m_device.latin1(), m_mode.latin1(), m_speed.latin1() ); 48 owarn << "attaching " << m_device.latin1() << " " << m_mode.latin1() << " " << m_speed.latin1() << oendl;
44 if(m_process == 0 ){ 49 if(m_process == 0 ){
45 m_output.resize(0); 50 m_output.resize(0);
46 qWarning("new process to create" ); 51 owarn << "new process to create" << oendl;
47 m_process = new OProcess(); 52 m_process = new OProcess();
48 *m_process << "hciattach"; 53 *m_process << "hciattach";
49 *m_process << "-p"; 54 *m_process << "-p";
50 *m_process << m_device << m_mode << m_speed; 55 *m_process << m_device << m_mode << m_speed;
51 connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ), 56 connect(m_process, SIGNAL( processExited(Opie::Core::OProcess*) ),
52 this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); 57 this, SLOT( slotExited(Opie::Core::OProcess* ) ) );
53 connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ), 58 connect(m_process, SIGNAL( receivedStdout(Opie::Core::OProcess*, char*, int) ),
54 this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int ) ) ); 59 this, SLOT(slotStdOut(Opie::Core::OProcess*,char*,int ) ) );
55 connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ), 60 connect(m_process, SIGNAL(receivedStderr(Opie::Core::OProcess*, char*, int ) ),
56 this, SLOT(slotStdErr(Opie::Core::OProcess*,char*,int) ) ); 61 this, SLOT(slotStdErr(Opie::Core::OProcess*,char*,int) ) );
57 if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){ 62 if(!m_process->start(OProcess::NotifyOnExit, OProcess::AllOutput ) ){
58 qWarning("Could not start" ); 63 owarn << "Could not start" << oendl;
59 delete m_process; 64 delete m_process;
60 m_process = 0; 65 m_process = 0;
61 } 66 }
62 }; 67 };
63} 68}
64void Device::detach(){ 69void Device::detach(){
65 delete m_hci; 70 delete m_hci;
66 delete m_process; 71 delete m_process;
67 // kill the pid we got 72 // kill the pid we got
68 if(m_attached ){ 73 if(m_attached ){
69 //kill the pid 74 //kill the pid
70 qWarning( "killing" ); 75 warn << "killing" << oendl;
71 kill(pid, 9); 76 kill(pid, 9);
72 } 77 }
73 qWarning("detached" ); 78 owarn << "detached" << oendl;
74} 79}
75bool Device::isLoaded()const{ 80bool Device::isLoaded()const{
76 return m_attached; 81 return m_attached;
77} 82}
78QString Device::devName()const { 83QString Device::devName()const {
79 return QString::fromLatin1("hci0"); 84 return QString::fromLatin1("hci0");
80}; 85};
81void Device::slotExited( OProcess* proc) 86void Device::slotExited( OProcess* proc)
82{ 87{
83 qWarning("prcess exited" ); 88 owarn << "prcess exited" << oendl;
84 if(proc== m_process ){ 89 if(proc== m_process ){
85 qWarning("proc == m_process" ); 90 owarn << "proc == m_process" << oendl;
86 if( m_process->normalExit() ){ // normal exit 91 if( m_process->normalExit() ){ // normal exit
87 qWarning("normalExit" ); 92 owarn << "normalExit" << oendl;
88 int ret = m_process->exitStatus(); 93 int ret = m_process->exitStatus();
89 if( ret == 0 ){ // attached 94 if( ret == 0 ){ // attached
90 qWarning("attached" ); 95 owarn << "attached" << oendl;
91 qWarning("Output: %s", m_output.data() ); 96 owarn << "Output: " << m_output.data() << oendl;
92 pid = parsePid( m_output ); 97 pid = parsePid( m_output );
93 qWarning("Pid = %d", pid ); 98 owarn << "Pid = " << pid << oendl;
94 // now hciconfig hci0 up ( determine hciX FIXME) 99 // now hciconfig hci0 up ( determine hciX FIXME)
95 // and call hciconfig hci0 up 100 // and call hciconfig hci0 up
96 // FIXME hardcoded to hci0 now :( 101 // FIXME hardcoded to hci0 now :(
97 m_hci = new OProcess( ); 102 m_hci = new OProcess( );
98 *m_hci << "hciconfig"; 103 *m_hci << "hciconfig";
99 *m_hci << "hci0 up"; 104 *m_hci << "hci0 up";
100 connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), 105 connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ),
101 this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); 106 this, SLOT( slotExited(Opie::Core::OProcess* ) ) );
102 if(!m_hci->start() ){ 107 if(!m_hci->start() ){
103 qWarning("could not start" ); 108 owarn << "could not start" << oendl;
104 m_attached = false; 109 m_attached = false;
105 emit device("hci0", false ); 110 emit device("hci0", false );
106 } 111 }
107 }else{ 112 }else{
108 qWarning("crass" ); 113 owarn << "crass" << oendl;
109 m_attached = false; 114 m_attached = false;
110 emit device("hci0", false ); 115 emit device("hci0", false );
111 116
112 } 117 }
113 } 118 }
114 delete m_process; 119 delete m_process;
115 m_process = 0; 120 m_process = 0;
116 }else if(proc== m_hci ){ 121 }else if(proc== m_hci ){
117 qWarning("M HCI exited" ); 122 owarn << "M HCI exited" << oendl;
118 if( m_hci->normalExit() ){ 123 if( m_hci->normalExit() ){
119 qWarning("normal exit" ); 124 owarn << "normal exit" << oendl;
120 int ret = m_hci->exitStatus(); 125 int ret = m_hci->exitStatus();
121 if( ret == 0 ){ 126 if( ret == 0 ){
122 qWarning("attached really really attached" ); 127 owarn << "attached really really attached" << oendl;
123 m_attached = true; 128 m_attached = true;
124 emit device("hci0", true ); 129 emit device("hci0", true );
125 }else{ 130 }else{
126 qWarning( "failed" ); 131 owarn << "failed" << oendl;
127 emit device("hci0", false ); 132 emit device("hci0", false );
128 m_attached = false; 133 m_attached = false;
129 } 134 }
130 }// normal exit 135 }// normal exit
131 delete m_hci; 136 delete m_hci;
132 m_hci = 0; 137 m_hci = 0;
133 } 138 }
134} 139}
135void Device::slotStdOut(OProcess* proc, char* chars, int len) 140void Device::slotStdOut(OProcess* proc, char* chars, int len)
136{ 141{
137 qWarning("std out" ); 142 owarn << "std out" << oendl;
138 if( len <1 ){ 143 if( len <1 ){
139 qWarning( "len < 1 " ); 144 owarn << "len < 1 " << oendl;
140 return; 145 return;
141 } 146 }
142 if(proc == m_process ){ 147 if(proc == m_process ){
143 QCString string( chars, len+1 ); // \0 == +1 148 QCString string( chars, len+1 ); // \0 == +1
144 qWarning("output: %s", string.data() ); 149 owarn << "output: " << string.data() << oendl;
145 m_output.append( string.data() ); 150 m_output.append( string.data() );
146 } 151 }
147} 152}
148void Device::slotStdErr(OProcess* proc, char* chars, int len) 153void Device::slotStdErr(OProcess* proc, char* chars, int len)
149{ 154{
150 qWarning("std err" ); 155 owarn << "std err" << oendl;
151 slotStdOut( proc, chars, len ); 156 slotStdOut( proc, chars, len );
152} 157}
diff --git a/noncore/net/opietooth/lib/manager.cc b/noncore/net/opietooth/lib/manager.cc
index 18e1df9..76d9127 100644
--- a/noncore/net/opietooth/lib/manager.cc
+++ b/noncore/net/opietooth/lib/manager.cc
@@ -1,21 +1,22 @@
1 1
2
3#include <opie2/oprocess.h>
4
5#include "parser.h" 2#include "parser.h"
6#include "manager.h" 3#include "manager.h"
7 4
5#include <opie2/oprocess.h>
6#include <opie2/odebug.h>
7using namespace Opie::Core;
8
8 9
9using namespace OpieTooth; 10using namespace OpieTooth;
10 11
11using Opie::Core::OProcess; 12using Opie::Core::OProcess;
12Manager::Manager( const QString& dev ) 13Manager::Manager( const QString& dev )
13 : QObject() 14 : QObject()
14{ 15{
15 qWarning("created"); 16 owarn << "created" << oendl;
16 m_device = dev; 17 m_device = dev;
17 m_hcitool = 0; 18 m_hcitool = 0;
18 m_sdp = 0; 19 m_sdp = 0;
19} 20}
20Manager::Manager( Device* /*dev*/ ) 21Manager::Manager( Device* /*dev*/ )
21 : QObject() 22 : QObject()
@@ -54,22 +55,22 @@ void Manager::isAvailable( const QString& device ){
54 55
55void Manager::isAvailable( Device* /*dev*/ ){ 56void Manager::isAvailable( Device* /*dev*/ ){
56 57
57 58
58} 59}
59void Manager::searchDevices( const QString& device ){ 60void Manager::searchDevices( const QString& device ){
60 qWarning("search devices"); 61 owarn << "search devices" << oendl;
61 OProcess* hcitool = new OProcess(); 62 OProcess* hcitool = new OProcess();
62 hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() ); 63 hcitool->setName( device.isEmpty() ? "hci0" : device.latin1() );
63 *hcitool << "hcitool" << "scan"; 64 *hcitool << "hcitool" << "scan";
64 connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) , 65 connect( hcitool, SIGNAL(processExited(Opie::Core::OProcess*) ) ,
65 this, SLOT(slotHCIExited(Opie::Core::OProcess* ) ) ); 66 this, SLOT(slotHCIExited(Opie::Core::OProcess* ) ) );
66 connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), 67 connect( hcitool, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
67 this, SLOT(slotHCIOut(Opie::Core::OProcess*, char*, int ) ) ); 68 this, SLOT(slotHCIOut(Opie::Core::OProcess*, char*, int ) ) );
68 if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 69 if (!hcitool->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
69 qWarning("could not start"); 70 owarn << "could not start" << oendl;
70 RemoteDevice::ValueList list; 71 RemoteDevice::ValueList list;
71 emit foundDevices( device, list ); 72 emit foundDevices( device, list );
72 delete hcitool; 73 delete hcitool;
73 } 74 }
74} 75}
75 76
@@ -104,19 +105,19 @@ void Manager::removeServices( const QStringList& list){
104 removeService( (*it) ); 105 removeService( (*it) );
105} 106}
106void Manager::searchServices( const QString& remDevice ){ 107void Manager::searchServices( const QString& remDevice ){
107 OProcess *m_sdp =new OProcess(); 108 OProcess *m_sdp =new OProcess();
108 *m_sdp << "sdptool" << "browse" << remDevice; 109 *m_sdp << "sdptool" << "browse" << remDevice;
109 m_sdp->setName( remDevice.latin1() ); 110 m_sdp->setName( remDevice.latin1() );
110 qWarning("search Services for %s", remDevice.latin1() ); 111 owarn << "search Services for " << remDevice.latin1() << oendl;
111 connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ), 112 connect(m_sdp, SIGNAL(processExited(Opie::Core::OProcess*) ),
112 this, SLOT(slotSDPExited(Opie::Core::OProcess* ) ) ); 113 this, SLOT(slotSDPExited(Opie::Core::OProcess* ) ) );
113 connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ), 114 connect(m_sdp, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int ) ),
114 this, SLOT(slotSDPOut(Opie::Core::OProcess*, char*, int) ) ); 115 this, SLOT(slotSDPOut(Opie::Core::OProcess*, char*, int) ) );
115 if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) { 116 if (!m_sdp->start(OProcess::NotifyOnExit, OProcess::AllOutput) ) {
116 qWarning("could not start sdptool" ); 117 owarn << "could not start sdptool" << oendl;
117 delete m_sdp; 118 delete m_sdp;
118 Services::ValueList list; 119 Services::ValueList list;
119 emit foundServices( remDevice, list ); 120 emit foundServices( remDevice, list );
120 } 121 }
121} 122}
122void Manager::searchServices( const RemoteDevice& dev){ 123void Manager::searchServices( const RemoteDevice& dev){
@@ -137,91 +138,91 @@ void Manager::slotProcessExited(OProcess* proc ) {
137 emit available( name, conn ); 138 emit available( name, conn );
138 delete proc; 139 delete proc;
139} 140}
140void Manager::slotSDPOut(OProcess* proc, char* ch, int len) 141void Manager::slotSDPOut(OProcess* proc, char* ch, int len)
141{ 142{
142 QCString str(ch, len+1 ); 143 QCString str(ch, len+1 );
143 qWarning("SDP:%s", str.data() ); 144 owarn << "SDP:" << str.data() << oendl;
144 QMap<QString, QString>::Iterator it; 145 QMap<QString, QString>::Iterator it;
145 it = m_out.find(proc->name() ); 146 it = m_out.find(proc->name() );
146 QString string; 147 QString string;
147 if ( it != m_out.end() ) { 148 if ( it != m_out.end() ) {
148 string = it.data(); 149 string = it.data();
149 } 150 }
150 string.append( str ); 151 string.append( str );
151 m_out.replace( proc->name(), string ); 152 m_out.replace( proc->name(), string );
152 153
153} 154}
154void Manager::slotSDPExited( OProcess* proc) 155void Manager::slotSDPExited( OProcess* proc)
155{ 156{
156 qWarning("proc name %s", proc->name() ); 157 owarn << "proc name " << proc->name() << oendl;
157 Services::ValueList list; 158 Services::ValueList list;
158 if (proc->normalExit() ) { 159 if (proc->normalExit() ) {
159 QMap<QString, QString>::Iterator it = m_out.find( proc->name() ); 160 QMap<QString, QString>::Iterator it = m_out.find( proc->name() );
160 if ( it != m_out.end() ) { 161 if ( it != m_out.end() ) {
161 qWarning("found process" ); 162 owarn << "found process" << oendl;
162 list = parseSDPOutput( it.data() ); 163 list = parseSDPOutput( it.data() );
163 m_out.remove( it ); 164 m_out.remove( it );
164 } 165 }
165 } 166 }
166 emit foundServices( proc->name(), list ); 167 emit foundServices( proc->name(), list );
167 delete proc; 168 delete proc;
168} 169}
169Services::ValueList Manager::parseSDPOutput( const QString& out ) { 170Services::ValueList Manager::parseSDPOutput( const QString& out ) {
170 Services::ValueList list; 171 Services::ValueList list;
171 qWarning("parsing output" ); 172 owarn << "parsing output" << oendl;
172 Parser parser( out ); 173 Parser parser( out );
173 list = parser.services(); 174 list = parser.services();
174 return list; 175 return list;
175} 176}
176 177
177void Manager::slotHCIExited(OProcess* proc ) { 178void Manager::slotHCIExited(OProcess* proc ) {
178 qWarning("process exited"); 179 owarn << "process exited" << oendl;
179 RemoteDevice::ValueList list; 180 RemoteDevice::ValueList list;
180 if (proc->normalExit() ) { 181 if (proc->normalExit() ) {
181 qWarning("normalExit %s", proc->name() ); 182 owarn << "normalExit " << proc->name() << oendl;
182 QMap<QString, QString>::Iterator it = m_devices.find(proc->name() ); 183 QMap<QString, QString>::Iterator it = m_devices.find(proc->name() );
183 if (it != m_devices.end() ) { 184 if (it != m_devices.end() ) {
184 qWarning("!= end ;)"); 185 owarn << "!= end ;)" << oendl;
185 list = parseHCIOutput( it.data() ); 186 list = parseHCIOutput( it.data() );
186 m_devices.remove( it ); 187 m_devices.remove( it );
187 } 188 }
188 } 189 }
189 emit foundDevices( proc->name(), list ); 190 emit foundDevices( proc->name(), list );
190 delete proc; 191 delete proc;
191} 192}
192void Manager::slotHCIOut(OProcess* proc, char* ch, int len) { 193void Manager::slotHCIOut(OProcess* proc, char* ch, int len) {
193 QCString str( ch, len+1 ); 194 QCString str( ch, len+1 );
194 qWarning("hci: %s", str.data() ); 195 owarn << "hci: " << str.data() oendl;
195 QMap<QString, QString>::Iterator it; 196 QMap<QString, QString>::Iterator it;
196 it = m_devices.find( proc->name() ); 197 it = m_devices.find( proc->name() );
197 qWarning("proc->name %s", proc->name() ); 198 owarn << "proc->name " << proc->name() << oendl;
198 QString string; 199 QString string;
199 if (it != m_devices.end() ) { 200 if (it != m_devices.end() ) {
200 qWarning("slotHCIOut "); 201 owarn << "slotHCIOut " << oendl;
201 string = it.data(); 202 string = it.data();
202 } 203 }
203 string.append( str ); 204 string.append( str );
204 205
205 m_devices.replace( proc->name(), string ); 206 m_devices.replace( proc->name(), string );
206} 207}
207RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) { 208RemoteDevice::ValueList Manager::parseHCIOutput(const QString& output ) {
208 qWarning("parseHCI %s", output.latin1() ); 209 owarn << "parseHCI " << output.latin1() << oendl;
209 RemoteDevice::ValueList list; 210 RemoteDevice::ValueList list;
210 QStringList strList = QStringList::split('\n', output ); 211 QStringList strList = QStringList::split('\n', output );
211 QStringList::Iterator it; 212 QStringList::Iterator it;
212 QString str; 213 QString str;
213 for ( it = strList.begin(); it != strList.end(); ++it ) { 214 for ( it = strList.begin(); it != strList.end(); ++it ) {
214 str = (*it).stripWhiteSpace(); 215 str = (*it).stripWhiteSpace();
215 qWarning("OpieTooth %s", str.latin1() ); 216 owarn << "OpieTooth " << str.latin1() << oendl;
216 int pos = str.findRev(':' ); 217 int pos = str.findRev(':' );
217 if ( pos > 0 ) { 218 if ( pos > 0 ) {
218 QString mac = str.left(17 ); 219 QString mac = str.left(17 );
219 str.remove( 0, 17 ); 220 str.remove( 0, 17 );
220 qWarning("mac %s", mac.latin1() ); 221 owarn << "mac " << mac.latin1() << oendl;
221 qWarning("rest:%s", str.latin1() ); 222 owarn << "rest: " << str.latin1() << oendl;
222 RemoteDevice rem( mac , str.stripWhiteSpace() ); 223 RemoteDevice rem( mac , str.stripWhiteSpace() );
223 list.append( rem ); 224 list.append( rem );
224 } 225 }
225 } 226 }
226 return list; 227 return list;
227} 228}
@@ -240,13 +241,13 @@ void Manager::connectTo( const QString& mac) {
240 proc << mac; 241 proc << mac;
241 proc.start(OProcess::DontCare); // the lib does not care at this point 242 proc.start(OProcess::DontCare); // the lib does not care at this point
242} 243}
243 244
244 245
245void Manager::searchConnections() { 246void Manager::searchConnections() {
246 qWarning("searching connections?"); 247 owarn << "searching connections?" << oendl;
247 OProcess* proc = new OProcess(); 248 OProcess* proc = new OProcess();
248 m_hcitoolCon = QString::null; 249 m_hcitoolCon = QString::null;
249 250
250 connect(proc, SIGNAL(processExited(Opie::Core::OProcess*) ), 251 connect(proc, SIGNAL(processExited(Opie::Core::OProcess*) ),
251 this, SLOT(slotConnectionExited( Opie::Core::OProcess*) ) ); 252 this, SLOT(slotConnectionExited( Opie::Core::OProcess*) ) );
252 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ), 253 connect(proc, SIGNAL(receivedStdout(Opie::Core::OProcess*, char*, int) ),
@@ -278,21 +279,21 @@ ConnectionState::ValueList Manager::parseConnections( const QString& out ) {
278 // remove the first line ( "Connections:") 279 // remove the first line ( "Connections:")
279 it = list.begin(); 280 it = list.begin();
280 it = list.remove( it ); 281 it = list.remove( it );
281 for (; it != list.end(); ++it ) { 282 for (; it != list.end(); ++it ) {
282 QString row = (*it).stripWhiteSpace(); 283 QString row = (*it).stripWhiteSpace();
283 QStringList value = QStringList::split(' ', row ); 284 QStringList value = QStringList::split(' ', row );
284 qWarning("0: %s", value[0].latin1() ); 285 owan << "0: %s" << value[0].latin1() << oendl;
285 qWarning("1: %s", value[1].latin1() ); 286 owan << "1: %s" << value[1].latin1() << oendl;
286 qWarning("2: %s", value[2].latin1() ); 287 owan << "2: %s" << value[2].latin1() << oendl;
287 qWarning("3: %s", value[3].latin1() ); 288 owan << "3: %s" << value[3].latin1() << oendl;
288 qWarning("4: %s", value[4].latin1() ); 289 owan << "4: %s" << value[4].latin1() << oendl;
289 qWarning("5: %s", value[5].latin1() ); 290 owan << "5: %s" << value[5].latin1() << oendl;
290 qWarning("6: %s", value[6].latin1() ); 291 owan << "6: %s" << value[6].latin1() << oendl;
291 qWarning("7: %s", value[7].latin1() ); 292 owan << "7: %s" << value[7].latin1() << oendl;
292 qWarning("8: %s", value[8].latin1() ); 293 owan << "8: %s" << value[8].latin1() << oendl;
293 ConnectionState con; 294 ConnectionState con;
294 con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming ); 295 con.setDirection( value[0] == QString::fromLatin1("<") ? Outgoing : Incoming );
295 con.setConnectionMode( value[1] ); 296 con.setConnectionMode( value[1] );
296 con.setMac( value[2] ); 297 con.setMac( value[2] );
297 con.setHandle( value[4].toInt() ); 298 con.setHandle( value[4].toInt() );
298 con.setState( value[6].toInt() ); 299 con.setState( value[6].toInt() );
diff --git a/noncore/net/opietooth/lib/parser.cc b/noncore/net/opietooth/lib/parser.cc
index 8baf284..7e95907 100644
--- a/noncore/net/opietooth/lib/parser.cc
+++ b/noncore/net/opietooth/lib/parser.cc
@@ -1,44 +1,50 @@
1 1
2#include "parser.h"
3
4/* OPIE */
5#include <opie2/odebug.h>
6using namespace Opie::Core;
7
8/* QT */
2#include <qstringlist.h> 9#include <qstringlist.h>
3 10
4#include "parser.h"
5 11
6using namespace OpieTooth; 12using namespace OpieTooth;
7 13
8namespace { 14namespace {
9 15
10 16
11 // "Test Foo Bar" (0x3456) 17 // "Test Foo Bar" (0x3456)
12 // @param ret Test Foo Bar 18 // @param ret Test Foo Bar
13 // @eturn 13398 19 // @eturn 13398
14 // tactic find " ( 20 // tactic find " (
15int convert( const QString& line, QString& ret ) { 21int convert( const QString& line, QString& ret ) {
16// qWarning("called"); 22// owarn << "called" << oendl;
17 ret = QString::null; 23 ret = QString::null;
18 int i = 0; 24 int i = 0;
19 int pos = line.findRev("\" ("); 25 int pos = line.findRev("\" (");
20 if ( pos > 0 ) { // it shouldn't be at pos 0 26 if ( pos > 0 ) { // it shouldn't be at pos 0
21 ret = line.left(pos ).stripWhiteSpace(); 27 ret = line.left(pos ).stripWhiteSpace();
22 // qWarning("ret: %s", ret.latin1() ); 28 // owarn << "ret: " << ret.latin1() << oendl;
23 ret = ret.replace(QRegExp("[\"]"), ""); 29 ret = ret.replace(QRegExp("[\"]"), "");
24 //qWarning("ret: %s", ret.latin1() ); 30 //owarn << "ret: " << ret.latin1() << oendl;
25 QString dummy = line.mid(pos + 5 ); 31 QString dummy = line.mid(pos + 5 );
26 //qWarning("dummy: %s", dummy.latin1() ); 32 //owarn << "dummy: " << dummy.latin1() << oendl;
27 dummy = dummy.replace(QRegExp("[)]"), ""); 33 dummy = dummy.replace(QRegExp("[)]"), "");
28 //qWarning("dummy: %s", dummy.latin1() ); 34 //owarn << "dummy: " << dummy.latin1() << oendl;
29// dummy = dummy.remove( dummy.length() -2, 1 ); // remove the ) 35// dummy = dummy.remove( dummy.length() -2, 1 ); // remove the )
30 bool ok; 36 bool ok;
31 i = dummy.toInt(&ok, 16 ); 37 i = dummy.toInt(&ok, 16 );
32 //if (ok ) { 38 //if (ok ) {
33 // qWarning("converted %d", i); 39 // owarn << "converted " << i << oendl;
34 //}else qWarning("failed" ); 40 //}else owarn << "failed" << oendl;
35 //qWarning("exiting"); 41 //owarn << "exiting" << oendl;
36 return i; 42 return i;
37 } 43 }
38 //qWarning("output %d", i ); 44 //owarn << "output " << i << oendl;
39 return i; 45 return i;
40} 46}
41 47
42}; 48};
43 49
44 50
@@ -54,17 +60,17 @@ Services::ValueList Parser::services() const {
54void Parser::parse( const QString& string) { 60void Parser::parse( const QString& string) {
55 m_list.clear(); 61 m_list.clear();
56 m_complete = true; 62 m_complete = true;
57 QStringList list = QStringList::split('\n', string,TRUE ); 63 QStringList list = QStringList::split('\n', string,TRUE );
58 QStringList::Iterator it; 64 QStringList::Iterator it;
59 for (it = list.begin(); it != list.end(); ++it ) { 65 for (it = list.begin(); it != list.end(); ++it ) {
60 //qWarning("line:%s:line", (*it).latin1() ); 66 //owarn << "line:" << (*it).latin1() << oendl;
61 if ( (*it).startsWith("Browsing") ) continue; 67 if ( (*it).startsWith("Browsing") ) continue;
62 68
63 if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins 69 if ( (*it).stripWhiteSpace().isEmpty() ) { // line is empty because a new Service begins
64 qWarning("could add"); 70 owarn << "could add" << oendl;
65 // now see if complete and add 71 // now see if complete and add
66 if (m_complete ) { 72 if (m_complete ) {
67 if (!m_item.serviceName().isEmpty() ) 73 if (!m_item.serviceName().isEmpty() )
68 m_list.append( m_item ); 74 m_list.append( m_item );
69 Services serv; 75 Services serv;
70 m_item = serv; 76 m_item = serv;
@@ -77,95 +83,95 @@ void Parser::parse( const QString& string) {
77 if (parseClassId( (*it) ) ) ;//continue; 83 if (parseClassId( (*it) ) ) ;//continue;
78 if (parseProtocol( (*it) ) ) ;//continue; 84 if (parseProtocol( (*it) ) ) ;//continue;
79 if (parseProfile( (*it) ) ) ;//continue; 85 if (parseProfile( (*it) ) ) ;//continue;
80 } 86 }
81 // missed the last one 87 // missed the last one
82 if (m_complete) { 88 if (m_complete) {
83// qWarning("adding"); 89// owarn << "adding" << oendl;
84 if (!m_item.serviceName().isEmpty() ) 90 if (!m_item.serviceName().isEmpty() )
85 m_list.append(m_item ); 91 m_list.append(m_item );
86 } 92 }
87 QValueList<Services>::Iterator it2; 93 QValueList<Services>::Iterator it2;
88 94
89 if (m_list.isEmpty() ) 95 if (m_list.isEmpty() )
90 qWarning("m_list is empty"); 96 owarn << "m_list is empty" << oendl;
91 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) { 97 for (it2 = m_list.begin(); it2 != m_list.end(); ++it2 ) {
92 qWarning("name %s", (*it2).serviceName().latin1() ); 98 owarn << "name " << (*it2).serviceName().latin1() << oendl;
93 } 99 }
94} 100}
95bool Parser::parseName( const QString& str) { 101bool Parser::parseName( const QString& str) {
96 if (str.startsWith("Service Name:") ) { 102 if (str.startsWith("Service Name:") ) {
97 m_item.setServiceName( str.mid(13).stripWhiteSpace() ); 103 m_item.setServiceName( str.mid(13).stripWhiteSpace() );
98 qWarning(m_item.serviceName() ); 104 owarn << m_item.serviceName() << oendl;
99 return true; 105 return true;
100 } 106 }
101 return false; 107 return false;
102} 108}
103bool Parser::parseRecHandle( const QString& str) { 109bool Parser::parseRecHandle( const QString& str) {
104 if (str.startsWith("Service RecHandle:" ) ) { 110 if (str.startsWith("Service RecHandle:" ) ) {
105 QString out = str.mid(18 ).stripWhiteSpace(); 111 QString out = str.mid(18 ).stripWhiteSpace();
106 qWarning("out %s", out.latin1() ); 112 owarn << "out " << out.latin1() << oendl;
107 int value = out.mid(2).toInt(&m_ok, 16 ); 113 int value = out.mid(2).toInt(&m_ok, 16 );
108 if (m_ok && (value != -1) ) 114 if (m_ok && (value != -1) )
109 m_complete = true; 115 m_complete = true;
110 else 116 else
111 m_complete = false; 117 m_complete = false;
112 qWarning("rec handle %d", value); 118 owarn << "rec handle " << value << oendl;
113 m_item.setRecHandle( value ); 119 m_item.setRecHandle( value );
114 return true; 120 return true;
115 121
116 } 122 }
117 return false; 123 return false;
118} 124}
119bool Parser::parseClassId( const QString& str) { 125bool Parser::parseClassId( const QString& str) {
120 if (str.startsWith("Service Class ID List:") ) { 126 if (str.startsWith("Service Class ID List:") ) {
121 qWarning("found class id" ); 127 owarn << "found class id" << oendl;
122 qWarning("line:%s", str.latin1() ); 128 owarn << "line: " << str.latin1() << oendl;
123 m_classOver = true; 129 m_classOver = true;
124 return true; 130 return true;
125 }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place 131 }else if ( m_classOver && str.startsWith(" " ) ){ // ok now are the informations in place
126 qWarning("line with class id" ); 132 owarn << "line with class id" << oendl;
127 qWarning("%s",str.latin1() ); 133 owarn << str.latin1() << oendl;
128 134
129 // "Obex Object Push" (0x1105) 135 // "Obex Object Push" (0x1105)
130 // find backwards the " and the from 0 to pos and the mid pos+1 136 // find backwards the " and the from 0 to pos and the mid pos+1
131 // then stripWhiteSpace add name replace '"' with "" 137 // then stripWhiteSpace add name replace '"' with ""
132 // and then convert 0x1105 toInt() 138 // and then convert 0x1105 toInt()
133 QString classes; 139 QString classes;
134 int ids; 140 int ids;
135 ids = convert( str, classes ); 141 ids = convert( str, classes );
136 qWarning("ids %d", ids ); 142 owarn << "ids " << ids << oendl;
137 m_item.insertClassId( ids, classes ); 143 m_item.insertClassId( ids, classes );
138 144
139 return true; 145 return true;
140 }else{ 146 }else{
141 qWarning("Else %d", m_classOver ); 147 owarn << "Else " << m_classOver << oendl;
142 m_classOver = false; 148 m_classOver = false;
143 } 149 }
144 return false; 150 return false;
145} 151}
146bool Parser::parseProtocol( const QString& str) { 152bool Parser::parseProtocol( const QString& str) {
147 if (str.startsWith("Protocol Descriptor List:") ) { 153 if (str.startsWith("Protocol Descriptor List:") ) {
148 m_protocolOver = true; 154 m_protocolOver = true;
149 m_protocolAdded = false; 155 m_protocolAdded = false;
150 return true; 156 return true;
151 157
152 }else if (m_protocolOver && str.startsWith(" ") ) { // "L2CAP" (0x0100) 158 }else if (m_protocolOver && str.startsWith(" ") ) { // "L2CAP" (0x0100)
153 qWarning("double protocol filter"); 159 owarn << "double protocol filter" << oendl;
154 160
155 if (!m_protocolAdded ) { // the protocol does neither supply a channel nor port so add it now 161 if (!m_protocolAdded ) { // the protocol does neither supply a channel nor port so add it now
156 Services::ProtocolDescriptor desc( m_protName, m_protId ); 162 Services::ProtocolDescriptor desc( m_protName, m_protId );
157 m_item.insertProtocolDescriptor( desc ); 163 m_item.insertProtocolDescriptor( desc );
158 } 164 }
159 m_protocolAdded = false; 165 m_protocolAdded = false;
160 { // the find function 166 { // the find function
161 m_protId = convert(str, m_protName ); 167 m_protId = convert(str, m_protName );
162 } 168 }
163 return true; 169 return true;
164 }else if (m_protocolOver && str.startsWith(" ") ) { 170 }else if (m_protocolOver && str.startsWith(" ") ) {
165 qWarning("tripple protocol filter"); 171 owarn << "tripple protocol filter" << oendl;
166 m_protocolAdded = true; 172 m_protocolAdded = true;
167 QString dummy = str.stripWhiteSpace(); 173 QString dummy = str.stripWhiteSpace();
168 int pos = dummy.findRev(':'); 174 int pos = dummy.findRev(':');
169 if ( pos > -1 ) { 175 if ( pos > -1 ) {
170 int port = dummy.mid(pos+1 ).stripWhiteSpace().toInt(); 176 int port = dummy.mid(pos+1 ).stripWhiteSpace().toInt();
171 Services::ProtocolDescriptor desc( m_protName, m_protId, port ); 177 Services::ProtocolDescriptor desc( m_protName, m_protId, port );
@@ -184,13 +190,13 @@ bool Parser::parseProfile( const QString& str) {
184 m_profId = convert( str, m_profName ); 190 m_profId = convert( str, m_profName );
185 }else if ( m_profOver && str.startsWith(" ") ) { 191 }else if ( m_profOver && str.startsWith(" ") ) {
186 // now find 192 // now find
187 int pos = str.findRev(':'); 193 int pos = str.findRev(':');
188 if ( pos > 0 ) { 194 if ( pos > 0 ) {
189 int dummy = str.mid(pos+1 ).stripWhiteSpace().toInt(); 195 int dummy = str.mid(pos+1 ).stripWhiteSpace().toInt();
190 qWarning("dummyInt:%d", dummy ); 196 owarn << "dummyInt: " << dummy << oendl;
191 Services::ProfileDescriptor desc( m_profName, m_profId, dummy ); 197 Services::ProfileDescriptor desc( m_profName, m_profId, dummy );
192 m_item.insertProfileDescriptor(desc); 198 m_item.insertProfileDescriptor(desc);
193 } 199 }
194 }else 200 }else
195 m_profOver = false; 201 m_profOver = false;
196 202
diff --git a/noncore/settings/mediummount/mediumglobal.cc b/noncore/settings/mediummount/mediumglobal.cc
index ab0b3af..0c6cf12 100644
--- a/noncore/settings/mediummount/mediumglobal.cc
+++ b/noncore/settings/mediummount/mediumglobal.cc
@@ -1,20 +1,25 @@
1 1
2#include "mediumglobal.h"
3
4/* OPIE */
5#include <opie2/odebug.h>
6using namespace Opie::Core;
7#include <qpe/config.h>
2 8
9/* QT */
3#include <qlineedit.h> 10#include <qlineedit.h>
4#include <qcheckbox.h> 11#include <qcheckbox.h>
5#include <qlabel.h> 12#include <qlabel.h>
6#include <qabstractlayout.h> // spacer item 13#include <qabstractlayout.h> // spacer item
7#include <qlayout.h> 14#include <qlayout.h>
8#include <qframe.h> 15#include <qframe.h>
9#include <qgroupbox.h> 16#include <qgroupbox.h>
10#include <qwhatsthis.h> 17#include <qwhatsthis.h>
11 18
12#include <qpe/config.h>
13 19
14#include "mediumglobal.h"
15 20
16using namespace MediumMountSetting; 21using namespace MediumMountSetting;
17 22
18/* TRANSLATOR MediumMountSetting::MediumGlobalWidget */ 23/* TRANSLATOR MediumMountSetting::MediumGlobalWidget */
19 24
20MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name ) 25MediumGlobalWidget::MediumGlobalWidget(QWidget *wid, const char *name )
@@ -149,13 +154,13 @@ void MediumGlobalWidget::slotGlobalChanged()
149 int mode = GLOBAL_DISABLED; 154 int mode = GLOBAL_DISABLED;
150 bool enabled = false; 155 bool enabled = false;
151 if( ( enabled =m_useglobal->isChecked() ) ){ 156 if( ( enabled =m_useglobal->isChecked() ) ){
152 mode = GLOBAL_ENABLED; 157 mode = GLOBAL_ENABLED;
153 }else 158 }else
154 mode = GLOBAL_DISABLED; 159 mode = GLOBAL_DISABLED;
155 qWarning("enabled = %d", enabled ); 160 owarn << "enabled = " << enabled << oendl;
156 m_all->setEnabled ( enabled ); 161 m_all->setEnabled ( enabled );
157 m_audio->setEnabled( enabled ); 162 m_audio->setEnabled( enabled );
158 m_image->setEnabled( enabled ); 163 m_image->setEnabled( enabled );
159 m_text->setEnabled ( enabled ); 164 m_text->setEnabled ( enabled );
160 m_video->setEnabled ( enabled ); 165 m_video->setEnabled ( enabled );
161 slotAllChanged(); 166 slotAllChanged();
diff --git a/noncore/styles/theme/othemebase.h b/noncore/styles/theme/othemebase.h
index e691692..5519798 100644
--- a/noncore/styles/theme/othemebase.h
+++ b/noncore/styles/theme/othemebase.h
@@ -15,12 +15,17 @@
15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 Boston, MA 02111-1307, USA. 16 Boston, MA 02111-1307, USA.
17*/ 17*/
18#ifndef __OTHEMEBASE_H 18#ifndef __OTHEMEBASE_H
19#define __OTHEMEBASE_H 19#define __OTHEMEBASE_H
20 20
21/* OPIE */
22#include <opie2/odebug.h>
23using namespace Opie::Core;
24
25/* QT */
21#include <qdatetime.h> 26#include <qdatetime.h>
22#include <qtimer.h> 27#include <qtimer.h>
23#include <qwindowsstyle.h> 28#include <qwindowsstyle.h>
24#include <qpixmap.h> 29#include <qpixmap.h>
25#include <qpe/config.h> 30#include <qpe/config.h>
26#include <qimage.h> 31#include <qimage.h>
@@ -36,54 +41,54 @@
36 * 41 *
37 * @author Daniel M. Duley <mosfet@kde.org> 42 * @author Daniel M. Duley <mosfet@kde.org>
38 */ 43 */
39class OThemePixmap : public QPixmap 44class OThemePixmap : public QPixmap
40{ 45{
41public: 46public:
42 enum BorderType{Top = 0, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, 47 enum BorderType{Top = 0, Bottom, Left, Right, TopLeft, TopRight, BottomLeft,
43 BottomRight}; 48 BottomRight};
44 49
45 OThemePixmap( bool timer = true ); 50 OThemePixmap( bool timer = true );
46 OThemePixmap( const OThemePixmap &p ); 51 OThemePixmap( const OThemePixmap &p );
47 ~OThemePixmap(); 52 ~OThemePixmap();
48 QPixmap* border( BorderType type ); 53 QPixmap* border( BorderType type );
49 void setBorder( BorderType type, const QPixmap &p ); 54 void setBorder( BorderType type, const QPixmap &p );
50 void updateAccessed(); 55 void updateAccessed();
51 bool isOld(); 56 bool isOld();
52protected: 57protected:
53 QTime *t; 58 QTime *t;
54 QPixmap *b[ 8 ]; 59 QPixmap *b[ 8 ];
55 60
56private: 61private:
57 class OThemePixmapPrivate; 62 class OThemePixmapPrivate;
58 OThemePixmapPrivate *d; 63 OThemePixmapPrivate *d;
59}; 64};
60 65
61inline QPixmap* OThemePixmap::border( BorderType type ) 66inline QPixmap* OThemePixmap::border( BorderType type )
62{ 67{
63 return ( b[ type ] ); 68 return ( b[ type ] );
64} 69}
65 70
66inline void OThemePixmap::setBorder( BorderType type, const QPixmap &p ) 71inline void OThemePixmap::setBorder( BorderType type, const QPixmap &p )
67{ 72{
68 if ( b[ type ] ) { 73 if ( b[ type ] ) {
69 qWarning( "OThemePixmap: Overwriting existing border!" ); 74 owarn << "OThemePixmap: Overwriting existing border!" << oendl;
70 delete( b[ type ] ); 75 delete( b[ type ] );
71 } 76 }
72 b[ type ] = new QPixmap( p ); 77 b[ type ] = new QPixmap( p );
73} 78}
74 79
75inline void OThemePixmap::updateAccessed() 80inline void OThemePixmap::updateAccessed()
76{ 81{
77 if (t) 82 if (t)
78 t->start(); 83 t->start();
79} 84}
80 85
81inline bool OThemePixmap::isOld() 86inline bool OThemePixmap::isOld()
82{ 87{
83 return ( t ? t->elapsed() >= 300000 : false ); 88 return ( t ? t->elapsed() >= 300000 : false );
84} 89}
85 90
86/** 91/**
87 * A very simple pixmap cache for theme plugins. QPixmapCache is not used 92 * A very simple pixmap cache for theme plugins. QPixmapCache is not used
88 * since it uses QString keys which are not needed. All the information we 93 * since it uses QString keys which are not needed. All the information we
89 * need can be encoded in a numeric key. Using QIntCache instead allows us to 94 * need can be encoded in a numeric key. Using QIntCache instead allows us to
@@ -103,78 +108,78 @@ inline bool OThemePixmap::isOld()
103 * 108 *
104 * @author Daniel M. Duley <mosfet@kde.org> 109 * @author Daniel M. Duley <mosfet@kde.org>
105 * 110 *
106 */ 111 */
107class OThemeCache : public QObject 112class OThemeCache : public QObject
108{ 113{
109 Q_OBJECT 114 Q_OBJECT
110public: 115public:
111 /** 116 /**
112 * The scale hints supported by the cache. Note that Tiled is not here 117 * The scale hints supported by the cache. Note that Tiled is not here
113 * since tiled pixmaps are kept only once in OThemeBase. 118 * since tiled pixmaps are kept only once in OThemeBase.
114 */ 119 */
115 enum ScaleHint{FullScale, HorizontalScale, VerticalScale}; 120 enum ScaleHint{FullScale, HorizontalScale, VerticalScale};
116 /** 121 /**
117 * The constructor. 122 * The constructor.
118 * 123 *
119 * @param maxSize The maximum size of the cache in kilobytes. 124 * @param maxSize The maximum size of the cache in kilobytes.
120 */ 125 */
121 OThemeCache( int maxSize, QObject *parent = 0, const char *name = 0 ); 126 OThemeCache( int maxSize, QObject *parent = 0, const char *name = 0 );
122 /** 127 /**
123 * Inserts a new pixmap into the cache. 128 * Inserts a new pixmap into the cache.
124 * 129 *
125 * @param pixmap The pixmap to insert. 130 * @param pixmap The pixmap to insert.
126 * @param scale The scaling type of the pixmap. 131 * @param scale The scaling type of the pixmap.
127 * @param widgetID The widget ID of the pixmap, usually from OThemeBase's 132 * @param widgetID The widget ID of the pixmap, usually from OThemeBase's
128 * WidgetType enum. 133 * WidgetType enum.
129 * 134 *
130 * @return True if the insert was successful, false otherwise. 135 * @return True if the insert was successful, false otherwise.
131 */ 136 */
132 bool insert( OThemePixmap *pixmap, ScaleHint scale, int widgetID, 137 bool insert( OThemePixmap *pixmap, ScaleHint scale, int widgetID,
133 bool border = false, bool mask = false ); 138 bool border = false, bool mask = false );
134 /** 139 /**
135 * Returns a fully scaled pixmap. 140 * Returns a fully scaled pixmap.
136 * 141 *
137 * @param w The pixmap width to search for. 142 * @param w The pixmap width to search for.
138 * @param h The pixmap height to search for. 143 * @param h The pixmap height to search for.
139 * @param widgetID The widget ID to search for. 144 * @param widgetID The widget ID to search for.
140 * 145 *
141 * @return True if a pixmap matching the width, height, and widget ID of 146 * @return True if a pixmap matching the width, height, and widget ID of
142 * the pixmap exists, NULL otherwise. 147 * the pixmap exists, NULL otherwise.
143 */ 148 */
144 OThemePixmap* pixmap( int w, int h, int widgetID, bool border = false, 149 OThemePixmap* pixmap( int w, int h, int widgetID, bool border = false,
145 bool mask = false ); 150 bool mask = false );
146 /** 151 /**
147 * Returns a horizontally scaled pixmap. 152 * Returns a horizontally scaled pixmap.
148 * 153 *
149 * @param w The pixmap width to search for. 154 * @param w The pixmap width to search for.
150 * @param widgetID The widget ID to search for. 155 * @param widgetID The widget ID to search for.
151 * 156 *
152 * @return True if a pixmap matching the width and widget ID of 157 * @return True if a pixmap matching the width and widget ID of
153 * the pixmap exists, NULL otherwise. 158 * the pixmap exists, NULL otherwise.
154 */ 159 */
155 OThemePixmap* horizontalPixmap( int w, int widgetID ); 160 OThemePixmap* horizontalPixmap( int w, int widgetID );
156 /** 161 /**
157 * Returns a vertically scaled pixmap. 162 * Returns a vertically scaled pixmap.
158 * 163 *
159 * @param h The pixmap height to search for. 164 * @param h The pixmap height to search for.
160 * @param widgetID The widget ID to search for. 165 * @param widgetID The widget ID to search for.
161 * 166 *
162 * @return True if a pixmap matching the height and widget ID of 167 * @return True if a pixmap matching the height and widget ID of
163 * the pixmap exists, NULL otherwise. 168 * the pixmap exists, NULL otherwise.
164 */ 169 */
165 OThemePixmap* verticalPixmap( int h, int widgetID ); 170 OThemePixmap* verticalPixmap( int h, int widgetID );
166protected slots: 171protected slots:
167 void flushTimeout(); 172 void flushTimeout();
168protected: 173protected:
169 QIntCache<OThemePixmap> cache; 174 QIntCache<OThemePixmap> cache;
170 QTimer flushTimer; 175 QTimer flushTimer;
171 176
172private: 177private:
173 class OThemeCachePrivate; 178 class OThemeCachePrivate;
174 OThemeCachePrivate *d; 179 OThemeCachePrivate *d;
175}; 180};
176 181
177 182
178/** 183/**
179 * This is a base class for KDE themed styles. It implements a cache, 184 * This is a base class for KDE themed styles. It implements a cache,
180 * configuration file parsing, pixmap scaling, gradients, and a lot 185 * configuration file parsing, pixmap scaling, gradients, and a lot
@@ -186,554 +191,554 @@ private:
186 * refer to OThemeStyle for a fully themed style you can derive from. 191 * refer to OThemeStyle for a fully themed style you can derive from.
187 * 192 *
188 * @author Daniel M. Duley <mosfet@kde.org> 193 * @author Daniel M. Duley <mosfet@kde.org>
189 */ 194 */
190class OThemeBase: public QWindowsStyle 195class OThemeBase: public QWindowsStyle
191{ 196{
192 Q_OBJECT 197 Q_OBJECT
193public: 198public:
194 /** 199 /**
195 * Constructs a new OThemeBase object. 200 * Constructs a new OThemeBase object.
196 */ 201 */
197 OThemeBase( const QString &configFile ); 202 OThemeBase( const QString &configFile );
198 ~OThemeBase(); 203 ~OThemeBase();
199 /** 204 /**
200 * Describes if a pixmap should be scaled fully, horizontally, vertically, 205 * Describes if a pixmap should be scaled fully, horizontally, vertically,
201 * or not at all and tiled. 206 * or not at all and tiled.
202 */ 207 */
203 enum ScaleHint{FullScale, HorizontalScale, VerticalScale, TileScale}; 208 enum ScaleHint{FullScale, HorizontalScale, VerticalScale, TileScale};
204 /** 209 /**
205 * The default arrow types. 210 * The default arrow types.
206 */ 211 */
207 enum ArrowStyle{MotifArrow, LargeArrow, SmallArrow}; 212 enum ArrowStyle{MotifArrow, LargeArrow, SmallArrow};
208 /** 213 /**
209 * The default frame shading styles. 214 * The default frame shading styles.
210 */ 215 */
211 enum ShadeStyle{Motif, Windows, Next, KDE}; 216 enum ShadeStyle{Motif, Windows, Next, KDE};
212 /** 217 /**
213 * The default scrollbar button layout. BottomLeft is like what Next 218 * The default scrollbar button layout. BottomLeft is like what Next
214 * uses, BottomRight is like Platinum, and Opposite it like Windows and 219 * uses, BottomRight is like Platinum, and Opposite it like Windows and
215 * Motif. 220 * Motif.
216 */ 221 */
217 enum SButton{SBBottomLeft, SBBottomRight, SBOpposite}; 222 enum SButton{SBBottomLeft, SBBottomRight, SBOpposite};
218 /** 223 /**
219 * The gradient types. Horizontal is left to right, Vertical is top to 224 * The gradient types. Horizontal is left to right, Vertical is top to
220 * bottom, and diagonal is upper-left to bottom-right. 225 * bottom, and diagonal is upper-left to bottom-right.
221 */ 226 */
222 enum Gradient{GrNone, GrHorizontal, GrVertical, GrDiagonal, GrPyramid, 227 enum Gradient{GrNone, GrHorizontal, GrVertical, GrDiagonal, GrPyramid,
223 GrRectangle, GrElliptic, GrReverseBevel}; 228 GrRectangle, GrElliptic, GrReverseBevel};
224 /** 229 /**
225 * This provides a list of widget types that OThemeBase recognizes. 230 * This provides a list of widget types that OThemeBase recognizes.
226 */ 231 */
227 /* Internal note: The order here is important. Some widgets inherit 232 /* Internal note: The order here is important. Some widgets inherit
228 * properties. This is usually for when you have two settings for the 233 * properties. This is usually for when you have two settings for the
229 * same widget, ie: on(sunken), and off. The on settings will inherit 234 * same widget, ie: on(sunken), and off. The on settings will inherit
230 * the properties of the off one when nothing is specified in the config. 235 * the properties of the off one when nothing is specified in the config.
231 * 236 *
232 * In order to be able to handle this while still having everything in 237 * In order to be able to handle this while still having everything in
233 * one group that is easy to loop from we have the following order: 238 * one group that is easy to loop from we have the following order:
234 * unsunked(off) items, sunken(on)items, and then the ones that don't 239 * unsunked(off) items, sunken(on)items, and then the ones that don't
235 * matter. INHERIT_ITEMS define the number of widgets that have inheritence 240 * matter. INHERIT_ITEMS define the number of widgets that have inheritence
236 * so if 0 == PushButtonOff then INHERIT_ITEMS should == PushButtonOn 241 * so if 0 == PushButtonOff then INHERIT_ITEMS should == PushButtonOn
237 * and so on. WIDGETS define the total number of widgets. 242 * and so on. WIDGETS define the total number of widgets.
238 */ 243 */
239 enum WidgetType{ 244 enum WidgetType{
240 // Off (unsunken widgets) 245 // Off (unsunken widgets)
241 PushButton = 0, ComboBox, HScrollBarSlider, VScrollBarSlider, Bevel, 246 PushButton = 0, ComboBox, HScrollBarSlider, VScrollBarSlider, Bevel,
242 ToolButton, ScrollButton, HScrollDeco, VScrollDeco, 247 ToolButton, ScrollButton, HScrollDeco, VScrollDeco,
243 ComboDeco, MenuItem, InactiveTab, ArrowUp, ArrowDown, ArrowLeft, 248 ComboDeco, MenuItem, InactiveTab, ArrowUp, ArrowDown, ArrowLeft,
244 ArrowRight, 249 ArrowRight,
245 // On (sunken widgets) 250 // On (sunken widgets)
246 PushButtonDown, ComboBoxDown, HScrollBarSliderDown, 251 PushButtonDown, ComboBoxDown, HScrollBarSliderDown,
247 VScrollBarSliderDown, BevelDown, ToolButtonDown, ScrollButtonDown, 252 VScrollBarSliderDown, BevelDown, ToolButtonDown, ScrollButtonDown,
248 HScrollDecoDown, VScrollDecoDown, ComboDecoDown, MenuItemDown, 253 HScrollDecoDown, VScrollDecoDown, ComboDecoDown, MenuItemDown,
249 ActiveTab, SunkenArrowUp, SunkenArrowDown, SunkenArrowLeft, 254 ActiveTab, SunkenArrowUp, SunkenArrowDown, SunkenArrowLeft,
250 SunkenArrowRight, 255 SunkenArrowRight,
251 // Everything else (indicators must have separate settings) 256 // Everything else (indicators must have separate settings)
252 HScrollGroove, VScrollGroove, Slider, SliderGroove, IndicatorOn, 257 HScrollGroove, VScrollGroove, Slider, SliderGroove, IndicatorOn,
253 IndicatorOff, ExIndicatorOn, ExIndicatorOff, HBarHandle, VBarHandle, 258 IndicatorOff, ExIndicatorOn, ExIndicatorOff, HBarHandle, VBarHandle,
254 ToolBar, Splitter, CheckMark, MenuBar, DisArrowUp, DisArrowDown, 259 ToolBar, Splitter, CheckMark, MenuBar, DisArrowUp, DisArrowDown,
255 DisArrowLeft, DisArrowRight, ProgressBar, ProgressBg, MenuBarItem, 260 DisArrowLeft, DisArrowRight, ProgressBar, ProgressBg, MenuBarItem,
256 Background}; 261 Background};
257 262
258 /** 263 /**
259 * The scaling type specified by the Config file. 264 * The scaling type specified by the Config file.
260 * 265 *
261 * @param widget A Widgets enum value. 266 * @param widget A Widgets enum value.
262 * 267 *
263 * @return A ScaleHint enum value. 268 * @return A ScaleHint enum value.
264 */ 269 */
265 ScaleHint scaleHint( WidgetType widget ) const; 270 ScaleHint scaleHint( WidgetType widget ) const;
266 /** 271 /**
267 * The gradient type specified by the KConfig file. 272 * The gradient type specified by the KConfig file.
268 * 273 *
269 * @param widget A Widgets enum value. 274 * @param widget A Widgets enum value.
270 * 275 *
271 * @return A Gradient enum value. 276 * @return A Gradient enum value.
272 */ 277 */
273 Gradient gradientHint( WidgetType widget ) const; 278 Gradient gradientHint( WidgetType widget ) const;
274 /** 279 /**
275 * The color group specified for a given widget. 280 * The color group specified for a given widget.
276 * If a color group is set in the theme configuration 281 * If a color group is set in the theme configuration
277 * that is used, otherwise defaultColor is returned. 282 * that is used, otherwise defaultColor is returned.
278 * 283 *
279 * @param defaultColor The colorGroup to set if one is available. 284 * @param defaultColor The colorGroup to set if one is available.
280 * 285 *
281 * @param widget The widget whose color group to retrieve. 286 * @param widget The widget whose color group to retrieve.
282 * 287 *
283 */ 288 */
284 const QColorGroup* colorGroup( const QColorGroup &defaultGroup, 289 const QColorGroup* colorGroup( const QColorGroup &defaultGroup,
285 WidgetType widget ) const; 290 WidgetType widget ) const;
286 291
287 QBrush pixmapBrush( const QColorGroup &group, QColorGroup::ColorRole role, 292 QBrush pixmapBrush( const QColorGroup &group, QColorGroup::ColorRole role,
288 int w, int h, WidgetType widget ); 293 int w, int h, WidgetType widget );
289 /** 294 /**
290 * True if the widget has a pixmap or gradient specified. 295 * True if the widget has a pixmap or gradient specified.
291 */ 296 */
292 bool isPixmap( WidgetType widget ) const; 297 bool isPixmap( WidgetType widget ) const;
293 /** 298 /**
294 * True if the widget has a color group specified. 299 * True if the widget has a color group specified.
295 */ 300 */
296 bool isColor( WidgetType widget ) const; 301 bool isColor( WidgetType widget ) const;
297 /** 302 /**
298 * True if the user specified a 3D focus rectangle 303 * True if the user specified a 3D focus rectangle
299 */ 304 */
300 bool is3DFocus() const; 305 bool is3DFocus() const;
301 /** 306 /**
302 * If the user specified a 3D focus rectangle, they may also specify an 307 * If the user specified a 3D focus rectangle, they may also specify an
303 * offset from the default rectangle to use when drawing it. This returns 308 * offset from the default rectangle to use when drawing it. This returns
304 * the specified offset. 309 * the specified offset.
305 */ 310 */
306 int focusOffset() const; 311 int focusOffset() const;
307 /** 312 /**
308 * The border width of the specified widget. 313 * The border width of the specified widget.
309 */ 314 */
310 int borderWidth( WidgetType widget ) const; 315 int borderWidth( WidgetType widget ) const;
311 /** 316 /**
312 * Pixmap border width of the specified widget. 317 * Pixmap border width of the specified widget.
313 */ 318 */
314 int pixBorderWidth( WidgetType widget ) const; 319 int pixBorderWidth( WidgetType widget ) const;
315 /** 320 /**
316 * Returns the border pixmap if enabled for the specified widget. This 321 * Returns the border pixmap if enabled for the specified widget. This
317 * will contain the originial pixmap, plus the edges separated in 322 * will contain the originial pixmap, plus the edges separated in
318 * OThemePixmap::border() if valid. If invalid it will return NULL. 323 * OThemePixmap::border() if valid. If invalid it will return NULL.
319 */ 324 */
320 OThemePixmap* borderPixmap( WidgetType widget ); 325 OThemePixmap* borderPixmap( WidgetType widget );
321 /** 326 /**
322 * The highlight width of the specified widget. 327 * The highlight width of the specified widget.
323 */ 328 */
324 int highlightWidth( WidgetType widget ) const; 329 int highlightWidth( WidgetType widget ) const;
325 /** 330 /**
326 * The border plus highlight width of the widget. 331 * The border plus highlight width of the widget.
327 */ 332 */
328 int decoWidth( WidgetType widget ) const; 333 int decoWidth( WidgetType widget ) const;
329 /** 334 /**
330 * The extent (width for vertical, height for horizontal) requested 335 * The extent (width for vertical, height for horizontal) requested
331 * for the scrollbars. 336 * for the scrollbars.
332 */ 337 */
333 int getSBExtent() const; 338 int getSBExtent() const;
334 /** 339 /**
335 * The scrollbar button layout. 340 * The scrollbar button layout.
336 */ 341 */
337 SButton scrollBarLayout() const; 342 SButton scrollBarLayout() const;
338 /** 343 /**
339 * The arrow type. 344 * The arrow type.
340 */ 345 */
341 ArrowStyle arrowType() const; 346 ArrowStyle arrowType() const;
342 /** 347 /**
343 * The shading type. 348 * The shading type.
344 */ 349 */
345 ShadeStyle shade() const; 350 ShadeStyle shade() const;
346 /** 351 /**
347 * The frame width. 352 * The frame width.
348 */ 353 */
349 int frameWidth() const; 354 int frameWidth() const;
350 /** 355 /**
351 * The splitter width. 356 * The splitter width.
352 */ 357 */
353 int splitWidth() const; 358 int splitWidth() const;
354 /** 359 /**
355 * The contrast for some bevel effects such as reverse gradient. 360 * The contrast for some bevel effects such as reverse gradient.
356 */ 361 */
357 int bevelContrast( WidgetType widget ) const; 362 int bevelContrast( WidgetType widget ) const;
358 /** 363 /**
359 * The button text X shift. 364 * The button text X shift.
360 */ 365 */
361 int buttonXShift() const; 366 int buttonXShift() const;
362 /** 367 /**
363 * The button text Y shift. 368 * The button text Y shift.
364 */ 369 */
365 int buttonYShift() const; 370 int buttonYShift() const;
366 /** 371 /**
367 * Returns either the slider length of the slider pixmap if available, 372 * Returns either the slider length of the slider pixmap if available,
368 * otherwise the length specified in the config file. 373 * otherwise the length specified in the config file.
369 */ 374 */
370 int sliderButtonLength() const; 375 int sliderButtonLength() const;
371 /** 376 /**
372 * True if rounded buttons are requested. 377 * True if rounded buttons are requested.
373 */ 378 */
374 bool roundButton() const; 379 bool roundButton() const;
375 /** 380 /**
376 * True if rounded comboboxes are requested. 381 * True if rounded comboboxes are requested.
377 */ 382 */
378 bool roundComboBox() const; 383 bool roundComboBox() const;
379 /** 384 /**
380 * True if rounded slider grooves are requested. 385 * True if rounded slider grooves are requested.
381 */ 386 */
382 bool roundSlider() const; 387 bool roundSlider() const;
383 /** 388 /**
384 * True if a line should be drawn on the bottom of active tabs. 389 * True if a line should be drawn on the bottom of active tabs.
385 */ 390 */
386 bool activeTabLine() const; 391 bool activeTabLine() const;
387 /** 392 /**
388 * True if a line should be drawn on the bottom of inactive tabs. 393 * True if a line should be drawn on the bottom of inactive tabs.
389 */ 394 */
390 bool inactiveTabLine() const; 395 bool inactiveTabLine() const;
391 /** 396 /**
392 * Returns the current uncached pixmap for the given widget. This will 397 * Returns the current uncached pixmap for the given widget. This will
393 * usually be either the last scaled or gradient pixmap if those have 398 * usually be either the last scaled or gradient pixmap if those have
394 * been specified in the config file, the original pixmap if not, or NULL 399 * been specified in the config file, the original pixmap if not, or NULL
395 * if no pixmap has been specified. 400 * if no pixmap has been specified.
396 */ 401 */
397 OThemePixmap* uncached( WidgetType widget ) const; 402 OThemePixmap* uncached( WidgetType widget ) const;
398 /** 403 /**
399 * Returns the pixmap for the given widget at the specified width and 404 * Returns the pixmap for the given widget at the specified width and
400 * height. This will return NULL if no pixmap or gradient is specified. 405 * height. This will return NULL if no pixmap or gradient is specified.
401 * It may also return a different sized pixmap if the scaling 406 * It may also return a different sized pixmap if the scaling
402 * is set to Tiled. When using this method, you should call it using 407 * is set to Tiled. When using this method, you should call it using
403 * the needed width and height then use QPainter::drawTiledPixmap to 408 * the needed width and height then use QPainter::drawTiledPixmap to
404 * paint it. Doing this, if the pixmap is scaled it will be the proper 409 * paint it. Doing this, if the pixmap is scaled it will be the proper
405 * size, otherwise it will be tiled. 410 * size, otherwise it will be tiled.
406 * 411 *
407 * @param w Requested width. 412 * @param w Requested width.
408 * @param h Requested height. 413 * @param h Requested height.
409 * @param widget Widget type. 414 * @param widget Widget type.
410 * @return The pixmap or NULL if one is not specified. 415 * @return The pixmap or NULL if one is not specified.
411 */ 416 */
412 virtual OThemePixmap *scalePixmap( int w, int h, WidgetType widget ); 417 virtual OThemePixmap *scalePixmap( int w, int h, WidgetType widget );
413 /** 418 /**
414 * This method reads a configuration file and applies it to the user's 419 * This method reads a configuration file and applies it to the user's
415 * kstylerc file. It does not signal applications to reload via the 420 * kstylerc file. It does not signal applications to reload via the
416 * KDEChangeGeneral atom, if you want to do this you must do so yourself. 421 * KDEChangeGeneral atom, if you want to do this you must do so yourself.
417 * See kcmdisplay's general.cpp for an example. 422 * See kcmdisplay's general.cpp for an example.
418 * 423 *
419 * @param file The configuration file to apply. 424 * @param file The configuration file to apply.
420 */ 425 */
421 static void applyConfigFile( const QString &file ); 426 static void applyConfigFile( const QString &file );
422protected: 427protected:
423 /** 428 /**
424 * Returns a QImage for the given widget if the widget is scaled, NULL 429 * Returns a QImage for the given widget if the widget is scaled, NULL
425 * otherwise. QImages of the original pixmap are stored for scaled 430 * otherwise. QImages of the original pixmap are stored for scaled
426 * widgets in order to facilitate fast and accurate smooth-scaling. This 431 * widgets in order to facilitate fast and accurate smooth-scaling. This
427 * also saves us a conversion from a pixmap to an image then back again. 432 * also saves us a conversion from a pixmap to an image then back again.
428 */ 433 */
429 QImage* image( WidgetType widget ) const; 434 QImage* image( WidgetType widget ) const;
430 /** 435 /**
431 * Returns the gradient high color if one is specified, NULL otherwise. 436 * Returns the gradient high color if one is specified, NULL otherwise.
432 */ 437 */
433 QColor* gradientHigh( WidgetType widget ) const; 438 QColor* gradientHigh( WidgetType widget ) const;
434 /** 439 /**
435 * Returns the gradient low color if one is specified, NULL otherwise. 440 * Returns the gradient low color if one is specified, NULL otherwise.
436 */ 441 */
437 QColor* gradientLow( WidgetType widget ) const; 442 QColor* gradientLow( WidgetType widget ) const;
438 /** 443 /**
439 * Reads in all the configuration file entries supported. 444 * Reads in all the configuration file entries supported.
440 * 445 *
441 * @param colorStyle The style for the color groups. In KDE, colors were 446 * @param colorStyle The style for the color groups. In KDE, colors were
442 * calculated a little differently for Motif vs Windows styles. This 447 * calculated a little differently for Motif vs Windows styles. This
443 * is obsolete. 448 * is obsolete.
444 */ 449 */
445 void readConfig( Qt::GUIStyle colorStyle = Qt::WindowsStyle ); 450 void readConfig( Qt::GUIStyle colorStyle = Qt::WindowsStyle );
446 void readWidgetConfig( int i, Config *config, QString *pixnames, 451 void readWidgetConfig( int i, Config *config, QString *pixnames,
447 QString *brdnames, bool *loadArray ); 452 QString *brdnames, bool *loadArray );
448 void copyWidgetConfig( int sourceID, int destID, QString *pixnames, 453 void copyWidgetConfig( int sourceID, int destID, QString *pixnames,
449 QString *brdnames ); 454 QString *brdnames );
450 /** 455 /**
451 * Makes a full color group based on the given foreground and background 456 * Makes a full color group based on the given foreground and background
452 * colors. This is the same code used by KDE (kapp.cpp) in previous 457 * colors. This is the same code used by KDE (kapp.cpp) in previous
453 * versions. 458 * versions.
454 */ 459 */
455 QColorGroup* makeColorGroup( QColor &fg, QColor &bg, 460 QColorGroup* makeColorGroup( QColor &fg, QColor &bg,
456 Qt::GUIStyle style = Qt::WindowsStyle ); 461 Qt::GUIStyle style = Qt::WindowsStyle );
457 OThemePixmap* scale( int w, int h, WidgetType widget ); 462 OThemePixmap* scale( int w, int h, WidgetType widget );
458 OThemePixmap* scaleBorder( int w, int h, WidgetType type ); 463 OThemePixmap* scaleBorder( int w, int h, WidgetType type );
459 OThemePixmap* gradient( int w, int h, WidgetType widget ); 464 OThemePixmap* gradient( int w, int h, WidgetType widget );
460 OThemePixmap* blend( WidgetType widget ); 465 OThemePixmap* blend( WidgetType widget );
461 void generateBorderPix( int i ); 466 void generateBorderPix( int i );
462 void applyResourceGroup( Config *config, int i, QString *copyfrom, QString *pixnames, QString *brdnames ); 467 void applyResourceGroup( Config *config, int i, QString *copyfrom, QString *pixnames, QString *brdnames );
463 void applyMiscResourceGroup( Config *config ); 468 void applyMiscResourceGroup( Config *config );
464 void readResourceGroup( int i, QString *copyfrom, QString *pixnames, QString *brdnames, 469 void readResourceGroup( int i, QString *copyfrom, QString *pixnames, QString *brdnames,
465 bool *loadArray ); 470 bool *loadArray );
466 void readMiscResourceGroup(); 471 void readMiscResourceGroup();
467 /** 472 /**
468 * Attempts to load a pixmap from the default OThemeBase locations. 473 * Attempts to load a pixmap from the default OThemeBase locations.
469 */ 474 */
470 OThemePixmap* loadPixmap( QString &name ); 475 OThemePixmap* loadPixmap( QString &name );
471 /** 476 /**
472 * Attempts to load a image from the default OThemeBase locations. 477 * Attempts to load a image from the default OThemeBase locations.
473 */ 478 */
474 QImage* loadImage( QString &name ); 479 QImage* loadImage( QString &name );
475private: 480private:
476 SButton sbPlacement; 481 SButton sbPlacement;
477 ArrowStyle arrowStyle; 482 ArrowStyle arrowStyle;
478 ShadeStyle shading; 483 ShadeStyle shading;
479 int defaultFrame; 484 int defaultFrame;
480 int btnXShift, btnYShift; 485 int btnXShift, btnYShift;
481 int sliderLen; 486 int sliderLen;
482 int splitterWidth; 487 int splitterWidth;
483 int focus3DOffset; 488 int focus3DOffset;
484 int sbExtent; 489 int sbExtent;
485 bool smallGroove; 490 bool smallGroove;
486 bool roundedButton, roundedCombo, roundedSlider; 491 bool roundedButton, roundedCombo, roundedSlider;
487 bool aTabLine, iTabLine; 492 bool aTabLine, iTabLine;
488 bool focus3D; 493 bool focus3D;
489 OThemeCache *cache; 494 OThemeCache *cache;
490 int cacheSize; 495 int cacheSize;
491 QString configFileName; 496 QString configFileName;
492 QString configFilePath; 497 QString configFilePath;
493 498
494protected: 499protected:
495 QColor fgcolor, bgcolor, selfgcolor, selbgcolor, winfgcolor, winbgcolor; 500 QColor fgcolor, bgcolor, selfgcolor, selbgcolor, winfgcolor, winbgcolor;
496 501
497private: 502private:
498 /** 503 /**
499 * The theme pixmaps. Many of these may be NULL if no pixmap is specified. 504 * The theme pixmaps. Many of these may be NULL if no pixmap is specified.
500 * There may also be duplicate pixmap pointers if more than one widget 505 * There may also be duplicate pixmap pointers if more than one widget
501 * uses the same tiled pixmap. If a pixmap is tiled, it is kept here and 506 * uses the same tiled pixmap. If a pixmap is tiled, it is kept here and
502 * this acts as a cache. Otherwise this will hold whatever the last scaled 507 * this acts as a cache. Otherwise this will hold whatever the last scaled
503 * pixmap was. 508 * pixmap was.
504 */ 509 */
505 OThemePixmap *pixmaps[ WIDGETS ]; 510 OThemePixmap *pixmaps[ WIDGETS ];
506 /** 511 /**
507 * The theme images. These are for scaled images and are kept in order 512 * The theme images. These are for scaled images and are kept in order
508 * to maintain fast smoothscaling. 513 * to maintain fast smoothscaling.
509 */ 514 */
510 QImage *images[ WIDGETS ]; 515 QImage *images[ WIDGETS ];
511 /** 516 /**
512 * The border widths 517 * The border widths
513 */ 518 */
514 unsigned char borders[ WIDGETS ]; 519 unsigned char borders[ WIDGETS ];
515 /** 520 /**
516 * The highlight widths 521 * The highlight widths
517 */ 522 */
518 unsigned char highlights[ WIDGETS ]; 523 unsigned char highlights[ WIDGETS ];
519 /** 524 /**
520 * The scale hints for pixmaps and gradients. 525 * The scale hints for pixmaps and gradients.
521 */ 526 */
522 ScaleHint scaleHints[ WIDGETS ]; 527 ScaleHint scaleHints[ WIDGETS ];
523 /** 528 /**
524 * All the color groups. 529 * All the color groups.
525 */ 530 */
526 QColorGroup *colors[ WIDGETS ]; 531 QColorGroup *colors[ WIDGETS ];
527 /** 532 /**
528 * Gradient low colors (or blend background). 533 * Gradient low colors (or blend background).
529 */ 534 */
530 QColor *grLowColors[ WIDGETS ]; 535 QColor *grLowColors[ WIDGETS ];
531 /** 536 /**
532 * Gradient high colors. 537 * Gradient high colors.
533 */ 538 */
534 QColor *grHighColors[ WIDGETS ]; 539 QColor *grHighColors[ WIDGETS ];
535 /** 540 /**
536 * Gradient types. 541 * Gradient types.
537 */ 542 */
538 Gradient gradients[ WIDGETS ]; 543 Gradient gradients[ WIDGETS ];
539 /** 544 /**
540 * Blend intensity factors 545 * Blend intensity factors
541 */ 546 */
542 float blends[ WIDGETS ]; 547 float blends[ WIDGETS ];
543 /** 548 /**
544 * Bevel contrasts 549 * Bevel contrasts
545 */ 550 */
546 unsigned char bContrasts[ WIDGETS ]; 551 unsigned char bContrasts[ WIDGETS ];
547 /** 552 /**
548 * Duplicate pixmap entries (used during destruction). 553 * Duplicate pixmap entries (used during destruction).
549 */ 554 */
550 bool duplicate[ WIDGETS ]; 555 bool duplicate[ WIDGETS ];
551 /** 556 /**
552 * Pixmapped border widths 557 * Pixmapped border widths
553 */ 558 */
554 int pbWidth[ WIDGETS ]; 559 int pbWidth[ WIDGETS ];
555 /** 560 /**
556 * Pixmapped borders 561 * Pixmapped borders
557 */ 562 */
558 OThemePixmap *pbPixmaps[ WIDGETS ]; 563 OThemePixmap *pbPixmaps[ WIDGETS ];
559 /** 564 /**
560 * Duplicate border pixmapped border entries 565 * Duplicate border pixmapped border entries
561 */ 566 */
562 bool pbDuplicate[ WIDGETS ]; 567 bool pbDuplicate[ WIDGETS ];
563 568
564private: 569private:
565 class OThemeBasePrivate; 570 class OThemeBasePrivate;
566 OThemeBasePrivate *d; 571 OThemeBasePrivate *d;
567 572
568}; 573};
569 574
570inline bool OThemeBase::isPixmap( WidgetType widget ) const 575inline bool OThemeBase::isPixmap( WidgetType widget ) const
571{ 576{
572 return ( pixmaps[ widget ] != NULL || gradients[ widget ] != GrNone ); 577 return ( pixmaps[ widget ] != NULL || gradients[ widget ] != GrNone );
573} 578}
574 579
575inline bool OThemeBase::isColor( WidgetType widget ) const 580inline bool OThemeBase::isColor( WidgetType widget ) const
576{ 581{
577 return ( colors[ widget ] != NULL ); 582 return ( colors[ widget ] != NULL );
578} 583}
579 584
580inline bool OThemeBase::is3DFocus() const 585inline bool OThemeBase::is3DFocus() const
581{ 586{
582 return ( focus3D ); 587 return ( focus3D );
583} 588}
584 589
585inline int OThemeBase::focusOffset() const 590inline int OThemeBase::focusOffset() const
586{ 591{
587 return ( focus3DOffset ); 592 return ( focus3DOffset );
588} 593}
589 594
590inline int OThemeBase::bevelContrast( WidgetType widget ) const 595inline int OThemeBase::bevelContrast( WidgetType widget ) const
591{ 596{
592 return ( bContrasts[ widget ] ); 597 return ( bContrasts[ widget ] );
593} 598}
594 599
595inline OThemeBase::ScaleHint OThemeBase::scaleHint( WidgetType widget ) const 600inline OThemeBase::ScaleHint OThemeBase::scaleHint( WidgetType widget ) const
596{ 601{
597 return ( ( widget < WIDGETS ) ? scaleHints[ widget ] : TileScale ); 602 return ( ( widget < WIDGETS ) ? scaleHints[ widget ] : TileScale );
598} 603}
599 604
600inline OThemeBase::Gradient OThemeBase::gradientHint( WidgetType widget ) const 605inline OThemeBase::Gradient OThemeBase::gradientHint( WidgetType widget ) const
601{ 606{
602 return ( ( widget < WIDGETS ) ? gradients[ widget ] : GrNone ); 607 return ( ( widget < WIDGETS ) ? gradients[ widget ] : GrNone );
603} 608}
604 609
605inline OThemePixmap* OThemeBase::uncached( WidgetType widget ) const 610inline OThemePixmap* OThemeBase::uncached( WidgetType widget ) const
606{ 611{
607 return ( pixmaps[ widget ] ); 612 return ( pixmaps[ widget ] );
608} 613}
609 614
610inline QBrush OThemeBase::pixmapBrush( const QColorGroup &group, 615inline QBrush OThemeBase::pixmapBrush( const QColorGroup &group,
611 QColorGroup::ColorRole role, 616 QColorGroup::ColorRole role,
612 int w, int h, WidgetType widget ) 617 int w, int h, WidgetType widget )
613{ 618{
614 if ( pixmaps[ widget ] || images[ widget ] ) 619 if ( pixmaps[ widget ] || images[ widget ] )
615 return ( QBrush( group.color( role ), *scalePixmap( w, h, widget ) ) ); 620 return ( QBrush( group.color( role ), *scalePixmap( w, h, widget ) ) );
616 else 621 else
617 return ( group.color( role ) ); 622 return ( group.color( role ) );
618} 623}
619 624
620inline const QColorGroup* OThemeBase::colorGroup( const QColorGroup &defaultGroup, 625inline const QColorGroup* OThemeBase::colorGroup( const QColorGroup &defaultGroup,
621 WidgetType widget ) const 626 WidgetType widget ) const
622{ 627{
623 return ( ( colors[ widget ] ) ? colors[ widget ] : &defaultGroup ); 628 return ( ( colors[ widget ] ) ? colors[ widget ] : &defaultGroup );
624} 629}
625 630
626inline int OThemeBase::borderWidth( WidgetType widget ) const 631inline int OThemeBase::borderWidth( WidgetType widget ) const
627{ 632{
628 return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] ); 633 return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] );
629} 634}
630 635
631inline int OThemeBase::pixBorderWidth( WidgetType widget ) const 636inline int OThemeBase::pixBorderWidth( WidgetType widget ) const
632{ 637{
633 return ( pbWidth[ widget ] ); 638 return ( pbWidth[ widget ] );
634} 639}
635 640
636inline int OThemeBase::highlightWidth( WidgetType widget ) const 641inline int OThemeBase::highlightWidth( WidgetType widget ) const
637{ 642{
638 return ( pbWidth[ widget ] ? 0 : highlights[ widget ] ); 643 return ( pbWidth[ widget ] ? 0 : highlights[ widget ] );
639} 644}
640 645
641inline int OThemeBase::decoWidth( WidgetType widget ) const 646inline int OThemeBase::decoWidth( WidgetType widget ) const
642{ 647{
643 return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] + highlights[ widget ] ); 648 return ( pbWidth[ widget ] ? pbWidth[ widget ] : borders[ widget ] + highlights[ widget ] );
644} 649}
645 650
646inline QColor* OThemeBase::gradientHigh( WidgetType widget ) const 651inline QColor* OThemeBase::gradientHigh( WidgetType widget ) const
647{ 652{
648 return ( grHighColors[ widget ] ); 653 return ( grHighColors[ widget ] );
649} 654}
650 655
651inline QColor* OThemeBase::gradientLow( WidgetType widget ) const 656inline QColor* OThemeBase::gradientLow( WidgetType widget ) const
652{ 657{
653 return ( grLowColors[ widget ] ); 658 return ( grLowColors[ widget ] );
654} 659}
655 660
656inline QImage* OThemeBase::image( WidgetType widget ) const 661inline QImage* OThemeBase::image( WidgetType widget ) const
657{ 662{
658 return ( images[ widget ] ); 663 return ( images[ widget ] );
659} 664}
660 665
661inline OThemeBase::SButton OThemeBase::scrollBarLayout() const 666inline OThemeBase::SButton OThemeBase::scrollBarLayout() const
662{ 667{
663 return ( sbPlacement ); 668 return ( sbPlacement );
664} 669}
665 670
666inline OThemeBase::ArrowStyle OThemeBase::arrowType() const 671inline OThemeBase::ArrowStyle OThemeBase::arrowType() const
667{ 672{
668 return ( arrowStyle ); 673 return ( arrowStyle );
669} 674}
670 675
671inline OThemeBase::ShadeStyle OThemeBase::shade() const 676inline OThemeBase::ShadeStyle OThemeBase::shade() const
672{ 677{
673 return ( shading ); 678 return ( shading );
674} 679}
675 680
676inline int OThemeBase::frameWidth() const 681inline int OThemeBase::frameWidth() const
677{ 682{
678 return ( defaultFrame ); 683 return ( defaultFrame );
679} 684}
680 685
681inline int OThemeBase::buttonXShift() const 686inline int OThemeBase::buttonXShift() const
682{ 687{
683 return ( btnXShift ); 688 return ( btnXShift );
684} 689}
685 690
686inline int OThemeBase::splitWidth() const 691inline int OThemeBase::splitWidth() const
687{ 692{
688 return ( splitterWidth ); 693 return ( splitterWidth );
689} 694}
690 695
691inline int OThemeBase::buttonYShift() const 696inline int OThemeBase::buttonYShift() const
692{ 697{
693 return ( btnYShift ); 698 return ( btnYShift );
694} 699}
695 700
696inline int OThemeBase::sliderButtonLength() const 701inline int OThemeBase::sliderButtonLength() const
697{ 702{
698 if ( isPixmap( Slider ) ) 703 if ( isPixmap( Slider ) )
699 return ( uncached( Slider ) ->width() ); 704 return ( uncached( Slider ) ->width() );
700 else 705 else
701 return ( sliderLen ); 706 return ( sliderLen );
702} 707}
703 708
704inline bool OThemeBase::roundButton() const 709inline bool OThemeBase::roundButton() const
705{ 710{
706 return ( roundedButton ); 711 return ( roundedButton );
707} 712}
708 713
709inline bool OThemeBase::roundComboBox() const 714inline bool OThemeBase::roundComboBox() const
710{ 715{
711 return ( roundedCombo ); 716 return ( roundedCombo );
712} 717}
713 718
714inline bool OThemeBase::roundSlider() const 719inline bool OThemeBase::roundSlider() const
715{ 720{
716 return ( roundedSlider ); 721 return ( roundedSlider );
717} 722}
718 723
719inline bool OThemeBase::activeTabLine() const 724inline bool OThemeBase::activeTabLine() const
720{ 725{
721 return ( aTabLine ); 726 return ( aTabLine );
722} 727}
723 728
724inline bool OThemeBase::inactiveTabLine() const 729inline bool OThemeBase::inactiveTabLine() const
725{ 730{
726 return ( iTabLine ); 731 return ( iTabLine );
727} 732}
728 733
729inline int OThemeBase::getSBExtent() const 734inline int OThemeBase::getSBExtent() const
730{ 735{
731 return ( sbExtent ); 736 return ( sbExtent );
732} 737}
733 738
734inline OThemePixmap* OThemeBase::borderPixmap( WidgetType widget ) 739inline OThemePixmap* OThemeBase::borderPixmap( WidgetType widget )
735{ 740{
736 return ( pbPixmaps[ widget ] ); 741 return ( pbPixmaps[ widget ] );
737} 742}
738 743
739#endif 744#endif