summaryrefslogtreecommitdiff
authordrw <drw>2004-02-22 17:54:40 (UTC)
committer drw <drw>2004-02-22 17:54:40 (UTC)
commit8705083d6a267450c71b0276833db5c7238f260e (patch) (unidiff)
tree12cfeab08d8a05808650acb4bc48848633fda63e
parent5b27ef38d45ae4aa751c6e364cb62ed428808e3f (diff)
downloadopie-8705083d6a267450c71b0276833db5c7238f260e.zip
opie-8705083d6a267450c71b0276833db5c7238f260e.tar.gz
opie-8705083d6a267450c71b0276833db5c7238f260e.tar.bz2
libopie2: libopie->libopie2
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp5
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_mail.h4
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_mail.pro2
-rw-r--r--libopie2/examples/opieui/oversatileviewdemo/.cvsignore6
-rw-r--r--libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp40
-rw-r--r--libopie2/opiecore/xmltree.cc11
-rw-r--r--libopie2/templates/cpp.cpp2
7 files changed, 39 insertions, 31 deletions
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp
index 4eaf3a9..a75f9dc 100644
--- a/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp
+++ b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp
@@ -1,46 +1,43 @@
1 1
2#include <qstring.h> 2#include <qstring.h>
3#include <qlabel.h> 3#include <qlabel.h>
4#include <qheader.h> 4#include <qheader.h>
5#include <qlayout.h> 5#include <qlayout.h>
6 6
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8#include <opie/oapplicationfactory.h>
9
10#include "../osplitter.h"
11 8
9#include <opie2/oapplicationfactory.h>
12#include "osplitter_mail.h" 10#include "osplitter_mail.h"
13 11
14
15OPIE_EXPORT_APP( OApplicationFactory<ListViews> ) 12OPIE_EXPORT_APP( OApplicationFactory<ListViews> )
16 13
17class Folder { 14class Folder {
18 int dummy; 15 int dummy;
19}; 16};
20 17
21// ----------------------------------------------------------------- 18// -----------------------------------------------------------------
22 19
23ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) 20ListViews::ListViews( QWidget* p, const char* name, WFlags fl )
24 : QWidget( p, name, fl ) { 21 : QWidget( p, name, fl ) {
25 qApp->installEventFilter( this ); 22 qApp->installEventFilter( this );
26 m_lstFolders.setAutoDelete( true ); 23 m_lstFolders.setAutoDelete( true );
27 QHBoxLayout *lay = new QHBoxLayout(this); 24 QHBoxLayout *lay = new QHBoxLayout(this);
28 25
29 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); 26 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" );
30 lay->addWidget( m_splitter ); 27 lay->addWidget( m_splitter );
31 connect(m_splitter, SIGNAL(sizeChange(bool, const QSize& ) ), 28 connect(m_splitter, SIGNAL(sizeChange(bool, const QSize& ) ),
32 this, SLOT(slotSizeChange(bool, const QSize& ) ) ); 29 this, SLOT(slotSizeChange(bool, const QSize& ) ) );
33 30
34 m_overview = new QListView( m_splitter ); 31 m_overview = new QListView( m_splitter );
35 m_overview->header()->setClickEnabled( FALSE ); 32 m_overview->header()->setClickEnabled( FALSE );
36 m_overview->addColumn( tr("Folder") ); 33 m_overview->addColumn( tr("Folder") );
37 m_overview->setMaximumWidth( 200 ); 34 m_overview->setMaximumWidth( 200 );
38 m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); 35 m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") );
39 m_splitter->setSizeChange( 300 ); 36 m_splitter->setSizeChange( 300 );
40 37
41 /* OSplitter starts with the small mode */ 38 /* OSplitter starts with the small mode */
42 m_messages = 0; 39 m_messages = 0;
43 m_message = m_attach = 0; 40 m_message = m_attach = 0;
44 41
45 splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); 42 splitti = new OSplitter( Vertical, m_splitter, "Splitti2" );
46 splitti->setSizeChange( 300 ); 43 splitti->setSizeChange( 300 );
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_mail.h b/libopie2/examples/opieui/osplitter_example/osplitter_mail.h
index b7e7efe..1447a92 100644
--- a/libopie2/examples/opieui/osplitter_example/osplitter_mail.h
+++ b/libopie2/examples/opieui/osplitter_example/osplitter_mail.h
@@ -1,48 +1,52 @@
1/* 1/*
2 * You may use, modify and distribute this code without any limitation 2 * You may use, modify and distribute this code without any limitation
3 */ 3 */
4 4
5/* 5/*
6 * Header file for a more complete email client like 6 * Header file for a more complete email client like
7 * layout 7 * layout
8 */ 8 */
9 9
10#ifndef OPIE_SPLITTER_MAIL_EXAMPLE_H 10#ifndef OPIE_SPLITTER_MAIL_EXAMPLE_H
11#define OPIE_SPLITTER_MAIL_EXAMPLE_H 11#define OPIE_SPLITTER_MAIL_EXAMPLE_H
12 12
13#include <qwidget.h> 13#include <qwidget.h>
14#include <qlist.h> 14#include <qlist.h>
15#include <qlistview.h> 15#include <qlistview.h>
16 16
17#include <opie2/osplitter.h>
18
19using Opie::OSplitter;
20
17class Folder; 21class Folder;
18class QLabel; 22class QLabel;
19 23
20class OSplitter; 24class OSplitter;
21class ListViews : public QWidget { 25class ListViews : public QWidget {
22 Q_OBJECT 26 Q_OBJECT
23public: 27public:
24 static QString appName() { return QString::fromLatin1("osplitter-mail"); } 28 static QString appName() { return QString::fromLatin1("osplitter-mail"); }
25 ListViews( QWidget* parent, const char * name, WFlags fl ); 29 ListViews( QWidget* parent, const char * name, WFlags fl );
26 ~ListViews(); 30 ~ListViews();
27 31
28 bool eventFilter( QObject* , QEvent* ); 32 bool eventFilter( QObject* , QEvent* );
29private: 33private:
30 void initFolders(); 34 void initFolders();
31 void initFolder( Folder *folder, unsigned int &count ); 35 void initFolder( Folder *folder, unsigned int &count );
32 36
33 QListView *m_messages, *m_overview; 37 QListView *m_messages, *m_overview;
34 QLabel *m_message, *m_attach; 38 QLabel *m_message, *m_attach;
35 QList<QListView> m_folders; // used in tab mode 39 QList<QListView> m_folders; // used in tab mode
36 QList<Folder> m_lstFolders; 40 QList<Folder> m_lstFolders;
37 bool m_mode : 1; // bitfield 41 bool m_mode : 1; // bitfield
38 OSplitter *m_splitter; 42 OSplitter *m_splitter;
39 OSplitter *splitti; 43 OSplitter *splitti;
40 QListView *folder1; 44 QListView *folder1;
41#if 0 45#if 0
42//private slots: 46//private slots:
43// void slotFolderChanged( QListViewItem* ); 47// void slotFolderChanged( QListViewItem* );
44// void slotMessageChanged(); 48// void slotMessageChanged();
45// void slotSizeChange( bool, const QSize& ); 49// void slotSizeChange( bool, const QSize& );
46#endif 50#endif
47}; 51};
48 52
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_mail.pro b/libopie2/examples/opieui/osplitter_example/osplitter_mail.pro
index ec6e626..dd1bef2 100644
--- a/libopie2/examples/opieui/osplitter_example/osplitter_mail.pro
+++ b/libopie2/examples/opieui/osplitter_example/osplitter_mail.pro
@@ -1,12 +1,12 @@
1CONFIG += qt warn_on 1CONFIG += qt warn_on
2TEMPLATE = app 2TEMPLATE = app
3TARGET = osplitter-mail 3TARGET = osplitter-mail
4 4
5INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDSPATH += $(OPIEDIR)/include 6DEPENDSPATH += $(OPIEDIR)/include
7 7
8HEADERS = osplitter_mail.h 8HEADERS = osplitter_mail.h
9SOURCES = osplitter_mail.cpp 9SOURCES = osplitter_mail.cpp
10 10
11LIBS += -lqpe -lopie 11LIBS += -lqpe -lopieui2
12include ( $(OPIEDIR)/include.pro ) 12include ( $(OPIEDIR)/include.pro )
diff --git a/libopie2/examples/opieui/oversatileviewdemo/.cvsignore b/libopie2/examples/opieui/oversatileviewdemo/.cvsignore
new file mode 100644
index 0000000..8f7300c
--- a/dev/null
+++ b/libopie2/examples/opieui/oversatileviewdemo/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6
diff --git a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp
index 197669c..f62729c 100644
--- a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp
+++ b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp
@@ -4,202 +4,202 @@
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14***********************************************************************/ 14***********************************************************************/
15 15
16// Qt 16// Qt
17 17
18#include <qcolor.h> 18#include <qcolor.h>
19#include <qpopupmenu.h> 19#include <qpopupmenu.h>
20#include <qmenubar.h> 20#include <qmenubar.h>
21#include <qmessagebox.h> 21#include <qmessagebox.h>
22#include <qvbox.h> 22#include <qvbox.h>
23#include <qstring.h> 23#include <qstring.h>
24#include <qstringlist.h> 24#include <qstringlist.h>
25 25
26// Qtopia 26// Qtopia
27 27
28#ifdef QWS 28#ifdef QWS
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30#include <qpe/global.h> 30#include <qpe/global.h>
31#endif 31#endif
32 32
33// Opie 33// Opie
34 34
35#ifdef QWS 35#ifdef QWS
36#include <opie/odevice.h> 36#include <opie2/odevice.h>
37using namespace Opie; 37using namespace Opie;
38#endif 38#endif
39 39
40#include <opie2/ocompletionbox.h> 40#include <opie2/ocompletionbox.h>
41#include <opie2/olineedit.h> 41#include <opie2/olineedit.h>
42#include <opie2/ocombobox.h> 42#include <opie2/ocombobox.h>
43#include <opie2/oeditlistbox.h> 43#include <opie2/oeditlistbox.h>
44#include <opie2/oselector.h> 44#include <opie2/oselector.h>
45#include <opie2/opopupmenu.h> 45#include <opie2/opopupmenu.h>
46 46
47#include <qtabwidget.h> 47#include <qtabwidget.h>
48#include "oversatileviewdemo.h" 48#include "oversatileviewdemo.h"
49 49
50// Local 50// Local
51 51
52#include "opieuidemo.h" 52#include "opieuidemo.h"
53 53
54enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector }; 54enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector };
55 55
56OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl ) 56OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl )
57 : QMainWindow( parent, name, fl ) 57 : QMainWindow( parent, name, fl )
58{ 58{
59 59
60 QMenuBar* mbar = this->menuBar(); 60 QMenuBar* mbar = this->menuBar();
61 OPopupMenu* demo = new OPopupMenu( this ); 61 OPopupMenu* demo = new OPopupMenu( this );
62 demo->setTitle( "Title" ); 62 demo->setTitle( "Title" );
63 demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox ); 63 demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox );
64 demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit ); 64 demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit );
65 demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox ); 65 demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox );
66 demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox ); 66 demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox );
67 demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector ); 67 demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector );
68 mbar->insertItem( "Demonstrate", demo ); 68 mbar->insertItem( "Demonstrate", demo );
69 69
70 build(); 70 build();
71 71
72} 72}
73 73
74OpieUIDemo::~OpieUIDemo() 74OpieUIDemo::~OpieUIDemo()
75{ 75{
76} 76}
77 77
78void OpieUIDemo::build() 78void OpieUIDemo::build()
79{ 79{
80 main = new QTabWidget( this, "tabwidget" ); 80 main = new QTabWidget( this, "tabwidget" );
81 setCentralWidget( main ); 81 setCentralWidget( main );
82 main->show(); 82 main->show();
83 83
84 main->addTab( new OVersatileViewDemo( main ), "VersatileView" ); 84 main->addTab( new OVersatileViewDemo( main ), "VersatileView" );
85} 85}
86 86
87 87
88void OpieUIDemo::demo( int d ) 88void OpieUIDemo::demo( int d )
89{ 89{
90 switch (d) 90 switch (d)
91 { 91 {
92 case ocompletionbox: demoOCompletionBox(); break; 92 case ocompletionbox: demoOCompletionBox(); break;
93 case olineedit: demoOLineEdit(); break; 93 case olineedit: demoOLineEdit(); break;
94 case ocombobox: demoOComboBox(); break; 94 case ocombobox: demoOComboBox(); break;
95 case oeditlistbox: demoOEditListBox(); break; 95 case oeditlistbox: demoOEditListBox(); break;
96 case oselector: demoOSelector(); break; 96 case oselector: demoOSelector(); break;
97 97
98 } 98 }
99 99
100} 100}
101 101
102void OpieUIDemo::demoOCompletionBox() 102void OpieUIDemo::demoOCompletionBox()
103{ 103{
104 qDebug( "ocompletionbox" ); 104 qDebug( "ocompletionbox" );
105 105
106 OCompletionBox* box = new OCompletionBox( 0 ); 106 OCompletionBox* box = new OCompletionBox( 0 );
107 box->insertItem( "This CompletionBox" ); 107 box->insertItem( "This CompletionBox" );
108 box->insertItem( "Says 'Hello World'" ); 108 box->insertItem( "Says 'Hello World'" );
109 box->insertItem( "Here are some" ); 109 box->insertItem( "Here are some" );
110 box->insertItem( "Additional Items" ); 110 box->insertItem( "Additional Items" );
111 box->insertItem( "Complete Completion Box" ); 111 box->insertItem( "Complete Completion Box" );
112 112
113 connect( box, SIGNAL( activated( const QString& ) ), this, SLOT( messageBox( const QString& ) ) ); 113 connect( box, SIGNAL( activated( const QString& ) ), this, SLOT( messageBox( const QString& ) ) );
114 box->popup(); 114 box->popup();
115 115
116} 116}
117 117
118void OpieUIDemo::demoOLineEdit() 118void OpieUIDemo::demoOLineEdit()
119{ 119{
120 qDebug( "olineedit" ); 120 qDebug( "olineedit" );
121 121
122 OLineEdit *edit = new OLineEdit( 0, "lineedit" ); 122 OLineEdit *edit = new OLineEdit( 0, "lineedit" );
123 123
124 edit->setCompletionMode( OGlobalSettings::CompletionPopup ); 124 edit->setCompletionMode( OGlobalSettings::CompletionPopup );
125 OCompletion* comp = edit->completionObject(); 125 OCompletion* comp = edit->completionObject();
126 126
127 QStringList list; 127 QStringList list;
128 list << "mickeyl@handhelds.org"; 128 list << "mickeyl@handhelds.org";
129 list << "mickey@tm.informatik.uni-frankfurt.de"; 129 list << "mickey@tm.informatik.uni-frankfurt.de";
130 list << "mickey@vanille.de"; 130 list << "mickey@vanille.de";
131 131
132 comp->setItems( list ); 132 comp->setItems( list );
133 133
134 edit->show(); 134 edit->show();
135 135
136} 136}
137 137
138void OpieUIDemo::demoOComboBox() 138void OpieUIDemo::demoOComboBox()
139{ 139{
140 qDebug( "ocombobox" ); 140 qDebug( "ocombobox" );
141 141
142 OComboBox *combo = new OComboBox( true, 0, "combobox" ); 142 OComboBox *combo = new OComboBox( true, 0, "combobox" );
143 143
144 combo->setCompletionMode( OGlobalSettings::CompletionPopup ); 144 combo->setCompletionMode( OGlobalSettings::CompletionPopup );
145 OCompletion* comp = combo->completionObject(); 145 OCompletion* comp = combo->completionObject();
146 146
147 QStringList ilist; 147 QStringList ilist;
148 ilist << "kergoth@handhelds.org"; 148 ilist << "kergoth@handhelds.org";
149 ilist << "harlekin@handhelds.org"; 149 ilist << "harlekin@handhelds.org";
150 ilist << "groucho@handhelds.org"; 150 ilist << "groucho@handhelds.org";
151 combo->insertStringList( ilist ); 151 combo->insertStringList( ilist );
152 152
153 QStringList clist; 153 QStringList clist;
154 clist << "mickeyl@handhelds.org"; 154 clist << "mickeyl@handhelds.org";
155 clist << "mickey@tm.informatik.uni-frankfurt.de"; 155 clist << "mickey@tm.informatik.uni-frankfurt.de";
156 clist << "mickey@vanille.de"; 156 clist << "mickey@vanille.de";
157 comp->setItems( clist ); 157 comp->setItems( clist );
158 158
159 combo->show(); 159 combo->show();
160 160
161} 161}
162 162
163void OpieUIDemo::demoOEditListBox() 163void OpieUIDemo::demoOEditListBox()
164{ 164{
165 qDebug( "oeditlistbox" ); 165 qDebug( "oeditlistbox" );
166 166
167 OEditListBox* edit = new OEditListBox( "OEditListBox", 0, "editlistbox" ); 167 OEditListBox* edit = new OEditListBox( "OEditListBox", 0, "editlistbox" );
168 168
169 edit->lineEdit()->setCompletionMode( OGlobalSettings::CompletionPopup ); 169 edit->lineEdit()->setCompletionMode( OGlobalSettings::CompletionPopup );
170 OCompletion* comp = edit->lineEdit()->completionObject(); 170 OCompletion* comp = edit->lineEdit()->completionObject();
171 QStringList clist; 171 QStringList clist;
172 clist << "Completion everywhere"; 172 clist << "Completion everywhere";
173 clist << "Cool Completion everywhere"; 173 clist << "Cool Completion everywhere";
174 clist << "History History History"; 174 clist << "History History History";
175 comp->setItems( clist ); 175 comp->setItems( clist );
176 176
177 QStringList list; 177 QStringList list;
178 list << "kergoth@handhelds.org"; 178 list << "kergoth@handhelds.org";
179 list << "harlekin@handhelds.org"; 179 list << "harlekin@handhelds.org";
180 list << "groucho@handhelds.org"; 180 list << "groucho@handhelds.org";
181 list << "mickeyl@handhelds.org"; 181 list << "mickeyl@handhelds.org";
182 edit->insertStringList( list ); 182 edit->insertStringList( list );
183 183
184 edit->show(); 184 edit->show();
185 185
186} 186}
187 187
188void OpieUIDemo::demoOSelector() 188void OpieUIDemo::demoOSelector()
189{ 189{
190 qDebug( "oselector" ); 190 qDebug( "oselector" );
191 191
192 OHSSelector* sel = new OHSSelector( 0, "gradientselector" ); 192 OHSSelector* sel = new OHSSelector( 0, "gradientselector" );
193 //#sel->resize( QSize( 200, 30 ) ); 193 //#sel->resize( QSize( 200, 30 ) );
194 //#sel->setColors( QColor( 90, 190, 60 ), QColor( 200, 55, 255 ) ); 194 //#sel->setColors( QColor( 90, 190, 60 ), QColor( 200, 55, 255 ) );
195 //#sel->setText( "Dark", "Light" ); 195 //#sel->setText( "Dark", "Light" );
196 196
197 sel->show(); 197 sel->show();
198} 198}
199 199
200void OpieUIDemo::messageBox( const QString& text ) 200void OpieUIDemo::messageBox( const QString& text )
201{ 201{
202 QString info; 202 QString info;
203 info = "You have selected '" + text + "'"; 203 info = "You have selected '" + text + "'";
204 QMessageBox::information( this, "OpieUIDemo", info ); 204 QMessageBox::information( this, "OpieUIDemo", info );
205} 205}
diff --git a/libopie2/opiecore/xmltree.cc b/libopie2/opiecore/xmltree.cc
index 27db5b3..059791b 100644
--- a/libopie2/opiecore/xmltree.cc
+++ b/libopie2/opiecore/xmltree.cc
@@ -1,53 +1,54 @@
1/* This file is part of the KDE project 1/* This file is part of the KDE project
2 Copyright (C) 2001 Simon Hausmann <hausmann@kde.org> 2 Copyright (C) 2001 Simon Hausmann <hausmann@kde.org>
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <opie2/xmltree.h>
21
20#include <qpe/stringutil.h> 22#include <qpe/stringutil.h>
21#include <opie/xmltree.h>
22 23
23#include <qxml.h> 24#include <qxml.h>
24 25
25#include <assert.h> 26#include <assert.h>
26 27
27using namespace Opie; 28using namespace Opie;
28 29
29XMLElement::XMLElement() 30XMLElement::XMLElement()
30 : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 ) 31 : m_parent( 0 ), m_next( 0 ), m_prev( 0 ), m_first( 0 ), m_last( 0 )
31{ 32{
32} 33}
33 34
34XMLElement::~XMLElement() 35XMLElement::~XMLElement()
35{ 36{
36 XMLElement *n = m_first; 37 XMLElement *n = m_first;
37 38
38 while ( n ) 39 while ( n )
39 { 40 {
40 XMLElement *tmp = n; 41 XMLElement *tmp = n;
41 n = n->m_next; 42 n = n->m_next;
42 delete tmp; 43 delete tmp;
43 } 44 }
44} 45}
45 46
46void XMLElement::appendChild( XMLElement *child ) 47void XMLElement::appendChild( XMLElement *child )
47{ 48{
48 if ( child->m_parent ) 49 if ( child->m_parent )
49 child->m_parent->removeChild( child ); 50 child->m_parent->removeChild( child );
50 51
51 child->m_parent = this; 52 child->m_parent = this;
52 53
53 if ( m_last ) 54 if ( m_last )
@@ -57,98 +58,98 @@ void XMLElement::appendChild( XMLElement *child )
57 58
58 if ( !m_first ) 59 if ( !m_first )
59 m_first = child; 60 m_first = child;
60 61
61 m_last = child; 62 m_last = child;
62} 63}
63 64
64void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild ) 65void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild )
65{ 66{
66 assert( newChild != refChild ); 67 assert( newChild != refChild );
67 68
68 if ( refChild == m_last ) 69 if ( refChild == m_last )
69 { 70 {
70 appendChild( newChild ); 71 appendChild( newChild );
71 return; 72 return;
72 } 73 }
73 74
74 assert( refChild ); 75 assert( refChild );
75 assert( refChild->m_parent ); 76 assert( refChild->m_parent );
76 assert( refChild->m_parent == this ); 77 assert( refChild->m_parent == this );
77 78
78 if ( newChild->m_parent && newChild != refChild ) 79 if ( newChild->m_parent && newChild != refChild )
79 newChild->m_parent->removeChild( newChild ); 80 newChild->m_parent->removeChild( newChild );
80 81
81 newChild->m_parent = this; 82 newChild->m_parent = this;
82 83
83 XMLElement *next = refChild->m_next; 84 XMLElement *next = refChild->m_next;
84 85
85 refChild->m_next = newChild; 86 refChild->m_next = newChild;
86 87
87 newChild->m_prev = refChild; 88 newChild->m_prev = refChild;
88 newChild->m_next = next; 89 newChild->m_next = next;
89 90
90 if ( next ) 91 if ( next )
91 next->m_prev = newChild; 92 next->m_prev = newChild;
92} 93}
93 94
94QString XMLElement::attribute( const QString &attr ) const 95QString XMLElement::attribute( const QString &attr ) const
95{ 96{
96 AttributeMap::ConstIterator it = m_attributes.find( attr ); 97 AttributeMap::ConstIterator it = m_attributes.find( attr );
97 if ( it == m_attributes.end() ) 98 if ( it == m_attributes.end() )
98 return QString::null; 99 return QString::null;
99 return it.data(); 100 return it.data();
100} 101}
101 102
102void XMLElement::setAttribute( const QString &attr, const QString &value ) 103void XMLElement::setAttribute( const QString &attr, const QString &value )
103{ 104{
104 m_attributes.replace( attr, value ); 105 m_attributes.replace( attr, value );
105} 106}
106 107
107void XMLElement::insertBefore( XMLElement *newChild, XMLElement *refChild ) 108void XMLElement::insertBefore( XMLElement *newChild, XMLElement *refChild )
108{ 109{
109 assert( refChild ); 110 assert( refChild );
110 assert( refChild->m_parent ); 111 assert( refChild->m_parent );
111 assert( refChild->m_parent == this ); 112 assert( refChild->m_parent == this );
112 assert( newChild != refChild ); 113 assert( newChild != refChild );
113 114
114 if ( newChild->m_parent && newChild != refChild ) 115 if ( newChild->m_parent && newChild != refChild )
115 newChild->m_parent->removeChild( newChild ); 116 newChild->m_parent->removeChild( newChild );
116 117
117 newChild->m_parent = this; 118 newChild->m_parent = this;
118 119
119 XMLElement *prev = refChild->m_prev; 120 XMLElement *prev = refChild->m_prev;
120 121
121 refChild->m_prev = newChild; 122 refChild->m_prev = newChild;
122 123
123 newChild->m_prev = prev; 124 newChild->m_prev = prev;
124 newChild->m_next = refChild; 125 newChild->m_next = refChild;
125 126
126 if ( prev ) 127 if ( prev )
127 prev->m_next = newChild; 128 prev->m_next = newChild;
128 129
129 if ( refChild == m_first ) 130 if ( refChild == m_first )
130 m_first = newChild; 131 m_first = newChild;
131} 132}
132 133
133void XMLElement::removeChild( XMLElement *child ) 134void XMLElement::removeChild( XMLElement *child )
134{ 135{
135 if ( child->m_parent != this ) 136 if ( child->m_parent != this )
136 return; 137 return;
137 138
138 if ( m_first == child ) 139 if ( m_first == child )
139 m_first = child->m_next; 140 m_first = child->m_next;
140 141
141 if ( m_last == child ) 142 if ( m_last == child )
142 m_last = child->m_prev; 143 m_last = child->m_prev;
143 144
144 if ( child->m_prev ) 145 if ( child->m_prev )
145 child->m_prev->m_next = child->m_next; 146 child->m_prev->m_next = child->m_next;
146 147
147 if ( child->m_next ) 148 if ( child->m_next )
148 child->m_next->m_prev = child->m_prev; 149 child->m_next->m_prev = child->m_prev;
149 150
150 child->m_parent = 0; 151 child->m_parent = 0;
151 child->m_prev = 0; 152 child->m_prev = 0;
152 child->m_next = 0; 153 child->m_next = 0;
153} 154}
154 155
@@ -252,65 +253,65 @@ bool Handler::startElement( const QString &, const QString &, const QString &qNa
252 253
253 m_node->appendChild( bm ); 254 m_node->appendChild( bm );
254 m_node = bm; 255 m_node = bm;
255 256
256 return true; 257 return true;
257} 258}
258 259
259bool Handler::endElement( const QString &, const QString &, const QString & ) 260bool Handler::endElement( const QString &, const QString &, const QString & )
260{ 261{
261 if ( m_node == m_root ) 262 if ( m_node == m_root )
262 return false; 263 return false;
263 264
264 m_node = m_node->parent(); 265 m_node = m_node->parent();
265 return true; 266 return true;
266} 267}
267 268
268bool Handler::characters( const QString &ch ) 269bool Handler::characters( const QString &ch )
269{ 270{
270 XMLElement *textNode = new XMLElement; 271 XMLElement *textNode = new XMLElement;
271 textNode->setValue( ch ); 272 textNode->setValue( ch );
272 m_node->appendChild( textNode ); 273 m_node->appendChild( textNode );
273 return true; 274 return true;
274} 275}
275 276
276XMLElement *XMLElement::namedItem( const QString &name ) 277XMLElement *XMLElement::namedItem( const QString &name )
277{ 278{
278 XMLElement *e = m_first; 279 XMLElement *e = m_first;
279 280
280 for (; e; e = e->nextChild() ) 281 for (; e; e = e->nextChild() )
281 if ( e->tagName() == name ) 282 if ( e->tagName() == name )
282 return e; 283 return e;
283 284
284 return 0; 285 return 0;
285} 286}
286 287
287XMLElement *XMLElement::clone() const 288XMLElement *XMLElement::clone() const
288{ 289{
289 XMLElement *res = new XMLElement; 290 XMLElement *res = new XMLElement;
290 291
291 res->setTagName( m_tag ); 292 res->setTagName( m_tag );
292 res->setValue( m_value ); 293 res->setValue( m_value );
293 res->setAttributes( m_attributes ); 294 res->setAttributes( m_attributes );
294 295
295 XMLElement *e = m_first; 296 XMLElement *e = m_first;
296 for (; e; e = e->m_next ) 297 for (; e; e = e->m_next )
297 res->appendChild( e->clone() ); 298 res->appendChild( e->clone() );
298 299
299 return res; 300 return res;
300} 301}
301 302
302XMLElement *XMLElement::load( const QString &fileName ) 303XMLElement *XMLElement::load( const QString &fileName )
303{ 304{
304 QFile f( fileName ); 305 QFile f( fileName );
305 if ( !f.open( IO_ReadOnly ) ) 306 if ( !f.open( IO_ReadOnly ) )
306 return 0; 307 return 0;
307 308
308 QTextStream stream( &f ); 309 QTextStream stream( &f );
309 stream.setEncoding( QTextStream::UnicodeUTF8 ); 310 stream.setEncoding( QTextStream::UnicodeUTF8 );
310 QXmlInputSource src( stream ); 311 QXmlInputSource src( stream );
311 QXmlSimpleReader reader; 312 QXmlSimpleReader reader;
312 Handler handler; 313 Handler handler;
313 314
314 reader.setFeature( "http://trolltech.com/xml/features/report-whitespace-only-CharData", false ); 315 reader.setFeature( "http://trolltech.com/xml/features/report-whitespace-only-CharData", false );
315 reader.setContentHandler( &handler ); 316 reader.setContentHandler( &handler );
316 reader.parse( src ); 317 reader.parse( src );
diff --git a/libopie2/templates/cpp.cpp b/libopie2/templates/cpp.cpp
index da5bcf0..cb1642f 100644
--- a/libopie2/templates/cpp.cpp
+++ b/libopie2/templates/cpp.cpp
@@ -1,42 +1,42 @@
1/* 1/*
2 This file is part of the Opie Project 2 This file is part of the Opie Project
3 Copyright (C) The Main Author <main-author@whereever.org> 3 Copyright (C) The Main Author <main-author@whereever.org>
4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org> 4 =. Copyright (C) The Opie Team <opie-devel@handhelds.org>
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28*/ 28*/
29 29
30#include <opie/h.h> 30#include <opie2/h.h>
31 31
32/* OPIE */ 32/* OPIE */
33opie (and for now, qpe) includes here 33opie (and for now, qpe) includes here
34 34
35/* QT */ 35/* QT */
36qte includes here 36qte includes here
37 37
38/* STD */ 38/* STD */
39standard includes here 39standard includes here
40 40
41using namespace Opie; 41using namespace Opie;
42 42