author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdecore/kcatalogue.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
Diffstat (limited to 'microkde/kdecore/kcatalogue.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdecore/kcatalogue.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/microkde/kdecore/kcatalogue.cpp b/microkde/kdecore/kcatalogue.cpp index 97ac326..1600b08 100644 --- a/microkde/kdecore/kcatalogue.cpp +++ b/microkde/kdecore/kcatalogue.cpp | |||
@@ -1,131 +1,133 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (c) 2001 Hans Petter Bieker <bieker@kde.org> | 2 | Copyright (c) 2001 Hans Petter Bieker <bieker@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 | //US #include <config.h> | 20 | //US #include <config.h> |
21 | 21 | ||
22 | #include <qfile.h> | 22 | #include <qfile.h> |
23 | //Added by qt3to4: | ||
24 | #include <Q3CString> | ||
23 | 25 | ||
24 | #include <kdebug.h> | 26 | #include <kdebug.h> |
25 | 27 | ||
26 | #include "kcatalogue.h" | 28 | #include "kcatalogue.h" |
27 | 29 | ||
28 | char *k_nl_find_msg(struct kde_loaded_l10nfile *domain_file, | 30 | char *k_nl_find_msg(struct kde_loaded_l10nfile *domain_file, |
29 | const char *msgid); | 31 | const char *msgid); |
30 | void k_nl_unload_domain (struct loaded_domain *domain); | 32 | void k_nl_unload_domain (struct loaded_domain *domain); |
31 | 33 | ||
32 | #ifndef KDE_USE_FINAL // with --enable-final, we're getting this from libintl.cpp | 34 | #ifndef KDE_USE_FINAL // with --enable-final, we're getting this from libintl.cpp |
33 | struct kde_loaded_l10nfile | 35 | struct kde_loaded_l10nfile |
34 | { | 36 | { |
35 | const char *filename; | 37 | const char *filename; |
36 | int decided; | 38 | int decided; |
37 | 39 | ||
38 | const void *data; | 40 | const void *data; |
39 | 41 | ||
40 | kde_loaded_l10nfile() : filename(0), decided(0), data(0) {} | 42 | kde_loaded_l10nfile() : filename(0), decided(0), data(0) {} |
41 | }; | 43 | }; |
42 | #endif | 44 | #endif |
43 | 45 | ||
44 | class KCataloguePrivate | 46 | class KCataloguePrivate |
45 | { | 47 | { |
46 | public: | 48 | public: |
47 | QString name; | 49 | QString name; |
48 | 50 | ||
49 | kde_loaded_l10nfile domain; | 51 | kde_loaded_l10nfile domain; |
50 | }; | 52 | }; |
51 | 53 | ||
52 | KCatalogue::KCatalogue(const QString & name) | 54 | KCatalogue::KCatalogue(const QString & name) |
53 | : d( new KCataloguePrivate ) | 55 | : d( new KCataloguePrivate ) |
54 | { | 56 | { |
55 | d->name = name; | 57 | d->name = name; |
56 | } | 58 | } |
57 | 59 | ||
58 | KCatalogue::KCatalogue(const KCatalogue & rhs) | 60 | KCatalogue::KCatalogue(const KCatalogue & rhs) |
59 | : d( new KCataloguePrivate ) | 61 | : d( new KCataloguePrivate ) |
60 | { | 62 | { |
61 | *this = rhs; | 63 | *this = rhs; |
62 | } | 64 | } |
63 | 65 | ||
64 | KCatalogue & KCatalogue::operator=(const KCatalogue & rhs) | 66 | KCatalogue & KCatalogue::operator=(const KCatalogue & rhs) |
65 | { | 67 | { |
66 | d->name = rhs.d->name; | 68 | d->name = rhs.d->name; |
67 | setFileName( rhs.fileName() ); | 69 | setFileName( rhs.fileName() ); |
68 | 70 | ||
69 | return *this; | 71 | return *this; |
70 | } | 72 | } |
71 | 73 | ||
72 | KCatalogue::~KCatalogue() | 74 | KCatalogue::~KCatalogue() |
73 | { | 75 | { |
74 | doUnload(); | 76 | doUnload(); |
75 | 77 | ||
76 | delete d; | 78 | delete d; |
77 | } | 79 | } |
78 | 80 | ||
79 | QString KCatalogue::name() const | 81 | QString KCatalogue::name() const |
80 | { | 82 | { |
81 | return d->name; | 83 | return d->name; |
82 | } | 84 | } |
83 | 85 | ||
84 | void KCatalogue::setFileName( const QString & fileName ) | 86 | void KCatalogue::setFileName( const QString & fileName ) |
85 | { | 87 | { |
86 | // nothing to do if the file name is already the same | 88 | // nothing to do if the file name is already the same |
87 | if ( this->fileName() == fileName ) return; | 89 | if ( this->fileName() == fileName ) return; |
88 | 90 | ||
89 | doUnload(); | 91 | doUnload(); |
90 | 92 | ||
91 | QCString newFileName = QFile::encodeName( fileName ); | 93 | Q3CString newFileName = QFile::encodeName( fileName ); |
92 | 94 | ||
93 | if ( !fileName.isEmpty() ) | 95 | if ( !fileName.isEmpty() ) |
94 | { | 96 | { |
95 | // set file name | 97 | // set file name |
96 | char *filename = new char[ newFileName.length() + 1 ]; | 98 | char *filename = new char[ newFileName.length() + 1 ]; |
97 | ::qstrcpy( filename, newFileName ); | 99 | ::qstrcpy( filename, newFileName ); |
98 | d->domain.filename = filename; | 100 | d->domain.filename = filename; |
99 | } | 101 | } |
100 | } | 102 | } |
101 | 103 | ||
102 | QString KCatalogue::fileName() const | 104 | QString KCatalogue::fileName() const |
103 | { | 105 | { |
104 | return QFile::decodeName( d->domain.filename ); | 106 | return QFile::decodeName( d->domain.filename ); |
105 | } | 107 | } |
106 | 108 | ||
107 | const char * KCatalogue::translate(const char * msgid) const | 109 | const char * KCatalogue::translate(const char * msgid) const |
108 | { | 110 | { |
109 | qDebug("KCatalogue::translate has to be fixed %s",msgid ); | 111 | qDebug("KCatalogue::translate has to be fixed %s",msgid ); |
110 | //US return ::k_nl_find_msg( &d->domain, msgid ); | 112 | //US return ::k_nl_find_msg( &d->domain, msgid ); |
111 | return msgid; | 113 | return msgid; |
112 | 114 | ||
113 | } | 115 | } |
114 | 116 | ||
115 | void KCatalogue::doUnload() | 117 | void KCatalogue::doUnload() |
116 | { | 118 | { |
117 | // use gettext's unloader | 119 | // use gettext's unloader |
118 | if ( d->domain.data ) | 120 | if ( d->domain.data ) |
119 | { | 121 | { |
120 | //US ::k_nl_unload_domain( (struct loaded_domain *)d->domain.data ); | 122 | //US ::k_nl_unload_domain( (struct loaded_domain *)d->domain.data ); |
121 | qDebug("KCatalogue::doUnload has to be fixed" ); | 123 | qDebug("KCatalogue::doUnload has to be fixed" ); |
122 | 124 | ||
123 | } | 125 | } |
124 | d->domain.data = 0; | 126 | d->domain.data = 0; |
125 | 127 | ||
126 | // free name | 128 | // free name |
127 | delete [] const_cast<char *>(d->domain.filename); | 129 | delete [] const_cast<char *>(d->domain.filename); |
128 | d->domain.filename = 0; | 130 | d->domain.filename = 0; |
129 | 131 | ||
130 | d->domain.decided = 0; | 132 | d->domain.decided = 0; |
131 | } | 133 | } |