summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2005-04-16 22:02:12 (UTC)
committer zecke <zecke>2005-04-16 22:02:12 (UTC)
commit206784bc9919dca87a71de9b998ff0ece08bd8ca (patch) (unidiff)
treeb45acd807cdb073e6a9c0d07862f72b395c865a9 /library
parentf2b8a146b411a99c43050ab902f641ee406e3bab (diff)
downloadopie-206784bc9919dca87a71de9b998ff0ece08bd8ca.zip
opie-206784bc9919dca87a71de9b998ff0ece08bd8ca.tar.gz
opie-206784bc9919dca87a71de9b998ff0ece08bd8ca.tar.bz2
Opie X11:
Do not take the local qpeapplication.h but the Opie/X11 version
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/config.cpp2
-rw-r--r--library/qpedialog.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/library/config.cpp b/library/config.cpp
index 72bd4d2..73ddeb5 100644
--- a/library/config.cpp
+++ b/library/config.cpp
@@ -1,135 +1,135 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000,2004 Trolltech AS. All rights reserved. 2** Copyright (C) 2000,2004 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia 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** 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#include <qdir.h> 21#include <qdir.h>
22#include <qmessagebox.h> 22#include <qmessagebox.h>
23#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 23#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
24#include <qtextcodec.h> 24#include <qtextcodec.h>
25#endif 25#endif
26#include <qtextstream.h> 26#include <qtextstream.h>
27 27
28#include <sys/stat.h> 28#include <sys/stat.h>
29#include <sys/types.h> 29#include <sys/types.h>
30#include <sys/time.h> 30#include <sys/time.h>
31#include <fcntl.h> 31#include <fcntl.h>
32#include <stdlib.h> 32#include <stdlib.h>
33#include <time.h> 33#include <time.h>
34#include <unistd.h> 34#include <unistd.h>
35 35
36#define QTOPIA_INTERNAL_LANGLIST 36#define QTOPIA_INTERNAL_LANGLIST
37#include "config.h" 37#include "config.h"
38#include "global.h" 38#include "global.h"
39#include "qpeapplication.h" 39#include <qtopia/qpeapplication.h>
40 40
41 41
42/* 42/*
43 * Internal Class 43 * Internal Class
44 */ 44 */
45class ConfigPrivate { 45class ConfigPrivate {
46public: 46public:
47 ConfigPrivate() : multilang(FALSE) {} 47 ConfigPrivate() : multilang(FALSE) {}
48 ConfigPrivate(const ConfigPrivate& o) : 48 ConfigPrivate(const ConfigPrivate& o) :
49 trfile(o.trfile), 49 trfile(o.trfile),
50 trcontext(o.trcontext), 50 trcontext(o.trcontext),
51 multilang(o.multilang) 51 multilang(o.multilang)
52 {} 52 {}
53 ConfigPrivate& operator=(const ConfigPrivate& o) 53 ConfigPrivate& operator=(const ConfigPrivate& o)
54 { 54 {
55 trfile = o.trfile; 55 trfile = o.trfile;
56 trcontext = o.trcontext; 56 trcontext = o.trcontext;
57 multilang = o.multilang; 57 multilang = o.multilang;
58 return *this; 58 return *this;
59 } 59 }
60 60
61 QString trfile; 61 QString trfile;
62 QCString trcontext; 62 QCString trcontext;
63 bool multilang; 63 bool multilang;
64}; 64};
65 65
66///////////////////////////////////////////////////////////////// 66/////////////////////////////////////////////////////////////////
67///////////////////////////////////////////////////////////////// 67/////////////////////////////////////////////////////////////////
68 68
69#ifndef Q_OS_WIN32 69#ifndef Q_OS_WIN32
70 70
71//#define DEBUG_CONFIG_CACHE 71//#define DEBUG_CONFIG_CACHE
72class ConfigData 72class ConfigData
73{ 73{
74public: 74public:
75 ConfigData() {} 75 ConfigData() {}
76 ConfigData( const ConfigGroupMap& cf, const ConfigPrivate& pri, 76 ConfigData( const ConfigGroupMap& cf, const ConfigPrivate& pri,
77 struct stat sbuf ) 77 struct stat sbuf )
78 : cfg( cf ), priv( pri ), mtime( sbuf.st_mtime ), 78 : cfg( cf ), priv( pri ), mtime( sbuf.st_mtime ),
79 size( sbuf.st_size ) 79 size( sbuf.st_size )
80 { 80 {
81 gettimeofday(&used, 0 ); 81 gettimeofday(&used, 0 );
82 } 82 }
83 83
84 ConfigGroupMap cfg; 84 ConfigGroupMap cfg;
85 ConfigPrivate priv; // Owned by this object 85 ConfigPrivate priv; // Owned by this object
86 time_t mtime; 86 time_t mtime;
87 unsigned int size; 87 unsigned int size;
88 struct timeval used; 88 struct timeval used;
89}; 89};
90 90
91 91
92class ConfigCache : public QObject { 92class ConfigCache : public QObject {
93public: 93public:
94 static ConfigCache* instance(); 94 static ConfigCache* instance();
95 95
96 void insert( const QString& fileName, const ConfigGroupMap& cfg, 96 void insert( const QString& fileName, const ConfigGroupMap& cfg,
97 const ConfigPrivate *priv ); 97 const ConfigPrivate *priv );
98 bool find(const QString& fileName, ConfigGroupMap& cfg, 98 bool find(const QString& fileName, ConfigGroupMap& cfg,
99 ConfigPrivate** priv ); 99 ConfigPrivate** priv );
100protected: 100protected:
101 void timerEvent( QTimerEvent* ); 101 void timerEvent( QTimerEvent* );
102 102
103private: 103private:
104 ConfigCache(); 104 ConfigCache();
105 void remove( const QString& fileName ); 105 void remove( const QString& fileName );
106 void removeLru(); 106 void removeLru();
107 107
108private: 108private:
109 QMap<QString, ConfigData> m_cached; 109 QMap<QString, ConfigData> m_cached;
110 unsigned int m_totalSize; 110 unsigned int m_totalSize;
111 int m_tid; 111 int m_tid;
112private: 112private:
113 static ConfigCache* m_inst; 113 static ConfigCache* m_inst;
114 static const unsigned int CONFIG_CACHE_SIZE = 8192; 114 static const unsigned int CONFIG_CACHE_SIZE = 8192;
115 static const unsigned int CONFIG_CACHE_TIMEOUT = 1000; 115 static const unsigned int CONFIG_CACHE_TIMEOUT = 1000;
116}; 116};
117 117
118ConfigCache* ConfigCache::m_inst = 0; 118ConfigCache* ConfigCache::m_inst = 0;
119/* 119/*
120 * get destroyed when qApp gets destroyed 120 * get destroyed when qApp gets destroyed
121 */ 121 */
122ConfigCache::ConfigCache() : QObject( qApp ), m_totalSize( 0 ), m_tid( 0 ) {} 122ConfigCache::ConfigCache() : QObject( qApp ), m_totalSize( 0 ), m_tid( 0 ) {}
123ConfigCache* ConfigCache::instance() { 123ConfigCache* ConfigCache::instance() {
124 if ( !m_inst ) 124 if ( !m_inst )
125 m_inst = new ConfigCache(); 125 m_inst = new ConfigCache();
126 126
127 return m_inst; 127 return m_inst;
128} 128}
129 129
130void ConfigCache::remove( const QString& fileName ) { 130void ConfigCache::remove( const QString& fileName ) {
131 QMap<QString, ConfigData>::Iterator it = m_cached.find( fileName ); 131 QMap<QString, ConfigData>::Iterator it = m_cached.find( fileName );
132 132
133 if ( it == m_cached.end() ) 133 if ( it == m_cached.end() )
134 return; 134 return;
135 135
diff --git a/library/qpedialog.cpp b/library/qpedialog.cpp
index f52171f..8da0ca6 100644
--- a/library/qpedialog.cpp
+++ b/library/qpedialog.cpp
@@ -1,84 +1,84 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia 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** 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#include "qpedialog.h" 21#include "qpedialog.h"
22 22
23#include <qdialog.h> 23#include <qdialog.h>
24 24
25#include <qpeapplication.h> 25#include <qtopia/qpeapplication.h>
26 26
27 27
28// Allow access to nornally protected accept and reject functions 28// Allow access to nornally protected accept and reject functions
29class HackedPrivateQDialog : public QDialog{ 29class HackedPrivateQDialog : public QDialog{
30public: 30public:
31 void accept() { QDialog::accept();} 31 void accept() { QDialog::accept();}
32 void reject() { QDialog::reject();} 32 void reject() { QDialog::reject();}
33}; 33};
34 34
35 35
36/** 36/**
37 * \brief This is the only c'tor. 37 * \brief This is the only c'tor.
38 * 38 *
39 * The parent of this Listener is the Dialog you pass. This means once 39 * The parent of this Listener is the Dialog you pass. This means once
40 * the dialog is deleted this listener will be deleted too. 40 * the dialog is deleted this listener will be deleted too.
41 * This Listener listens on QPEApplication::appMessage signal and implements 41 * This Listener listens on QPEApplication::appMessage signal and implements
42 * accept() and reject(). 42 * accept() and reject().
43 * 43 *
44 * \code 44 * \code
45 *QDialog *dialog = new YourDialog(); 45 *QDialog *dialog = new YourDialog();
46 (void)new QPEDialogListener(dialog); 46 (void)new QPEDialogListener(dialog);
47 if( QPEApplication::execDialog(dialog) == QDialog::Accept ){ 47 if( QPEApplication::execDialog(dialog) == QDialog::Accept ){
48 // do some stuff 48 // do some stuff
49 } 49 }
50 delete dialog; 50 delete dialog;
51 51
52 * \endcode 52 * \endcode
53 * 53 *
54 * @param di The dialog to handle 54 * @param di The dialog to handle
55 */ 55 */
56QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di) 56QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di)
57{ 57{
58 dialog = di; 58 dialog = di;
59 connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), 59 connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
60 this, SLOT(appMessage(const QCString&,const QByteArray&)) ); 60 this, SLOT(appMessage(const QCString&,const QByteArray&)) );
61} 61}
62 62
63 63
64/** 64/**
65 * d'tor 65 * d'tor
66 */ 66 */
67QPEDialogListener::~QPEDialogListener() {} 67QPEDialogListener::~QPEDialogListener() {}
68 68
69/** 69/**
70 * \internal 70 * \internal
71 */ 71 */
72void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & ) 72void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & )
73{ 73{
74 if (!dialog) 74 if (!dialog)
75 return; 75 return;
76 76
77 HackedPrivateQDialog *hackedDialog = static_cast<HackedPrivateQDialog*>(dialog); 77 HackedPrivateQDialog *hackedDialog = static_cast<HackedPrivateQDialog*>(dialog);
78 78
79 if (msg == "accept()") { 79 if (msg == "accept()") {
80 hackedDialog->accept(); 80 hackedDialog->accept();
81 } else if (msg == "reject()") { 81 } else if (msg == "reject()") {
82 hackedDialog->reject(); 82 hackedDialog->reject();
83 } 83 }
84} 84}