-rw-r--r-- | bin/kdepim/kaddressbook/icons22/ka24.png | bin | 0 -> 1435 bytes | |||
-rw-r--r-- | kabc/plugins/dir/dir.pro | 5 | ||||
-rw-r--r-- | kabc/plugins/dir/resourcedir.cpp | 11 | ||||
-rw-r--r-- | kabc/plugins/file/file.pro | 5 | ||||
-rw-r--r-- | kabc/plugins/file/resourcefile.cpp | 10 | ||||
-rw-r--r-- | kaddressbook/mainembedded.cpp | 1 | ||||
-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 6 | ||||
-rw-r--r-- | microkde/kdecore/klibloader.cpp | 7 |
8 files changed, 39 insertions, 6 deletions
diff --git a/bin/kdepim/kaddressbook/icons22/ka24.png b/bin/kdepim/kaddressbook/icons22/ka24.png new file mode 100644 index 0000000..738e939 --- a/dev/null +++ b/bin/kdepim/kaddressbook/icons22/ka24.png | |||
Binary files differ | |||
diff --git a/kabc/plugins/dir/dir.pro b/kabc/plugins/dir/dir.pro index 3db201f..0023029 100644 --- a/kabc/plugins/dir/dir.pro +++ b/kabc/plugins/dir/dir.pro | |||
@@ -1,29 +1,34 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | TARGET = microkabc_dir | 5 | TARGET = microkabc_dir |
6 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat | 6 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat |
7 | DESTDIR = ../../../bin | 7 | DESTDIR = ../../../bin |
8 | #LIBS += -lmicrokde -lmicrokabc | 8 | #LIBS += -lmicrokde -lmicrokabc |
9 | #LIBS += -L$(QPEDIR)/lib | 9 | #LIBS += -L$(QPEDIR)/lib |
10 | 10 | ||
11 | INTERFACES = \ | 11 | INTERFACES = \ |
12 | 12 | ||
13 | HEADERS = \ | 13 | HEADERS = \ |
14 | resourcedir.h \ | 14 | resourcedir.h \ |
15 | resourcedirconfig.h | 15 | resourcedirconfig.h |
16 | 16 | ||
17 | SOURCES = \ | 17 | SOURCES = \ |
18 | resourcedir.cpp \ | 18 | resourcedir.cpp \ |
19 | resourcedirconfig.cpp | 19 | resourcedirconfig.cpp |
20 | 20 | ||
21 | unix : { | 21 | unix : { |
22 | OBJECTS_DIR = obj/unix | 22 | OBJECTS_DIR = obj/unix |
23 | MOC_DIR = moc/unix | 23 | MOC_DIR = moc/unix |
24 | } | 24 | } |
25 | win32: { | 25 | win32: { |
26 | CONFIG += dll | ||
26 | DEFINES += _WIN32_ | 27 | DEFINES += _WIN32_ |
27 | OBJECTS_DIR = obj/win | 28 | OBJECTS_DIR = obj/win |
28 | MOC_DIR = moc/win | 29 | MOC_DIR = moc/win |
30 | LIBS += ../../../bin/microkdepim.lib | ||
31 | LIBS += ../../../bin/microkcal.lib | ||
32 | LIBS += ../../../bin/microkde.lib | ||
33 | LIBS += ../../../bin/microkabc.lib | ||
29 | } \ No newline at end of file | 34 | } \ No newline at end of file |
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index 6ea2f4b..3cb5179 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp | |||
@@ -1,189 +1,196 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | 28 | ||
29 | #include <sys/types.h> | 29 | #include <sys/types.h> |
30 | #include <sys/stat.h> | 30 | #include <sys/stat.h> |
31 | #ifndef _WIN32_ | 31 | #ifndef _WIN32_ |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | 38 | ||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | //US #include <kgenericfactory.h> | 42 | //US #include <kgenericfactory.h> |
43 | #include <kglobal.h> | 43 | #include <kglobal.h> |
44 | #include <klocale.h> | 44 | #include <klocale.h> |
45 | #include <kstandarddirs.h> | 45 | #include <kstandarddirs.h> |
46 | #include <kurlrequester.h> | 46 | #include <kurlrequester.h> |
47 | 47 | ||
48 | #include "addressbook.h" | 48 | #include "addressbook.h" |
49 | 49 | ||
50 | #include "formatfactory.h" | 50 | #include "formatfactory.h" |
51 | 51 | ||
52 | #include "resourcedirconfig.h" | 52 | #include "resourcedirconfig.h" |
53 | #include "stdaddressbook.h" | 53 | #include "stdaddressbook.h" |
54 | 54 | ||
55 | //US | 55 | //US |
56 | #include <qdir.h> | 56 | #include <qdir.h> |
57 | //US #include "../../formats/vcardformatplugin2.h" | 57 | //US #include "../../formats/vcardformatplugin2.h" |
58 | //US #include "../../formats/binaryformat.h" | 58 | //US #include "../../formats/binaryformat.h" |
59 | 59 | ||
60 | #include "resourcedir.h" | 60 | #include "resourcedir.h" |
61 | 61 | ||
62 | using namespace KABC; | 62 | using namespace KABC; |
63 | 63 | ||
64 | extern "C" | 64 | extern "C" |
65 | #ifdef _WIN32_ | ||
66 | __declspec(dllexport) | ||
67 | #else | ||
65 | { | 68 | { |
69 | #endif | ||
70 | |||
66 | //US void *init_kabc_dir() | 71 | //US void *init_kabc_dir() |
67 | void *init_microkabc_dir() | 72 | void *init_microkabc_dir() |
68 | { | 73 | { |
69 | return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); | 74 | return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); |
70 | } | 75 | } |
76 | #ifndef _WIN32_ | ||
71 | } | 77 | } |
72 | 78 | #endif | |
73 | 79 | ||
74 | ResourceDir::ResourceDir( const KConfig *config ) | 80 | ResourceDir::ResourceDir( const KConfig *config ) |
75 | : Resource( config ) | 81 | : Resource( config ) |
76 | { | 82 | { |
77 | QString path; | 83 | QString path; |
78 | 84 | ||
79 | KConfig *cfg = (KConfig *)config; | 85 | KConfig *cfg = (KConfig *)config; |
80 | if ( cfg ) { | 86 | if ( cfg ) { |
81 | //US path = config->readEntry( "FilePath" ); | 87 | //US path = config->readEntry( "FilePath" ); |
82 | path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); | 88 | path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); |
83 | //US mFormatName = config->readEntry( "FileFormat" ); | 89 | //US mFormatName = config->readEntry( "FileFormat" ); |
84 | mFormatName = cfg->readEntry( "FileFormat", "vcard" ); | 90 | mFormatName = cfg->readEntry( "FileFormat", "vcard" ); |
85 | } else { | 91 | } else { |
86 | path = StdAddressBook::directoryName(); | 92 | path = StdAddressBook::directoryName(); |
87 | mFormatName = "vcard"; | 93 | mFormatName = "vcard"; |
88 | } | 94 | } |
89 | 95 | ||
90 | 96 | ||
91 | FormatFactory *factory = FormatFactory::self(); | 97 | FormatFactory *factory = FormatFactory::self(); |
92 | mFormat = factory->format( mFormatName ); | 98 | mFormat = factory->format( mFormatName ); |
93 | 99 | ||
94 | if ( !mFormat ) { | 100 | if ( !mFormat ) { |
95 | mFormatName = "vcard"; | 101 | mFormatName = "vcard"; |
96 | mFormat = factory->format( mFormatName ); | 102 | mFormat = factory->format( mFormatName ); |
97 | } | 103 | } |
98 | 104 | ||
99 | /*US | 105 | /*US |
100 | //US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); | 106 | //US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); |
101 | if (mFormatName == "vcard") | 107 | if (mFormatName == "vcard") |
102 | mFormat = new VCardFormatPlugin2(); | 108 | mFormat = new VCardFormatPlugin2(); |
103 | else if (mFormatName == "binary") | 109 | else if (mFormatName == "binary") |
104 | mFormat = new BinaryFormat(); | 110 | mFormat = new BinaryFormat(); |
105 | else | 111 | else |
106 | qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); | 112 | qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); |
107 | */ | 113 | */ |
108 | 114 | ||
109 | /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods | 115 | /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods |
110 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); | 116 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); |
111 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); | 117 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); |
112 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); | 118 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); |
113 | */ | 119 | */ |
114 | 120 | ||
115 | setPath( path ); | 121 | setPath( path ); |
116 | } | 122 | } |
117 | 123 | ||
118 | ResourceDir::~ResourceDir() | 124 | ResourceDir::~ResourceDir() |
119 | { | 125 | { |
120 | delete mFormat; | 126 | delete mFormat; |
121 | mFormat = 0; | 127 | mFormat = 0; |
122 | } | 128 | } |
123 | 129 | ||
124 | void ResourceDir::writeConfig( KConfig *config ) | 130 | void ResourceDir::writeConfig( KConfig *config ) |
125 | { | 131 | { |
132 | config->setGroup( "Resource_" + identifier() ); | ||
126 | Resource::writeConfig( config ); | 133 | Resource::writeConfig( config ); |
127 | 134 | ||
128 | config->writeEntry( "FilePath", mPath ); | 135 | config->writeEntry( "FilePath", mPath ); |
129 | config->writeEntry( "FileFormat", mFormatName ); | 136 | config->writeEntry( "FileFormat", mFormatName ); |
130 | } | 137 | } |
131 | 138 | ||
132 | Ticket *ResourceDir::requestSaveTicket() | 139 | Ticket *ResourceDir::requestSaveTicket() |
133 | { | 140 | { |
134 | kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl; | 141 | kdDebug(5700) << "ResourceDir::requestSaveTicket()" << endl; |
135 | 142 | ||
136 | if ( !addressBook() ) return 0; | 143 | if ( !addressBook() ) return 0; |
137 | 144 | ||
138 | if ( !lock( mPath ) ) { | 145 | if ( !lock( mPath ) ) { |
139 | kdDebug(5700) << "ResourceDir::requestSaveTicket(): Unable to lock path '" | 146 | kdDebug(5700) << "ResourceDir::requestSaveTicket(): Unable to lock path '" |
140 | << mPath << "'" << endl; | 147 | << mPath << "'" << endl; |
141 | return 0; | 148 | return 0; |
142 | } | 149 | } |
143 | return createTicket( this ); | 150 | return createTicket( this ); |
144 | } | 151 | } |
145 | 152 | ||
146 | 153 | ||
147 | bool ResourceDir::doOpen() | 154 | bool ResourceDir::doOpen() |
148 | { | 155 | { |
149 | QDir dir( mPath ); | 156 | QDir dir( mPath ); |
150 | if ( !dir.exists() ) { // no directory available | 157 | if ( !dir.exists() ) { // no directory available |
151 | return dir.mkdir( dir.path() ); | 158 | return dir.mkdir( dir.path() ); |
152 | } else { | 159 | } else { |
153 | QString testName = dir.entryList( QDir::Files )[0]; | 160 | QString testName = dir.entryList( QDir::Files )[0]; |
154 | if ( testName.isNull() || testName.isEmpty() ) // no file in directory | 161 | if ( testName.isNull() || testName.isEmpty() ) // no file in directory |
155 | return true; | 162 | return true; |
156 | 163 | ||
157 | QFile file( mPath + "/" + testName ); | 164 | QFile file( mPath + "/" + testName ); |
158 | if ( file.open( IO_ReadOnly ) ) | 165 | if ( file.open( IO_ReadOnly ) ) |
159 | return true; | 166 | return true; |
160 | 167 | ||
161 | if ( file.size() == 0 ) | 168 | if ( file.size() == 0 ) |
162 | return true; | 169 | return true; |
163 | 170 | ||
164 | bool ok = mFormat->checkFormat( &file ); | 171 | bool ok = mFormat->checkFormat( &file ); |
165 | file.close(); | 172 | file.close(); |
166 | return ok; | 173 | return ok; |
167 | } | 174 | } |
168 | } | 175 | } |
169 | 176 | ||
170 | void ResourceDir::doClose() | 177 | void ResourceDir::doClose() |
171 | { | 178 | { |
172 | } | 179 | } |
173 | 180 | ||
174 | bool ResourceDir::load() | 181 | bool ResourceDir::load() |
175 | { | 182 | { |
176 | kdDebug(5700) << "ResourceDir::load(): '" << mPath << "'" << endl; | 183 | kdDebug(5700) << "ResourceDir::load(): '" << mPath << "'" << endl; |
177 | 184 | ||
178 | QDir dir( mPath ); | 185 | QDir dir( mPath ); |
179 | QStringList files = dir.entryList( QDir::Files ); | 186 | QStringList files = dir.entryList( QDir::Files ); |
180 | 187 | ||
181 | QStringList::Iterator it; | 188 | QStringList::Iterator it; |
182 | bool ok = true; | 189 | bool ok = true; |
183 | for ( it = files.begin(); it != files.end(); ++it ) { | 190 | for ( it = files.begin(); it != files.end(); ++it ) { |
184 | QFile file( mPath + "/" + (*it) ); | 191 | QFile file( mPath + "/" + (*it) ); |
185 | 192 | ||
186 | if ( !file.open( IO_ReadOnly ) ) { | 193 | if ( !file.open( IO_ReadOnly ) ) { |
187 | addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) ); | 194 | addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) ); |
188 | ok = false; | 195 | ok = false; |
189 | continue; | 196 | continue; |
diff --git a/kabc/plugins/file/file.pro b/kabc/plugins/file/file.pro index a5ade93..7cf7c58 100644 --- a/kabc/plugins/file/file.pro +++ b/kabc/plugins/file/file.pro | |||
@@ -1,30 +1,35 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | TARGET = microkabc_file | 5 | TARGET = microkabc_file |
6 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat | 6 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../qtcompat |
7 | 7 | ||
8 | DESTDIR = ../../../bin | 8 | DESTDIR = ../../../bin |
9 | #LIBS += -lmicrokde -lmicrokabc | 9 | #LIBS += -lmicrokde -lmicrokabc |
10 | #LIBS += -L$(QPEDIR)/lib | 10 | #LIBS += -L$(QPEDIR)/lib |
11 | 11 | ||
12 | INTERFACES = \ | 12 | INTERFACES = \ |
13 | 13 | ||
14 | HEADERS = \ | 14 | HEADERS = \ |
15 | resourcefile.h \ | 15 | resourcefile.h \ |
16 | resourcefileconfig.h | 16 | resourcefileconfig.h |
17 | 17 | ||
18 | SOURCES = \ | 18 | SOURCES = \ |
19 | resourcefile.cpp \ | 19 | resourcefile.cpp \ |
20 | resourcefileconfig.cpp | 20 | resourcefileconfig.cpp |
21 | 21 | ||
22 | unix : { | 22 | unix : { |
23 | OBJECTS_DIR = obj/unix | 23 | OBJECTS_DIR = obj/unix |
24 | MOC_DIR = moc/unix | 24 | MOC_DIR = moc/unix |
25 | } | 25 | } |
26 | win32: { | 26 | win32: { |
27 | CONFIG += dll | ||
27 | DEFINES += _WIN32_ | 28 | DEFINES += _WIN32_ |
28 | OBJECTS_DIR = obj/win | 29 | OBJECTS_DIR = obj/win |
29 | MOC_DIR = moc/win | 30 | MOC_DIR = moc/win |
31 | LIBS += ../../../bin/microkdepim.lib | ||
32 | LIBS += ../../../bin/microkcal.lib | ||
33 | LIBS += ../../../bin/microkde.lib | ||
34 | LIBS += ../../../bin/microkabc.lib | ||
30 | } \ No newline at end of file | 35 | } \ No newline at end of file |
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index 4b4c935..2d20706 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp | |||
@@ -1,203 +1,211 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
30 | #ifndef _WIN32_ | 30 | #ifndef _WIN32_ |
31 | #include <unistd.h> | 31 | #include <unistd.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qfileinfo.h> | 35 | #include <qfileinfo.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qtimer.h> | 37 | #include <qtimer.h> |
38 | 38 | ||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <klocale.h> | 42 | #include <klocale.h> |
43 | //US #include <ksavefile.h> | 43 | //US #include <ksavefile.h> |
44 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
45 | 45 | ||
46 | #include "formatfactory.h" | 46 | #include "formatfactory.h" |
47 | 47 | ||
48 | #include "resource.h" | 48 | #include "resource.h" |
49 | #include "resourcefileconfig.h" | 49 | #include "resourcefileconfig.h" |
50 | #include "stdaddressbook.h" | 50 | #include "stdaddressbook.h" |
51 | 51 | ||
52 | //US #include "../../formats/vcardformatplugin2.h" | 52 | //US #include "../../formats/vcardformatplugin2.h" |
53 | //US #include "../../formats/binaryformat.h" | 53 | //US #include "../../formats/binaryformat.h" |
54 | 54 | ||
55 | 55 | ||
56 | #include "resourcefile.h" | 56 | #include "resourcefile.h" |
57 | 57 | ||
58 | using namespace KABC; | 58 | using namespace KABC; |
59 | 59 | ||
60 | extern "C" | 60 | extern "C" |
61 | #ifdef _WIN32_ | ||
62 | __declspec(dllexport) | ||
63 | #else | ||
61 | { | 64 | { |
65 | #endif | ||
66 | |||
62 | //US void *init_kabc_file() | 67 | //US void *init_kabc_file() |
63 | void *init_microkabc_file() | 68 | void *init_microkabc_file() |
64 | { | 69 | { |
65 | return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); | 70 | return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); |
66 | } | 71 | } |
72 | #ifndef _WIN32_ | ||
67 | } | 73 | } |
68 | 74 | #endif | |
69 | 75 | ||
70 | ResourceFile::ResourceFile( const KConfig *config ) | 76 | ResourceFile::ResourceFile( const KConfig *config ) |
71 | : Resource( config ) , mFormat( 0 ) | 77 | : Resource( config ) , mFormat( 0 ) |
72 | { | 78 | { |
73 | QString fileName, formatName; | 79 | QString fileName, formatName; |
74 | 80 | ||
75 | KConfig *cfg = (KConfig *)config; | 81 | KConfig *cfg = (KConfig *)config; |
76 | if ( cfg ) { | 82 | if ( cfg ) { |
77 | fileName = cfg->readEntry( "FileName", StdAddressBook::fileName() ); | 83 | fileName = cfg->readEntry( "FileName", StdAddressBook::fileName() ); |
78 | formatName = cfg->readEntry( "FileFormat", "vcard" ); | 84 | formatName = cfg->readEntry( "FileFormat", "vcard" ); |
79 | // qDebug("ResourceFile::ResourceFile : 1 %s, %s", fileName.latin1(), formatName.latin1() ); | 85 | // qDebug("ResourceFile::ResourceFile : 1 %s, %s", fileName.latin1(), formatName.latin1() ); |
80 | } else { | 86 | } else { |
81 | fileName = StdAddressBook::fileName(); | 87 | fileName = StdAddressBook::fileName(); |
82 | formatName = "vcard"; | 88 | formatName = "vcard"; |
83 | // qDebug("ResourceFile::ResourceFile : 2 %s, %s", fileName.latin1(), formatName.latin1() ); | 89 | // qDebug("ResourceFile::ResourceFile : 2 %s, %s", fileName.latin1(), formatName.latin1() ); |
84 | } | 90 | } |
85 | 91 | ||
86 | init( fileName, formatName ); | 92 | init( fileName, formatName ); |
87 | } | 93 | } |
88 | 94 | ||
89 | ResourceFile::ResourceFile( const QString &fileName, | 95 | ResourceFile::ResourceFile( const QString &fileName, |
90 | const QString &formatName ) | 96 | const QString &formatName ) |
91 | : Resource( 0 ) | 97 | : Resource( 0 ) |
92 | { | 98 | { |
93 | // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); | 99 | // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); |
94 | init( fileName, formatName ); | 100 | init( fileName, formatName ); |
95 | } | 101 | } |
96 | 102 | ||
97 | void ResourceFile::init( const QString &fileName, const QString &formatName ) | 103 | void ResourceFile::init( const QString &fileName, const QString &formatName ) |
98 | { | 104 | { |
99 | mFormatName = formatName; | 105 | mFormatName = formatName; |
100 | 106 | ||
101 | FormatFactory *factory = FormatFactory::self(); | 107 | FormatFactory *factory = FormatFactory::self(); |
102 | mFormat = factory->format( mFormatName ); | 108 | mFormat = factory->format( mFormatName ); |
103 | 109 | ||
104 | if ( !mFormat ) { | 110 | if ( !mFormat ) { |
105 | mFormatName = "vcard"; | 111 | mFormatName = "vcard"; |
106 | mFormat = factory->format( mFormatName ); | 112 | mFormat = factory->format( mFormatName ); |
107 | } | 113 | } |
108 | 114 | ||
109 | /*US | 115 | /*US |
110 | //US qDebug("ResourceFile::init initialized with format %s ", formatName.latin1()); | 116 | //US qDebug("ResourceFile::init initialized with format %s ", formatName.latin1()); |
111 | if (mFormatName == "vcard") { | 117 | if (mFormatName == "vcard") { |
112 | mFormat = new VCardFormatPlugin2(); | 118 | mFormat = new VCardFormatPlugin2(); |
113 | // qDebug("ResourceFile::init format VCardFormatPlugin2"); | 119 | // qDebug("ResourceFile::init format VCardFormatPlugin2"); |
114 | } | 120 | } |
115 | else if (mFormatName == "binary") { | 121 | else if (mFormatName == "binary") { |
116 | mFormat = new BinaryFormat(); | 122 | mFormat = new BinaryFormat(); |
117 | // qDebug("ResourceFile::init format BinaryFormat"); | 123 | // qDebug("ResourceFile::init format BinaryFormat"); |
118 | } | 124 | } |
119 | else | 125 | else |
120 | qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1()); | 126 | qDebug("ResourceFile::init format unknown !!! %s ", formatName.latin1()); |
121 | */ | 127 | */ |
122 | 128 | ||
123 | /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods | 129 | /*US we have no KDirWatch. SO simulate the signals from inside the apropriate methods |
124 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); | 130 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); |
125 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); | 131 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); |
126 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); | 132 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); |
127 | */ | 133 | */ |
128 | 134 | ||
129 | setFileName( fileName ); | 135 | setFileName( fileName ); |
130 | } | 136 | } |
131 | 137 | ||
132 | ResourceFile::~ResourceFile() | 138 | ResourceFile::~ResourceFile() |
133 | { | 139 | { |
134 | delete mFormat; | 140 | delete mFormat; |
135 | mFormat = 0; | 141 | mFormat = 0; |
136 | } | 142 | } |
137 | 143 | ||
138 | void ResourceFile::writeConfig( KConfig *config ) | 144 | void ResourceFile::writeConfig( KConfig *config ) |
139 | { | 145 | { |
146 | |||
147 | config->setGroup( "Resource_" + identifier() ); | ||
140 | Resource::writeConfig( config ); | 148 | Resource::writeConfig( config ); |
141 | 149 | ||
142 | config->writeEntry( "FileName", mFileName ); | 150 | config->writeEntry( "FileName", mFileName ); |
143 | config->writeEntry( "FileFormat", mFormatName ); | 151 | config->writeEntry( "FileFormat", mFormatName ); |
144 | 152 | ||
145 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); | 153 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); |
146 | 154 | ||
147 | } | 155 | } |
148 | 156 | ||
149 | Ticket *ResourceFile::requestSaveTicket() | 157 | Ticket *ResourceFile::requestSaveTicket() |
150 | { | 158 | { |
151 | kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; | 159 | kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; |
152 | 160 | ||
153 | if ( !addressBook() ) return 0; | 161 | if ( !addressBook() ) return 0; |
154 | 162 | ||
155 | if ( !lock( mFileName ) ) { | 163 | if ( !lock( mFileName ) ) { |
156 | kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '" | 164 | kdDebug(5700) << "ResourceFile::requestSaveTicket(): Unable to lock file '" |
157 | << mFileName << "'" << endl; | 165 | << mFileName << "'" << endl; |
158 | return 0; | 166 | return 0; |
159 | } | 167 | } |
160 | return createTicket( this ); | 168 | return createTicket( this ); |
161 | } | 169 | } |
162 | 170 | ||
163 | 171 | ||
164 | bool ResourceFile::doOpen() | 172 | bool ResourceFile::doOpen() |
165 | { | 173 | { |
166 | QFile file( mFileName ); | 174 | QFile file( mFileName ); |
167 | 175 | ||
168 | if ( !file.exists() ) { | 176 | if ( !file.exists() ) { |
169 | // try to create the file | 177 | // try to create the file |
170 | bool ok = file.open( IO_WriteOnly ); | 178 | bool ok = file.open( IO_WriteOnly ); |
171 | if ( ok ) | 179 | if ( ok ) |
172 | file.close(); | 180 | file.close(); |
173 | 181 | ||
174 | return ok; | 182 | return ok; |
175 | } else { | 183 | } else { |
176 | if ( !file.open( IO_ReadWrite ) ) | 184 | if ( !file.open( IO_ReadWrite ) ) |
177 | return false; | 185 | return false; |
178 | 186 | ||
179 | if ( file.size() == 0 ) { | 187 | if ( file.size() == 0 ) { |
180 | file.close(); | 188 | file.close(); |
181 | return true; | 189 | return true; |
182 | } | 190 | } |
183 | 191 | ||
184 | bool ok = mFormat->checkFormat( &file ); | 192 | bool ok = mFormat->checkFormat( &file ); |
185 | file.close(); | 193 | file.close(); |
186 | 194 | ||
187 | return ok; | 195 | return ok; |
188 | } | 196 | } |
189 | } | 197 | } |
190 | 198 | ||
191 | void ResourceFile::doClose() | 199 | void ResourceFile::doClose() |
192 | { | 200 | { |
193 | } | 201 | } |
194 | 202 | ||
195 | bool ResourceFile::load() | 203 | bool ResourceFile::load() |
196 | { | 204 | { |
197 | 205 | ||
198 | 206 | ||
199 | QFile file( mFileName ); | 207 | QFile file( mFileName ); |
200 | if ( !file.open( IO_ReadOnly ) ) { | 208 | if ( !file.open( IO_ReadOnly ) ) { |
201 | addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) ); | 209 | addressBook()->error( i18n( "Unable to open file '%1'." ).arg( mFileName ) ); |
202 | return false; | 210 | return false; |
203 | } | 211 | } |
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index cf1fd3e..7f368eb 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,125 +1,126 @@ | |||
1 | #ifndef DESKTOP_VERSION | 1 | #ifndef DESKTOP_VERSION |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
4 | #else | 4 | #else |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include <qwindowsstyle.h> | 6 | #include <qwindowsstyle.h> |
7 | #include <qplatinumstyle.h> | 7 | #include <qplatinumstyle.h> |
8 | #include <qmainwindow.h> | 8 | #include <qmainwindow.h> |
9 | #endif | 9 | #endif |
10 | 10 | ||
11 | #include <kstandarddirs.h> | 11 | #include <kstandarddirs.h> |
12 | #include <kglobal.h> | 12 | #include <kglobal.h> |
13 | #include <stdio.h> | 13 | #include <stdio.h> |
14 | #include <qdir.h> | 14 | #include <qdir.h> |
15 | #include "kaddressbookmain.h" | 15 | #include "kaddressbookmain.h" |
16 | 16 | ||
17 | int main( int argc, char **argv ) | 17 | int main( int argc, char **argv ) |
18 | { | 18 | { |
19 | #ifndef DESKTOP_VERSION | 19 | #ifndef DESKTOP_VERSION |
20 | QPEApplication a( argc, argv ); | 20 | QPEApplication a( argc, argv ); |
21 | a.setKeepRunning (); | 21 | a.setKeepRunning (); |
22 | #else | 22 | #else |
23 | QApplication a( argc, argv ); | 23 | QApplication a( argc, argv ); |
24 | QApplication::setStyle( new QPlatinumStyle ()); | 24 | QApplication::setStyle( new QPlatinumStyle ()); |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | bool exitHelp = false; | 27 | bool exitHelp = false; |
28 | if ( argc > 1 ) { | 28 | if ( argc > 1 ) { |
29 | QString command = argv[1]; | 29 | QString command = argv[1]; |
30 | if ( command == "-help" ){ | 30 | if ( command == "-help" ){ |
31 | printf("KA/E command line commands:\n"); | 31 | printf("KA/E command line commands:\n"); |
32 | printf(" no command: Start KA/E in usual way\n"); | 32 | printf(" no command: Start KA/E in usual way\n"); |
33 | printf(" -help: This output\n"); | 33 | printf(" -help: This output\n"); |
34 | printf(" KA/E is exiting now. Bye!\n"); | 34 | printf(" KA/E is exiting now. Bye!\n"); |
35 | exitHelp = true; | 35 | exitHelp = true; |
36 | } | 36 | } |
37 | } | 37 | } |
38 | if ( ! exitHelp ) { | 38 | if ( ! exitHelp ) { |
39 | 39 | ||
40 | KGlobal::setAppName( "kaddressbook" ); | 40 | KGlobal::setAppName( "kaddressbook" ); |
41 | #ifndef DESKTOP_VERSION | 41 | #ifndef DESKTOP_VERSION |
42 | if ( QApplication::desktop()->width() > 320 ) | 42 | if ( QApplication::desktop()->width() > 320 ) |
43 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 43 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
44 | else | 44 | else |
45 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 45 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
46 | #else | 46 | #else |
47 | QString fileName ; | 47 | QString fileName ; |
48 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 48 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
49 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 49 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
50 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 50 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
51 | 51 | ||
52 | #endif | 52 | #endif |
53 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 53 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
54 | KAddressBookMain m ; | 54 | KAddressBookMain m ; |
55 | //US MainWindow m; | 55 | //US MainWindow m; |
56 | //US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 56 | //US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); |
57 | 57 | ||
58 | #ifndef DESKTOP_VERSION | 58 | #ifndef DESKTOP_VERSION |
59 | a.showMainWidget( &m ); | 59 | a.showMainWidget( &m ); |
60 | #else | 60 | #else |
61 | a.setMainWidget( &m ); | 61 | a.setMainWidget( &m ); |
62 | m.resize (640, 480 ); | ||
62 | m.show(); | 63 | m.show(); |
63 | #endif | 64 | #endif |
64 | a.exec(); | 65 | a.exec(); |
65 | 66 | ||
66 | } | 67 | } |
67 | qDebug("KA: Bye! "); | 68 | qDebug("KA: Bye! "); |
68 | } | 69 | } |
69 | 70 | ||
70 | /* | 71 | /* |
71 | #include <stdlib.h> | 72 | #include <stdlib.h> |
72 | 73 | ||
73 | #include <qstring.h> | 74 | #include <qstring.h> |
74 | 75 | ||
75 | #include <kabc/stdaddressbook.h> | 76 | #include <kabc/stdaddressbook.h> |
76 | #include <kaboutdata.h> | 77 | #include <kaboutdata.h> |
77 | #include <kcmdlineargs.h> | 78 | #include <kcmdlineargs.h> |
78 | #include <kcrash.h> | 79 | #include <kcrash.h> |
79 | #include <kdebug.h> | 80 | #include <kdebug.h> |
80 | #include <klocale.h> | 81 | #include <klocale.h> |
81 | #include <kstartupinfo.h> | 82 | #include <kstartupinfo.h> |
82 | #include <kuniqueapplication.h> | 83 | #include <kuniqueapplication.h> |
83 | #include <kwin.h> | 84 | #include <kwin.h> |
84 | 85 | ||
85 | #include "kaddressbookmain.h" | 86 | #include "kaddressbookmain.h" |
86 | #include "kabcore.h" | 87 | #include "kabcore.h" |
87 | 88 | ||
88 | extern "C" { | 89 | extern "C" { |
89 | 90 | ||
90 | void crashHandler( int ) | 91 | void crashHandler( int ) |
91 | { | 92 | { |
92 | KABC::StdAddressBook::handleCrash(); | 93 | KABC::StdAddressBook::handleCrash(); |
93 | ::exit( 0 ); | 94 | ::exit( 0 ); |
94 | } | 95 | } |
95 | 96 | ||
96 | } | 97 | } |
97 | 98 | ||
98 | class KAddressBookApp : public KUniqueApplication { | 99 | class KAddressBookApp : public KUniqueApplication { |
99 | public: | 100 | public: |
100 | KAddressBookApp() : mMainWin( 0 ) {} | 101 | KAddressBookApp() : mMainWin( 0 ) {} |
101 | ~KAddressBookApp() {} | 102 | ~KAddressBookApp() {} |
102 | 103 | ||
103 | int newInstance(); | 104 | int newInstance(); |
104 | 105 | ||
105 | private: | 106 | private: |
106 | KAddressBookMain *mMainWin; | 107 | KAddressBookMain *mMainWin; |
107 | }; | 108 | }; |
108 | 109 | ||
109 | int KAddressBookApp::newInstance() | 110 | int KAddressBookApp::newInstance() |
110 | { | 111 | { |
111 | if ( isRestored() ) { | 112 | if ( isRestored() ) { |
112 | // There can only be one main window | 113 | // There can only be one main window |
113 | if ( KMainWindow::canBeRestored( 1 ) ) { | 114 | if ( KMainWindow::canBeRestored( 1 ) ) { |
114 | mMainWin = new KAddressBookMain; | 115 | mMainWin = new KAddressBookMain; |
115 | mMainWin->show(); | 116 | mMainWin->show(); |
116 | mMainWin->restore( 1 ); | 117 | mMainWin->restore( 1 ); |
117 | } | 118 | } |
118 | } else { | 119 | } else { |
119 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 120 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
120 | 121 | ||
121 | QCString addrStr = args->getOption( "addr" ); | 122 | QCString addrStr = args->getOption( "addr" ); |
122 | QCString uidStr = args->getOption( "uid" ); | 123 | QCString uidStr = args->getOption( "uid" ); |
123 | QString addr; | 124 | QString addr; |
124 | QString uid; | 125 | QString uid; |
125 | if ( !addrStr.isEmpty() ) | 126 | if ( !addrStr.isEmpty() ) |
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index 98b2fb2..9804e28 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp | |||
@@ -177,131 +177,131 @@ void ContactListViewItem::paintCell(QPainter * p, | |||
177 | int width, | 177 | int width, |
178 | int align) | 178 | int align) |
179 | { | 179 | { |
180 | KListViewItem::paintCell(p, cg, column, width, align); | 180 | KListViewItem::paintCell(p, cg, column, width, align); |
181 | 181 | ||
182 | if ( !p ) | 182 | if ( !p ) |
183 | return; | 183 | return; |
184 | 184 | ||
185 | if (parentListView->singleLine()) { | 185 | if (parentListView->singleLine()) { |
186 | p->setPen( parentListView->alternateColor() ); | 186 | p->setPen( parentListView->alternateColor() ); |
187 | p->drawLine( 0, height() - 1, width, height() - 1 ); | 187 | p->drawLine( 0, height() - 1, width, height() - 1 ); |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||
192 | ContactListView *ContactListViewItem::parent() | 192 | ContactListView *ContactListViewItem::parent() |
193 | { | 193 | { |
194 | return parentListView; | 194 | return parentListView; |
195 | } | 195 | } |
196 | 196 | ||
197 | 197 | ||
198 | void ContactListViewItem::refresh() | 198 | void ContactListViewItem::refresh() |
199 | { | 199 | { |
200 | // Update our addressee, since it may have changed else were | 200 | // Update our addressee, since it may have changed else were |
201 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 201 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
202 | if (mAddressee.isEmpty()) | 202 | if (mAddressee.isEmpty()) |
203 | return; | 203 | return; |
204 | 204 | ||
205 | int i = 0; | 205 | int i = 0; |
206 | KABC::Field::List::ConstIterator it; | 206 | KABC::Field::List::ConstIterator it; |
207 | for( it = mFields.begin(); it != mFields.end(); ++it ) { | 207 | for( it = mFields.begin(); it != mFields.end(); ++it ) { |
208 | setText( i++, (*it)->value( mAddressee ) ); | 208 | setText( i++, (*it)->value( mAddressee ) ); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | /////////////////////////////// | 212 | /////////////////////////////// |
213 | // ContactListView | 213 | // ContactListView |
214 | 214 | ||
215 | ContactListView::ContactListView(KAddressBookTableView *view, | 215 | ContactListView::ContactListView(KAddressBookTableView *view, |
216 | KABC::AddressBook* /* doc */, | 216 | KABC::AddressBook* /* doc */, |
217 | QWidget *parent, | 217 | QWidget *parent, |
218 | const char *name ) | 218 | const char *name ) |
219 | : KListView( parent, name ), | 219 | : KListView( parent, name ), |
220 | pabWidget( view ), | 220 | pabWidget( view ), |
221 | oldColumn( 0 ) | 221 | oldColumn( 0 ) |
222 | { | 222 | { |
223 | mABackground = true; | 223 | mABackground = true; |
224 | mSingleLine = false; | 224 | mSingleLine = false; |
225 | mToolTips = true; | 225 | mToolTips = true; |
226 | #ifndef KAB_EMBEDDED | 226 | #ifndef KAB_EMBEDDED |
227 | mAlternateColor = KGlobalSettings::alternateBackgroundColor(); | 227 | mAlternateColor = KGlobalSettings::alternateBackgroundColor(); |
228 | #else //KAB_EMBEDDED | 228 | #else //KAB_EMBEDDED |
229 | mAlternateColor = QColor(240, 240, 240); | 229 | mAlternateColor = QColor(240, 240, 240); |
230 | #endif //KAB_EMBEDDED | 230 | #endif //KAB_EMBEDDED |
231 | 231 | ||
232 | setAlternateBackgroundEnabled(mABackground); | 232 | setAlternateBackgroundEnabled(mABackground); |
233 | setAcceptDrops( true ); | 233 | setAcceptDrops( true ); |
234 | viewport()->setAcceptDrops( true ); | 234 | viewport()->setAcceptDrops( true ); |
235 | setAllColumnsShowFocus( true ); | 235 | setAllColumnsShowFocus( true ); |
236 | setShowSortIndicator(true); | 236 | setShowSortIndicator(true); |
237 | 237 | ||
238 | setSelectionModeExt( KListView::Extended ); | 238 | setSelectionModeExt( KListView::Extended ); |
239 | setDropVisualizer(false); | 239 | setDropVisualizer(false); |
240 | // setFrameStyle(QFrame::NoFrame); | 240 | // setFrameStyle(QFrame::NoFrame); |
241 | setLineWidth ( 0 ); | 241 | //setLineWidth ( 0 ); |
242 | setMidLineWidth ( 0 ); | 242 | //setMidLineWidth ( 0 ); |
243 | setMargin ( 0 ); | 243 | //setMargin ( 0 ); |
244 | #ifndef KAB_EMBEDDED | 244 | #ifndef KAB_EMBEDDED |
245 | connect(this, SIGNAL(dropped(QDropEvent*)), | 245 | connect(this, SIGNAL(dropped(QDropEvent*)), |
246 | this, SLOT(itemDropped(QDropEvent*))); | 246 | this, SLOT(itemDropped(QDropEvent*))); |
247 | #endif //KAB_EMBEDDED | 247 | #endif //KAB_EMBEDDED |
248 | 248 | ||
249 | 249 | ||
250 | new DynamicTip( this ); | 250 | new DynamicTip( this ); |
251 | } | 251 | } |
252 | 252 | ||
253 | void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) | 253 | void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) |
254 | { | 254 | { |
255 | QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); | 255 | QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); |
256 | 256 | ||
257 | // Get the brush, which will have the background pixmap if there is one. | 257 | // Get the brush, which will have the background pixmap if there is one. |
258 | if (b.pixmap()) | 258 | if (b.pixmap()) |
259 | { | 259 | { |
260 | p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), | 260 | p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), |
261 | *(b.pixmap()), | 261 | *(b.pixmap()), |
262 | rect.left() + contentsX(), | 262 | rect.left() + contentsX(), |
263 | rect.top() + contentsY() ); | 263 | rect.top() + contentsY() ); |
264 | } | 264 | } |
265 | 265 | ||
266 | else | 266 | else |
267 | { | 267 | { |
268 | // Do a normal paint | 268 | // Do a normal paint |
269 | KListView::paintEmptyArea(p, rect); | 269 | KListView::paintEmptyArea(p, rect); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
273 | void ContactListView::contentsMousePressEvent(QMouseEvent* e) | 273 | void ContactListView::contentsMousePressEvent(QMouseEvent* e) |
274 | { | 274 | { |
275 | presspos = e->pos(); | 275 | presspos = e->pos(); |
276 | KListView::contentsMousePressEvent(e); | 276 | KListView::contentsMousePressEvent(e); |
277 | } | 277 | } |
278 | 278 | ||
279 | 279 | ||
280 | // To initiate a drag operation | 280 | // To initiate a drag operation |
281 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) | 281 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) |
282 | { | 282 | { |
283 | if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { | 283 | if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { |
284 | emit startAddresseeDrag(); | 284 | emit startAddresseeDrag(); |
285 | } | 285 | } |
286 | else | 286 | else |
287 | KListView::contentsMouseMoveEvent( e ); | 287 | KListView::contentsMouseMoveEvent( e ); |
288 | } | 288 | } |
289 | 289 | ||
290 | bool ContactListView::acceptDrag(QDropEvent *e) const | 290 | bool ContactListView::acceptDrag(QDropEvent *e) const |
291 | { | 291 | { |
292 | #ifndef KAB_EMBEDDED | 292 | #ifndef KAB_EMBEDDED |
293 | return QTextDrag::canDecode(e); | 293 | return QTextDrag::canDecode(e); |
294 | #else //KAB_EMBEDDED | 294 | #else //KAB_EMBEDDED |
295 | qDebug("ContactListView::acceptDrag has to be fixed"); | 295 | qDebug("ContactListView::acceptDrag has to be fixed"); |
296 | return false; | 296 | return false; |
297 | #endif //KAB_EMBEDDED | 297 | #endif //KAB_EMBEDDED |
298 | } | 298 | } |
299 | 299 | ||
300 | void ContactListView::itemDropped(QDropEvent *e) | 300 | void ContactListView::itemDropped(QDropEvent *e) |
301 | { | 301 | { |
302 | contentsDropEvent(e); | 302 | contentsDropEvent(e); |
303 | } | 303 | } |
304 | 304 | ||
305 | void ContactListView::contentsDropEvent( QDropEvent *e ) | 305 | void ContactListView::contentsDropEvent( QDropEvent *e ) |
306 | { | 306 | { |
307 | emit addresseeDropped(e); | 307 | emit addresseeDropped(e); |
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp index 9eee912..1394154 100644 --- a/microkde/kdecore/klibloader.cpp +++ b/microkde/kdecore/klibloader.cpp | |||
@@ -317,143 +317,150 @@ KLibLoader* KLibLoader::s_self = 0; | |||
317 | KLibLoader* KLibLoader::self() | 317 | KLibLoader* KLibLoader::self() |
318 | { | 318 | { |
319 | if ( !s_self ) | 319 | if ( !s_self ) |
320 | s_self = new KLibLoader; | 320 | s_self = new KLibLoader; |
321 | return s_self; | 321 | return s_self; |
322 | } | 322 | } |
323 | 323 | ||
324 | void KLibLoader::cleanUp() | 324 | void KLibLoader::cleanUp() |
325 | { | 325 | { |
326 | if ( !s_self ) | 326 | if ( !s_self ) |
327 | return; | 327 | return; |
328 | 328 | ||
329 | delete s_self; | 329 | delete s_self; |
330 | s_self = 0; | 330 | s_self = 0; |
331 | } | 331 | } |
332 | 332 | ||
333 | KLibLoader::KLibLoader( QObject* parent, const char* name ) | 333 | KLibLoader::KLibLoader( QObject* parent, const char* name ) |
334 | : QObject( parent, name ) | 334 | : QObject( parent, name ) |
335 | { | 335 | { |
336 | s_self = this; | 336 | s_self = this; |
337 | d = new KLibLoaderPrivate; | 337 | d = new KLibLoaderPrivate; |
338 | //US lt_dlinit(); | 338 | //US lt_dlinit(); |
339 | d->unload_mode = KLibLoaderPrivate::UNKNOWN; | 339 | d->unload_mode = KLibLoaderPrivate::UNKNOWN; |
340 | if (getenv("KDE_NOUNLOAD") != 0) | 340 | if (getenv("KDE_NOUNLOAD") != 0) |
341 | d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD; | 341 | d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD; |
342 | else if (getenv("KDE_DOUNLOAD") != 0) | 342 | else if (getenv("KDE_DOUNLOAD") != 0) |
343 | d->unload_mode = KLibLoaderPrivate::UNLOAD; | 343 | d->unload_mode = KLibLoaderPrivate::UNLOAD; |
344 | d->loaded_stack.setAutoDelete( true ); | 344 | d->loaded_stack.setAutoDelete( true ); |
345 | } | 345 | } |
346 | 346 | ||
347 | KLibLoader::~KLibLoader() | 347 | KLibLoader::~KLibLoader() |
348 | { | 348 | { |
349 | // kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl; | 349 | // kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl; |
350 | 350 | ||
351 | QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); | 351 | QAsciiDictIterator<KLibWrapPrivate> it( m_libs ); |
352 | for (; it.current(); ++it ) | 352 | for (; it.current(); ++it ) |
353 | { | 353 | { |
354 | kdDebug(150) << "The KLibLoader contains the library " << it.current()->name | 354 | kdDebug(150) << "The KLibLoader contains the library " << it.current()->name |
355 | << " (" << it.current()->lib << ")" << endl; | 355 | << " (" << it.current()->lib << ")" << endl; |
356 | d->pending_close.append(it.current()); | 356 | d->pending_close.append(it.current()); |
357 | } | 357 | } |
358 | 358 | ||
359 | close_pending(0); | 359 | close_pending(0); |
360 | 360 | ||
361 | delete d; | 361 | delete d; |
362 | } | 362 | } |
363 | 363 | ||
364 | //static | 364 | //static |
365 | QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ ) | 365 | QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ ) |
366 | { | 366 | { |
367 | QCString libname( name ); | 367 | QCString libname( name ); |
368 | 368 | ||
369 | // only append ".la" if there is no extension | 369 | // only append ".la" if there is no extension |
370 | // this allows to load non-libtool libraries as well | 370 | // this allows to load non-libtool libraries as well |
371 | // (mhk, 20000228) | 371 | // (mhk, 20000228) |
372 | int pos = libname.findRev('/'); | 372 | int pos = libname.findRev('/'); |
373 | if (pos < 0) | 373 | if (pos < 0) |
374 | pos = 0; | 374 | pos = 0; |
375 | /*US | 375 | /*US |
376 | if (libname.find('.', pos) < 0) { | 376 | if (libname.find('.', pos) < 0) { |
377 | libname += ".la"; | 377 | libname += ".la"; |
378 | } | 378 | } |
379 | */ | 379 | */ |
380 | //US in the microedition we work only with shared libraries. | 380 | //US in the microedition we work only with shared libraries. |
381 | |||
381 | if (libname.find('.', pos) < 0) { | 382 | if (libname.find('.', pos) < 0) { |
383 | #ifdef _WIN32_ | ||
384 | libname += ".dll"; | ||
385 | #else | ||
382 | libname += ".so"; | 386 | libname += ".so"; |
387 | #endif | ||
383 | } | 388 | } |
384 | 389 | ||
385 | // only look up the file if it is not an absolute filename | 390 | // only look up the file if it is not an absolute filename |
386 | // (mhk, 20000228) | 391 | // (mhk, 20000228) |
387 | QString libfile; | 392 | QString libfile; |
388 | if (libname[0] == '/') | 393 | if (libname[0] == '/') |
389 | libfile = libname; | 394 | libfile = libname; |
390 | else | 395 | else |
391 | { | 396 | { |
392 | //US at this point the libname must exist as real filesname. No expansions will be made later | 397 | //US at this point the libname must exist as real filesname. No expansions will be made later |
393 | // in findResources. Because of that we prepend the lib prefix here to the name | 398 | // in findResources. Because of that we prepend the lib prefix here to the name |
394 | //US I add also the "lib" prefix. I do not how could this could have worked before without it? | 399 | //US I add also the "lib" prefix. I do not how could this could have worked before without it? |
400 | #ifndef _WIN32_ | ||
395 | libname.insert(pos, "lib"); | 401 | libname.insert(pos, "lib"); |
402 | #endif | ||
396 | 403 | ||
397 | 404 | ||
398 | //US libfile = instance->dirs()->findResource( "module", libname ); | 405 | //US libfile = instance->dirs()->findResource( "module", libname ); |
399 | //qDebug("libname = %s ",libname.data() ); | 406 | //qDebug("libname = %s ",libname.data() ); |
400 | libfile = KGlobal::dirs()->findResource( "module", libname ); | 407 | libfile = KGlobal::dirs()->findResource( "module", libname ); |
401 | //qDebug("libfile = %s ",libfile.latin1() ); | 408 | //qDebug("libfile = %s ",libfile.latin1() ); |
402 | 409 | ||
403 | if ( libfile.isEmpty() ) | 410 | if ( libfile.isEmpty() ) |
404 | { | 411 | { |
405 | //US libfile = instance->dirs()->findResource( "lib", libname ); | 412 | //US libfile = instance->dirs()->findResource( "lib", libname ); |
406 | libfile = KGlobal::dirs()->findResource( "lib", libname ); | 413 | libfile = KGlobal::dirs()->findResource( "lib", libname ); |
407 | //qDebug("libfile2 = %s ",libfile.latin1() ); | 414 | //qDebug("libfile2 = %s ",libfile.latin1() ); |
408 | #ifndef NDEBUG | 415 | #ifndef NDEBUG |
409 | if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules | 416 | if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules |
410 | kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl; | 417 | kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl; |
411 | #endif | 418 | #endif |
412 | } | 419 | } |
413 | if ( libfile.isEmpty() ) | 420 | if ( libfile.isEmpty() ) |
414 | { | 421 | { |
415 | #ifndef NDEBUG | 422 | #ifndef NDEBUG |
416 | kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl; | 423 | kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl; |
417 | self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname); | 424 | self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname); |
418 | 425 | ||
419 | qDebug("KLibLoader::library could not find library: %s", libname.data()); | 426 | qDebug("KLibLoader::library could not find library: %s", libname.data()); |
420 | #endif | 427 | #endif |
421 | 428 | ||
422 | } | 429 | } |
423 | else | 430 | else |
424 | self()->d->errorMessage = QString::null; | 431 | self()->d->errorMessage = QString::null; |
425 | } | 432 | } |
426 | 433 | ||
427 | //qDebug("return libfile = %s ",libfile.latin1() ); | 434 | //qDebug("return libfile = %s ",libfile.latin1() ); |
428 | return libfile; | 435 | return libfile; |
429 | } | 436 | } |
430 | 437 | ||
431 | 438 | ||
432 | KLibrary* KLibLoader::globalLibrary( const char *name ) | 439 | KLibrary* KLibLoader::globalLibrary( const char *name ) |
433 | { | 440 | { |
434 | KLibrary *tmp; | 441 | KLibrary *tmp; |
435 | /*US | 442 | /*US |
436 | int olt_dlopen_flag = lt_dlopen_flag; | 443 | int olt_dlopen_flag = lt_dlopen_flag; |
437 | 444 | ||
438 | lt_dlopen_flag |= LT_GLOBAL; | 445 | lt_dlopen_flag |= LT_GLOBAL; |
439 | kdDebug(150) << "Loading the next library global with flag " | 446 | kdDebug(150) << "Loading the next library global with flag " |
440 | << lt_dlopen_flag | 447 | << lt_dlopen_flag |
441 | << "." << endl; | 448 | << "." << endl; |
442 | */ | 449 | */ |
443 | tmp = library(name); | 450 | tmp = library(name); |
444 | /*US | 451 | /*US |
445 | lt_dlopen_flag = olt_dlopen_flag; | 452 | lt_dlopen_flag = olt_dlopen_flag; |
446 | */ | 453 | */ |
447 | return tmp; | 454 | return tmp; |
448 | } | 455 | } |
449 | 456 | ||
450 | 457 | ||
451 | KLibrary* KLibLoader::library( const char *name ) | 458 | KLibrary* KLibLoader::library( const char *name ) |
452 | { | 459 | { |
453 | if (!name) | 460 | if (!name) |
454 | return 0; | 461 | return 0; |
455 | 462 | ||
456 | KLibWrapPrivate* wrap = m_libs[name]; | 463 | KLibWrapPrivate* wrap = m_libs[name]; |
457 | if (wrap) { | 464 | if (wrap) { |
458 | /* Nothing to do to load the library. */ | 465 | /* Nothing to do to load the library. */ |
459 | wrap->ref_count++; | 466 | wrap->ref_count++; |