-rw-r--r-- | library/filemanager.cpp | 67 | ||||
-rw-r--r-- | library/fontdatabase.cpp | 4 | ||||
-rw-r--r-- | library/global.cpp | 4 | ||||
-rw-r--r-- | library/library.pro | 2 | ||||
-rw-r--r-- | library/network.cpp | 4 | ||||
-rw-r--r-- | library/qlibrary_unix.cpp | 113 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 29 | ||||
-rw-r--r-- | library/qpedecoration_qws.cpp | 8 | ||||
-rw-r--r-- | library/sound.cpp | 3 | ||||
-rw-r--r-- | library/storage.cpp | 42 |
10 files changed, 255 insertions, 21 deletions
diff --git a/library/filemanager.cpp b/library/filemanager.cpp index cc657fa..91986a0 100644 --- a/library/filemanager.cpp +++ b/library/filemanager.cpp | |||
@@ -26,17 +26,26 @@ | |||
26 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
27 | #include <qtextcodec.h> | 27 | #include <qtextcodec.h> |
28 | 28 | ||
29 | #include <errno.h> | 29 | #include <errno.h> |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | #include <unistd.h> | 31 | #include <unistd.h> |
32 | #include <sys/stat.h> | 32 | #include <sys/stat.h> |
33 | #include <dirent.h> | 33 | #include <dirent.h> |
34 | #include <sys/sendfile.h> | 34 | #ifdef Q_OS_MACX |
35 | // MacOS X does not have sendfile.. :( | ||
36 | // But maybe in the future.. !? | ||
37 | # ifdef SENDFILE | ||
38 | # include <sys/types.h> | ||
39 | # include <sys/socket.h> | ||
40 | # endif | ||
41 | #else | ||
42 | # include <sys/sendfile.h> | ||
43 | #endif /* Q_OS_MACX */ | ||
35 | #include <fcntl.h> | 44 | #include <fcntl.h> |
36 | 45 | ||
37 | /*! | 46 | /*! |
38 | \class FileManager | 47 | \class FileManager |
39 | \brief The FileManager class assists with AppLnk input/output. | 48 | \brief The FileManager class assists with AppLnk input/output. |
40 | */ | 49 | */ |
41 | 50 | ||
42 | /*! | 51 | /*! |
@@ -211,16 +220,18 @@ bool FileManager::copyFile( const AppLnk &src, const AppLnk &dest ) | |||
211 | } | 220 | } |
212 | } else { | 221 | } else { |
213 | QFile::remove( fn.latin1() ); | 222 | QFile::remove( fn.latin1() ); |
214 | } | 223 | } |
215 | 224 | ||
216 | return ok; | 225 | return ok; |
217 | } | 226 | } |
218 | 227 | ||
228 | |||
229 | |||
219 | bool FileManager::copyFile( const QString & src, const QString & dest ) { | 230 | bool FileManager::copyFile( const QString & src, const QString & dest ) { |
220 | bool success = true; | 231 | bool success = true; |
221 | struct stat status; | 232 | struct stat status; |
222 | int read_fd=0; | 233 | int read_fd=0; |
223 | int write_fd=0; | 234 | int write_fd=0; |
224 | struct stat stat_buf; | 235 | struct stat stat_buf; |
225 | off_t offset = 0; | 236 | off_t offset = 0; |
226 | QFile srcFile(src); | 237 | QFile srcFile(src); |
@@ -233,27 +244,59 @@ bool FileManager::copyFile( const QString & src, const QString & dest ) { | |||
233 | if(read_fd != -1) { | 244 | if(read_fd != -1) { |
234 | fstat (read_fd, &stat_buf); | 245 | fstat (read_fd, &stat_buf); |
235 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) | 246 | if( !destFile.open( IO_WriteOnly|IO_Raw ) ) |
236 | return success = false; | 247 | return success = false; |
237 | write_fd = destFile.handle(); | 248 | write_fd = destFile.handle(); |
238 | if(write_fd != -1) { | 249 | if(write_fd != -1) { |
239 | int err=0; | 250 | int err=0; |
240 | QString msg; | 251 | QString msg; |
241 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); | 252 | #ifdef Q_OS_MACX |
242 | if( err == -1) { | 253 | #ifdef SENDMAIL |
243 | switch(err) { | 254 | /* FreeBSD does support a different kind of |
244 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; | 255 | * sendfile. (eilers) |
245 | case EINVAL: msg = "Descriptor is not valid or locked. "; | 256 | * I took this from Very Secure FTPd |
246 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; | 257 | * Licence: GPL |
247 | case EIO: msg = "Unspecified error while reading from in_fd."; | 258 | * Author: Chris Evans |
248 | }; | 259 | * sysdeputil.c |
249 | success = false; | 260 | */ |
250 | } | 261 | /* XXX - start_pos will truncate on 32-bit machines - can we |
251 | } else { | 262 | * say "start from current pos"? |
263 | */ | ||
264 | off_t written = 0; | ||
265 | int retval = 0; | ||
266 | retval = sendfile(read_fd, write_fd, offset, stat_buf.st_size, NULL, | ||
267 | &written, 0); | ||
268 | /* Translate to Linux-like retval */ | ||
269 | if (written > 0) | ||
270 | { | ||
271 | err = (int) written; | ||
272 | } | ||
273 | #else /* SENDMAIL */ | ||
274 | err == -1; | ||
275 | msg = "FAILURE: Using unsupported function \"sendfile()\" Need Workaround !!"; | ||
276 | success = false; | ||
277 | # warning "Need workaround for sendfile!!(eilers)" | ||
278 | #endif /* SENDMAIL */ | ||
279 | |||
280 | #else | ||
281 | err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); | ||
282 | if( err == -1) { | ||
283 | switch(err) { | ||
284 | case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; | ||
285 | case EINVAL: msg = "Descriptor is not valid or locked. "; | ||
286 | case ENOMEM: msg = "Insufficient memory to read from in_fd."; | ||
287 | case EIO: msg = "Unspecified error while reading from in_fd."; | ||
288 | }; | ||
289 | success = false; | ||
290 | } | ||
291 | #endif /* Q_OS_MACX */ | ||
292 | if( !success ) | ||
293 | qWarning( msg ); | ||
294 | } else { | ||
252 | qWarning("open write failed %s, %s",src.latin1(), dest.latin1()); | 295 | qWarning("open write failed %s, %s",src.latin1(), dest.latin1()); |
253 | success = false; | 296 | success = false; |
254 | } | 297 | } |
255 | } else { | 298 | } else { |
256 | qWarning("open read failed %s, %s",src.latin1(), dest.latin1()); | 299 | qWarning("open read failed %s, %s",src.latin1(), dest.latin1()); |
257 | success = false; | 300 | success = false; |
258 | } | 301 | } |
259 | srcFile.close(); | 302 | srcFile.close(); |
diff --git a/library/fontdatabase.cpp b/library/fontdatabase.cpp index c7a5211..2ad8e95 100644 --- a/library/fontdatabase.cpp +++ b/library/fontdatabase.cpp | |||
@@ -165,17 +165,21 @@ void FontDatabase::loadRenderers() | |||
165 | qt_fontmanager->factories.setAutoDelete( true ); | 165 | qt_fontmanager->factories.setAutoDelete( true ); |
166 | (*mit).interface->release(); | 166 | (*mit).interface->release(); |
167 | (*mit).library->unload(); | 167 | (*mit).library->unload(); |
168 | delete (*mit).library; | 168 | delete (*mit).library; |
169 | } | 169 | } |
170 | factoryList->clear(); | 170 | factoryList->clear(); |
171 | 171 | ||
172 | QString path = QPEApplication::qpeDir() + "/plugins/fontfactories"; | 172 | QString path = QPEApplication::qpeDir() + "/plugins/fontfactories"; |
173 | #ifdef Q_OS_MACX | ||
174 | QDir dir( path, "lib*.dylib" ); | ||
175 | #else | ||
173 | QDir dir( path, "lib*.so" ); | 176 | QDir dir( path, "lib*.so" ); |
177 | #endif | ||
174 | 178 | ||
175 | if ( !dir.exists()) | 179 | if ( !dir.exists()) |
176 | return; | 180 | return; |
177 | 181 | ||
178 | QStringList list = dir.entryList(); | 182 | QStringList list = dir.entryList(); |
179 | QStringList::Iterator it; | 183 | QStringList::Iterator it; |
180 | for ( it = list.begin(); it != list.end(); ++it ) { | 184 | for ( it = list.begin(); it != list.end(); ++it ) { |
181 | FontFactoryInterface *iface = 0; | 185 | FontFactoryInterface *iface = 0; |
diff --git a/library/global.cpp b/library/global.cpp index 90954fe..05d23ac 100644 --- a/library/global.cpp +++ b/library/global.cpp | |||
@@ -599,17 +599,21 @@ void Global::invoke(const QString &c) | |||
599 | 599 | ||
600 | #if !defined(QT_NO_COP) | 600 | #if !defined(QT_NO_COP) |
601 | // an attempt to show a wait... | 601 | // an attempt to show a wait... |
602 | // more logic should be used, but this will be fine for the moment... | 602 | // more logic should be used, but this will be fine for the moment... |
603 | QCopEnvelope ( "QPE/System", "busy()" ); | 603 | QCopEnvelope ( "QPE/System", "busy()" ); |
604 | #endif | 604 | #endif |
605 | 605 | ||
606 | #ifdef HAVE_QUICKEXEC | 606 | #ifdef HAVE_QUICKEXEC |
607 | #ifdef Q_OS_MACX | ||
608 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".dylib"; | ||
609 | #else | ||
607 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; | 610 | QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; |
611 | #endif | ||
608 | qDebug("libfile = %s", libexe.latin1() ); | 612 | qDebug("libfile = %s", libexe.latin1() ); |
609 | if ( QFile::exists( libexe ) ) { | 613 | if ( QFile::exists( libexe ) ) { |
610 | qDebug("calling quickexec %s", libexe.latin1() ); | 614 | qDebug("calling quickexec %s", libexe.latin1() ); |
611 | quickexecv( libexe.utf8().data(), (const char **)args ); | 615 | quickexecv( libexe.utf8().data(), (const char **)args ); |
612 | } else | 616 | } else |
613 | #endif | 617 | #endif |
614 | { | 618 | { |
615 | bool success = false; | 619 | bool success = false; |
diff --git a/library/library.pro b/library/library.pro index ab1f451..5acfc0c 100644 --- a/library/library.pro +++ b/library/library.pro | |||
@@ -119,17 +119,17 @@ SOURCES = calendar.cpp \ | |||
119 | qt_override.cpp | 119 | qt_override.cpp |
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | # Qt 3 compatibility | 123 | # Qt 3 compatibility |
124 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h | 124 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h |
125 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp | 125 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp |
126 | INCLUDEPATH += $(OPIEDIR)/include backend | 126 | INCLUDEPATH += $(OPIEDIR)/include backend |
127 | LIBS += -ldl -lcrypt -lm | 127 | # LIBS += -ldl -lcrypt -lm |
128 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui | 128 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui |
129 | TARGET = qpe | 129 | TARGET = qpe |
130 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 130 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
131 | VERSION = 1.5.0.1 | 131 | VERSION = 1.5.0.1 |
132 | 132 | ||
133 | TRANSLATIONS = ../i18n/de/libqpe.ts \ | 133 | TRANSLATIONS = ../i18n/de/libqpe.ts \ |
134 | ../i18n/nl/libqpe.ts \ | 134 | ../i18n/nl/libqpe.ts \ |
135 | ../i18n/xx/libqpe.ts \ | 135 | ../i18n/xx/libqpe.ts \ |
diff --git a/library/network.cpp b/library/network.cpp index 3568809..991e11a 100644 --- a/library/network.cpp +++ b/library/network.cpp | |||
@@ -413,17 +413,21 @@ static QDict<NetworkInterface> *ifaces; | |||
413 | \internal | 413 | \internal |
414 | */ | 414 | */ |
415 | NetworkInterface* Network::loadPlugin(const QString& type) | 415 | NetworkInterface* Network::loadPlugin(const QString& type) |
416 | { | 416 | { |
417 | #ifndef QT_NO_COMPONENT | 417 | #ifndef QT_NO_COMPONENT |
418 | if ( !ifaces ) ifaces = new QDict<NetworkInterface>; | 418 | if ( !ifaces ) ifaces = new QDict<NetworkInterface>; |
419 | NetworkInterface *iface = ifaces->find(type); | 419 | NetworkInterface *iface = ifaces->find(type); |
420 | if ( !iface ) { | 420 | if ( !iface ) { |
421 | #ifdef Q_OS_MACX | ||
422 | QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".dylib"; | ||
423 | #else | ||
421 | QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".so"; | 424 | QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".so"; |
425 | #endif | ||
422 | QLibrary lib(libfile); | 426 | QLibrary lib(libfile); |
423 | if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK ) | 427 | if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK ) |
424 | return 0; | 428 | return 0; |
425 | ifaces->insert(type,iface); | 429 | ifaces->insert(type,iface); |
426 | QStringList langs = Global::languageList(); | 430 | QStringList langs = Global::languageList(); |
427 | for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { | 431 | for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { |
428 | QString lang = *it; | 432 | QString lang = *it; |
429 | QTranslator * trans = new QTranslator(qApp); | 433 | QTranslator * trans = new QTranslator(qApp); |
diff --git a/library/qlibrary_unix.cpp b/library/qlibrary_unix.cpp index 7740321..0229b7b 100644 --- a/library/qlibrary_unix.cpp +++ b/library/qlibrary_unix.cpp | |||
@@ -71,17 +71,128 @@ void* QLibraryPrivate::resolveSymbol( const char* symbol ) | |||
71 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | 71 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) |
72 | qDebug( "Couldn't resolve symbol \"%s\"", symbol ); | 72 | qDebug( "Couldn't resolve symbol \"%s\"", symbol ); |
73 | #endif | 73 | #endif |
74 | return 0; | 74 | return 0; |
75 | } | 75 | } |
76 | return address; | 76 | return address; |
77 | } | 77 | } |
78 | 78 | ||
79 | #else // Q_OS_HPUX | 79 | #elif defined(_NULL_LIB_) |
80 | |||
81 | bool QLibraryPrivate::loadLibrary() | ||
82 | { | ||
83 | //qDebug("QLibraryPrivate::loadLibrary\n"); | ||
84 | return FALSE; | ||
85 | } | ||
86 | bool QLibraryPrivate::freeLibrary() | ||
87 | { | ||
88 | //qDebug("QLibraryPrivate::freeLibrary\n"); | ||
89 | return FALSE; | ||
90 | } | ||
91 | void* QLibraryPrivate::resolveSymbol( const char* symbol ) | ||
92 | { | ||
93 | //qDebug("QLibraryPrivate::resolveSymbol\n"); | ||
94 | return FALSE; | ||
95 | } | ||
96 | |||
97 | #elif defined(Q_OS_MACX) | ||
98 | |||
99 | #define ENUM_DYLD_BOOL | ||
100 | enum DYLD_BOOL { | ||
101 | DYLD_FALSE, | ||
102 | DYLD_TRUE | ||
103 | }; | ||
104 | #include <mach-o/dyld.h> | ||
105 | typedef struct { | ||
106 | NSObjectFileImage img; | ||
107 | NSModule mod; | ||
108 | } DyldLibDesc; | ||
109 | |||
110 | bool QLibraryPrivate::loadLibrary() | ||
111 | { | ||
112 | // qDebug("QLibraryPrivate::loadLibrary\n"); | ||
113 | // return FALSE; | ||
114 | if ( pHnd ) | ||
115 | return TRUE; | ||
116 | |||
117 | QString filename = library->library(); | ||
118 | |||
119 | NSObjectFileImage img = 0; | ||
120 | NSModule mod = 0; | ||
121 | NSObjectFileImageReturnCode ret = NSCreateObjectFileImageFromFile( filename.latin1() , &img ); | ||
122 | if ( ret != NSObjectFileImageSuccess ) { | ||
123 | qWarning( "Error in NSCreateObjectFileImageFromFile(): %d; Filename: %s", ret, filename.latin1() ); | ||
124 | if (ret == NSObjectFileImageAccess) { | ||
125 | qWarning ("(NSObjectFileImageAccess)" ); | ||
126 | } | ||
127 | } else { | ||
128 | mod = NSLinkModule(img, filename.latin1(), NSLINKMODULE_OPTION_BINDNOW | | ||
129 | NSLINKMODULE_OPTION_PRIVATE | | ||
130 | NSLINKMODULE_OPTION_RETURN_ON_ERROR); | ||
131 | if (mod == 0) { | ||
132 | qWarning( "Error in NSLinkModule()" ); | ||
133 | NSDestroyObjectFileImage(img); | ||
134 | } | ||
135 | } | ||
136 | DyldLibDesc* desc = 0; | ||
137 | if (img != 0 && mod != 0) { | ||
138 | desc = new DyldLibDesc; | ||
139 | desc->img = img; | ||
140 | desc->mod = mod; | ||
141 | } | ||
142 | pHnd = desc; | ||
143 | return pHnd != 0; | ||
144 | } | ||
145 | |||
146 | bool QLibraryPrivate::freeLibrary() | ||
147 | { | ||
148 | //qDebug("QLibraryPrivate::freeLibrary\n"); | ||
149 | //return FALSE; | ||
150 | if ( !pHnd ) | ||
151 | return TRUE; | ||
152 | |||
153 | DyldLibDesc* desc = (DyldLibDesc*) pHnd; | ||
154 | NSModule mod = desc->mod; | ||
155 | NSObjectFileImage img = desc->img; | ||
156 | DYLD_BOOL success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE); | ||
157 | if ( success ) { | ||
158 | NSDestroyObjectFileImage(img); | ||
159 | delete desc; | ||
160 | pHnd = 0; | ||
161 | } | ||
162 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | ||
163 | else { | ||
164 | qWarning( "Error in NSUnLinkModule(): %d", ret ); | ||
165 | } | ||
166 | #endif | ||
167 | return pHnd == 0; | ||
168 | } | ||
169 | |||
170 | void* QLibraryPrivate::resolveSymbol( const char* symbol ) | ||
171 | { | ||
172 | //qDebug("QLibraryPrivate::resolveSymbol\n"); | ||
173 | //return FALSE; | ||
174 | if ( !pHnd ) | ||
175 | return 0; | ||
176 | |||
177 | DyldLibDesc* desc = (DyldLibDesc*) pHnd; | ||
178 | NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol); | ||
179 | void* address = 0; | ||
180 | if (sym != 0) { | ||
181 | address = NSAddressOfSymbol(sym); | ||
182 | } | ||
183 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | ||
184 | if ( address == 0 ) | ||
185 | qWarning( "Cannot find symbol: %s", symbol ); | ||
186 | #endif | ||
187 | return address; | ||
188 | } | ||
189 | |||
190 | #else | ||
80 | // Something else, assuming POSIX | 191 | // Something else, assuming POSIX |
81 | #include <dlfcn.h> | 192 | #include <dlfcn.h> |
82 | 193 | ||
83 | bool QLibraryPrivate::loadLibrary() | 194 | bool QLibraryPrivate::loadLibrary() |
84 | { | 195 | { |
85 | if ( pHnd ) | 196 | if ( pHnd ) |
86 | return TRUE; | 197 | return TRUE; |
87 | 198 | ||
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index d4734ae..a97efc0 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -15,17 +15,19 @@ | |||
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 | #define QTOPIA_INTERNAL_LANGLIST | 20 | #define QTOPIA_INTERNAL_LANGLIST |
21 | #include <stdlib.h> | 21 | #include <stdlib.h> |
22 | #include <unistd.h> | 22 | #include <unistd.h> |
23 | #ifndef Q_OS_MACX | ||
23 | #include <linux/limits.h> // needed for some toolchains (PATH_MAX) | 24 | #include <linux/limits.h> // needed for some toolchains (PATH_MAX) |
25 | #endif | ||
24 | #include <qfile.h> | 26 | #include <qfile.h> |
25 | #include <qqueue.h> | 27 | #include <qqueue.h> |
26 | #ifdef Q_WS_QWS | 28 | #ifdef Q_WS_QWS |
27 | #ifndef QT_NO_COP | 29 | #ifndef QT_NO_COP |
28 | #if QT_VERSION <= 231 | 30 | #if QT_VERSION <= 231 |
29 | #define private public | 31 | #define private public |
30 | #define sendLocally processEvent | 32 | #define sendLocally processEvent |
31 | #include "qcopenvelope_qws.h" | 33 | #include "qcopenvelope_qws.h" |
@@ -84,18 +86,19 @@ | |||
84 | #include "applnk.h" | 86 | #include "applnk.h" |
85 | #include "qpemenubar.h" | 87 | #include "qpemenubar.h" |
86 | #include "textcodecinterface.h" | 88 | #include "textcodecinterface.h" |
87 | #include "imagecodecinterface.h" | 89 | #include "imagecodecinterface.h" |
88 | 90 | ||
89 | #include <unistd.h> | 91 | #include <unistd.h> |
90 | #include <sys/file.h> | 92 | #include <sys/file.h> |
91 | #include <sys/ioctl.h> | 93 | #include <sys/ioctl.h> |
94 | #ifndef QT_NO_SOUND | ||
92 | #include <sys/soundcard.h> | 95 | #include <sys/soundcard.h> |
93 | 96 | #endif | |
94 | #include "qt_override_p.h" | 97 | #include "qt_override_p.h" |
95 | 98 | ||
96 | 99 | ||
97 | class QPEApplicationData | 100 | class QPEApplicationData |
98 | { | 101 | { |
99 | public: | 102 | public: |
100 | QPEApplicationData ( ) | 103 | QPEApplicationData ( ) |
101 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), | 104 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), |
@@ -228,17 +231,21 @@ public: | |||
228 | else if ( keep_running ) { | 231 | else if ( keep_running ) { |
229 | show_mx(mw, nomax); | 232 | show_mx(mw, nomax); |
230 | } | 233 | } |
231 | } | 234 | } |
232 | 235 | ||
233 | void loadTextCodecs() | 236 | void loadTextCodecs() |
234 | { | 237 | { |
235 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; | 238 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; |
239 | #ifdef Q_OS_MACX | ||
240 | QDir dir( path, "lib*.dylib" ); | ||
241 | #else | ||
236 | QDir dir( path, "lib*.so" ); | 242 | QDir dir( path, "lib*.so" ); |
243 | #endif | ||
237 | QStringList list; | 244 | QStringList list; |
238 | if ( dir. exists ( )) | 245 | if ( dir. exists ( )) |
239 | list = dir.entryList(); | 246 | list = dir.entryList(); |
240 | QStringList::Iterator it; | 247 | QStringList::Iterator it; |
241 | for ( it = list.begin(); it != list.end(); ++it ) { | 248 | for ( it = list.begin(); it != list.end(); ++it ) { |
242 | TextCodecInterface *iface = 0; | 249 | TextCodecInterface *iface = 0; |
243 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 250 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
244 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 251 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
@@ -253,17 +260,21 @@ public: | |||
253 | delete lib; | 260 | delete lib; |
254 | } | 261 | } |
255 | } | 262 | } |
256 | } | 263 | } |
257 | 264 | ||
258 | void loadImageCodecs() | 265 | void loadImageCodecs() |
259 | { | 266 | { |
260 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; | 267 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; |
268 | #ifdef Q_OS_MACX | ||
269 | QDir dir( path, "lib*.dylib" ); | ||
270 | #else | ||
261 | QDir dir( path, "lib*.so" ); | 271 | QDir dir( path, "lib*.so" ); |
272 | #endif | ||
262 | QStringList list; | 273 | QStringList list; |
263 | if ( dir. exists ( )) | 274 | if ( dir. exists ( )) |
264 | list = dir.entryList(); | 275 | list = dir.entryList(); |
265 | QStringList::Iterator it; | 276 | QStringList::Iterator it; |
266 | for ( it = list.begin(); it != list.end(); ++it ) { | 277 | for ( it = list.begin(); it != list.end(); ++it ) { |
267 | ImageCodecInterface *iface = 0; | 278 | ImageCodecInterface *iface = 0; |
268 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 279 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
269 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 280 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
@@ -335,86 +346,94 @@ static int micMuted = 0; | |||
335 | static void setVolume( int t = 0, int percent = -1 ) | 346 | static void setVolume( int t = 0, int percent = -1 ) |
336 | { | 347 | { |
337 | switch ( t ) { | 348 | switch ( t ) { |
338 | case 0: { | 349 | case 0: { |
339 | Config cfg( "qpe" ); | 350 | Config cfg( "qpe" ); |
340 | cfg.setGroup( "Volume" ); | 351 | cfg.setGroup( "Volume" ); |
341 | if ( percent < 0 ) | 352 | if ( percent < 0 ) |
342 | percent = cfg.readNumEntry( "VolumePercent", 50 ); | 353 | percent = cfg.readNumEntry( "VolumePercent", 50 ); |
354 | #ifndef QT_NO_SOUND | ||
343 | int fd = 0; | 355 | int fd = 0; |
344 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 356 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
345 | int vol = muted ? 0 : percent; | 357 | int vol = muted ? 0 : percent; |
346 | // set both channels to same volume | 358 | // set both channels to same volume |
347 | vol |= vol << 8; | 359 | vol |= vol << 8; |
348 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); | 360 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); |
349 | ::close( fd ); | 361 | ::close( fd ); |
350 | } | 362 | } |
363 | #endif | ||
351 | } | 364 | } |
352 | break; | 365 | break; |
353 | } | 366 | } |
354 | } | 367 | } |
355 | 368 | ||
356 | static void setMic( int t = 0, int percent = -1 ) | 369 | static void setMic( int t = 0, int percent = -1 ) |
357 | { | 370 | { |
358 | switch ( t ) { | 371 | switch ( t ) { |
359 | case 0: { | 372 | case 0: { |
360 | Config cfg( "qpe" ); | 373 | Config cfg( "qpe" ); |
361 | cfg.setGroup( "Volume" ); | 374 | cfg.setGroup( "Volume" ); |
362 | if ( percent < 0 ) | 375 | if ( percent < 0 ) |
363 | percent = cfg.readNumEntry( "Mic", 50 ); | 376 | percent = cfg.readNumEntry( "Mic", 50 ); |
364 | 377 | ||
378 | #ifndef QT_NO_SOUND | ||
365 | int fd = 0; | 379 | int fd = 0; |
366 | int mic = micMuted ? 0 : percent; | 380 | int mic = micMuted ? 0 : percent; |
367 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 381 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
368 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); | 382 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); |
369 | ::close( fd ); | 383 | ::close( fd ); |
370 | } | 384 | } |
385 | #endif | ||
371 | } | 386 | } |
372 | break; | 387 | break; |
373 | } | 388 | } |
374 | } | 389 | } |
375 | 390 | ||
376 | 391 | ||
377 | static void setBass( int t = 0, int percent = -1 ) | 392 | static void setBass( int t = 0, int percent = -1 ) |
378 | { | 393 | { |
379 | switch ( t ) { | 394 | switch ( t ) { |
380 | case 0: { | 395 | case 0: { |
381 | Config cfg( "qpe" ); | 396 | Config cfg( "qpe" ); |
382 | cfg.setGroup( "Volume" ); | 397 | cfg.setGroup( "Volume" ); |
383 | if ( percent < 0 ) | 398 | if ( percent < 0 ) |
384 | percent = cfg.readNumEntry( "BassPercent", 50 ); | 399 | percent = cfg.readNumEntry( "BassPercent", 50 ); |
385 | 400 | ||
401 | #ifndef QT_NO_SOUND | ||
386 | int fd = 0; | 402 | int fd = 0; |
387 | int bass = percent; | 403 | int bass = percent; |
388 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 404 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
389 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); | 405 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); |
390 | ::close( fd ); | 406 | ::close( fd ); |
391 | } | 407 | } |
408 | #endif | ||
392 | } | 409 | } |
393 | break; | 410 | break; |
394 | } | 411 | } |
395 | } | 412 | } |
396 | 413 | ||
397 | 414 | ||
398 | static void setTreble( int t = 0, int percent = -1 ) | 415 | static void setTreble( int t = 0, int percent = -1 ) |
399 | { | 416 | { |
400 | switch ( t ) { | 417 | switch ( t ) { |
401 | case 0: { | 418 | case 0: { |
402 | Config cfg( "qpe" ); | 419 | Config cfg( "qpe" ); |
403 | cfg.setGroup( "Volume" ); | 420 | cfg.setGroup( "Volume" ); |
404 | if ( percent < 0 ) | 421 | if ( percent < 0 ) |
405 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | 422 | percent = cfg.readNumEntry( "TreblePercent", 50 ); |
406 | 423 | ||
424 | #ifndef QT_NO_SOUND | ||
407 | int fd = 0; | 425 | int fd = 0; |
408 | int treble = percent; | 426 | int treble = percent; |
409 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 427 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
410 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | 428 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); |
411 | ::close( fd ); | 429 | ::close( fd ); |
412 | } | 430 | } |
431 | #endif | ||
413 | } | 432 | } |
414 | break; | 433 | break; |
415 | } | 434 | } |
416 | } | 435 | } |
417 | 436 | ||
418 | 437 | ||
419 | /*! | 438 | /*! |
420 | \class QPEApplication qpeapplication.h | 439 | \class QPEApplication qpeapplication.h |
@@ -1644,21 +1663,27 @@ void QPEApplication::internalSetStyle( const QString &style ) | |||
1644 | setStyle( new QMotifPlusStyle ); | 1663 | setStyle( new QMotifPlusStyle ); |
1645 | } | 1664 | } |
1646 | #endif | 1665 | #endif |
1647 | 1666 | ||
1648 | else { | 1667 | else { |
1649 | QStyle *sty = 0; | 1668 | QStyle *sty = 0; |
1650 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; | 1669 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; |
1651 | 1670 | ||
1671 | #ifdef Q_OS_MACX | ||
1672 | if ( style. find ( ".dylib" ) > 0 ) | ||
1673 | path += style; | ||
1674 | else | ||
1675 | path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility | ||
1676 | #else | ||
1652 | if ( style. find ( ".so" ) > 0 ) | 1677 | if ( style. find ( ".so" ) > 0 ) |
1653 | path += style; | 1678 | path += style; |
1654 | else | 1679 | else |
1655 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility | 1680 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility |
1656 | 1681 | #endif | |
1657 | static QLibrary *lastlib = 0; | 1682 | static QLibrary *lastlib = 0; |
1658 | static StyleInterface *lastiface = 0; | 1683 | static StyleInterface *lastiface = 0; |
1659 | 1684 | ||
1660 | QLibrary *lib = new QLibrary ( path ); | 1685 | QLibrary *lib = new QLibrary ( path ); |
1661 | StyleInterface *iface = 0; | 1686 | StyleInterface *iface = 0; |
1662 | 1687 | ||
1663 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) | 1688 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) |
1664 | sty = iface-> style ( ); | 1689 | sty = iface-> style ( ); |
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp index 933542d..bac1a75 100644 --- a/library/qpedecoration_qws.cpp +++ b/library/qpedecoration_qws.cpp | |||
@@ -507,21 +507,29 @@ void QPEDecoration::init ( const QString &plugin ) | |||
507 | wdlib = 0; | 507 | wdlib = 0; |
508 | } else { | 508 | } else { |
509 | delete wdiface; | 509 | delete wdiface; |
510 | } | 510 | } |
511 | 511 | ||
512 | WindowDecorationInterface *iface = 0; | 512 | WindowDecorationInterface *iface = 0; |
513 | QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; | 513 | QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; |
514 | 514 | ||
515 | #ifdef Q_OS_MACX | ||
516 | if ( plugin.find( ".dylib" ) > 0 ) { | ||
517 | #else | ||
515 | if ( plugin.find( ".so" ) > 0 ) { | 518 | if ( plugin.find( ".so" ) > 0 ) { |
519 | #endif | ||
516 | // full library name supplied | 520 | // full library name supplied |
517 | path += plugin; | 521 | path += plugin; |
518 | } else { | 522 | } else { |
523 | #ifdef Q_OS_MACX | ||
524 | path += "lib" + plugin.lower() + ".dylib"; // compatibility | ||
525 | #else | ||
519 | path += "lib" + plugin.lower() + ".so"; // compatibility | 526 | path += "lib" + plugin.lower() + ".so"; // compatibility |
527 | #endif | ||
520 | } | 528 | } |
521 | 529 | ||
522 | QLibrary *lib = new QLibrary( path ); | 530 | QLibrary *lib = new QLibrary( path ); |
523 | if ( lib->queryInterface( IID_WindowDecoration, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 531 | if ( lib->queryInterface( IID_WindowDecoration, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
524 | wdiface = iface; | 532 | wdiface = iface; |
525 | wdlib = lib; | 533 | wdlib = lib; |
526 | } else { | 534 | } else { |
527 | delete lib; | 535 | delete lib; |
diff --git a/library/sound.cpp b/library/sound.cpp index c8704f9..5b67995 100644 --- a/library/sound.cpp +++ b/library/sound.cpp | |||
@@ -23,17 +23,20 @@ | |||
23 | #include <qpe/qcopenvelope_qws.h> | 23 | #include <qpe/qcopenvelope_qws.h> |
24 | 24 | ||
25 | #include <qsound.h> | 25 | #include <qsound.h> |
26 | #include <qfile.h> | 26 | #include <qfile.h> |
27 | 27 | ||
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include <fcntl.h> | 29 | #include <fcntl.h> |
30 | #include <sys/ioctl.h> | 30 | #include <sys/ioctl.h> |
31 | |||
32 | #ifndef QT_NO_SOUND | ||
31 | #include <sys/soundcard.h> | 33 | #include <sys/soundcard.h> |
34 | #endif | ||
32 | 35 | ||
33 | #include "config.h" | 36 | #include "config.h" |
34 | #include <qmessagebox.h> | 37 | #include <qmessagebox.h> |
35 | #ifndef QT_NO_SOUND | 38 | #ifndef QT_NO_SOUND |
36 | static int WAVsoundDuration(const QString& filename) | 39 | static int WAVsoundDuration(const QString& filename) |
37 | { | 40 | { |
38 | // bad solution | 41 | // bad solution |
39 | 42 | ||
diff --git a/library/storage.cpp b/library/storage.cpp index dc5cc22..f8b75d0 100644 --- a/library/storage.cpp +++ b/library/storage.cpp | |||
@@ -24,29 +24,40 @@ | |||
24 | #include <qpe/custom.h> | 24 | #include <qpe/custom.h> |
25 | 25 | ||
26 | #include <qfile.h> | 26 | #include <qfile.h> |
27 | #include <qtimer.h> | 27 | #include <qtimer.h> |
28 | #include <qcopchannel_qws.h> | 28 | #include <qcopchannel_qws.h> |
29 | 29 | ||
30 | #include <stdio.h> | 30 | #include <stdio.h> |
31 | 31 | ||
32 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 32 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
33 | #include <sys/vfs.h> | 33 | #include <sys/vfs.h> |
34 | #include <mntent.h> | 34 | #include <mntent.h> |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #ifdef Q_OS_MACX | ||
38 | # include <sys/param.h> | ||
39 | # include <sys/ucred.h> | ||
40 | # include <sys/mount.h> | ||
41 | # include <stdio.h> // For strerror() | ||
42 | # include <errno.h> | ||
43 | #endif /* Q_OS_MACX */ | ||
44 | |||
37 | #include <qstringlist.h> | 45 | #include <qstringlist.h> |
38 | 46 | ||
39 | #include <sys/vfs.h> | 47 | // Shouldn't be here ! (eilers) |
40 | #include <mntent.h> | 48 | // #include <sys/vfs.h> |
49 | // #include <mntent.h> | ||
41 | 50 | ||
42 | 51 | ||
43 | static bool isCF(const QString& m) | 52 | static bool isCF(const QString& m) |
44 | { | 53 | { |
54 | |||
55 | #ifndef Q_OS_MACX | ||
45 | FILE* f = fopen("/var/run/stab", "r"); | 56 | FILE* f = fopen("/var/run/stab", "r"); |
46 | if (!f) f = fopen("/var/state/pcmcia/stab", "r"); | 57 | if (!f) f = fopen("/var/state/pcmcia/stab", "r"); |
47 | if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); | 58 | if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); |
48 | if ( f ) { | 59 | if ( f ) { |
49 | char line[1024]; | 60 | char line[1024]; |
50 | char devtype[80]; | 61 | char devtype[80]; |
51 | char devname[80]; | 62 | char devname[80]; |
52 | while ( fgets( line, 1024, f ) ) { | 63 | while ( fgets( line, 1024, f ) ) { |
@@ -56,16 +67,17 @@ static bool isCF(const QString& m) | |||
56 | if ( QString(devtype) == "ide" && m.find(devname)>0 ) { | 67 | if ( QString(devtype) == "ide" && m.find(devname)>0 ) { |
57 | fclose(f); | 68 | fclose(f); |
58 | return TRUE; | 69 | return TRUE; |
59 | } | 70 | } |
60 | } | 71 | } |
61 | } | 72 | } |
62 | fclose(f); | 73 | fclose(f); |
63 | } | 74 | } |
75 | #endif /* Q_OS_MACX */ | ||
64 | return FALSE; | 76 | return FALSE; |
65 | } | 77 | } |
66 | 78 | ||
67 | /*! \class StorageInfo storage.h | 79 | /*! \class StorageInfo storage.h |
68 | \brief The StorageInfo class describes the disks mounted on the file system. | 80 | \brief The StorageInfo class describes the disks mounted on the file system. |
69 | 81 | ||
70 | This class provides access to the mount information for the Linux | 82 | This class provides access to the mount information for the Linux |
71 | filesystem. Each mount point is represented by the FileSystem class. | 83 | filesystem. Each mount point is represented by the FileSystem class. |
@@ -199,30 +211,50 @@ void StorageInfo::update() | |||
199 | // just update them | 211 | // just update them |
200 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) | 212 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) |
201 | i.current()->update(); | 213 | i.current()->update(); |
202 | } | 214 | } |
203 | #endif | 215 | #endif |
204 | } | 216 | } |
205 | 217 | ||
206 | bool deviceTab( const char *device) { | 218 | bool deviceTab( const char *device) { |
207 | QString name = device; | 219 | QString name = device; |
208 | bool hasDevice=false; | 220 | bool hasDevice=false; |
221 | |||
222 | #ifdef Q_OS_MACX | ||
223 | // Darwin (MacOS X) | ||
224 | struct statfs** mntbufp; | ||
225 | int count = 0; | ||
226 | if ( ( count = getmntinfo( mntbufp, MNT_WAIT ) ) == 0 ){ | ||
227 | qWarning("deviceTab: Error in getmntinfo(): %s",strerror( errno ) ); | ||
228 | hasDevice = false; | ||
229 | } | ||
230 | for( int i = 0; i < count; i++ ){ | ||
231 | QString deviceName = mntbufp[i]->f_mntfromname; | ||
232 | qDebug(deviceName); | ||
233 | if( deviceName.left( name.length() ) == name ) | ||
234 | hasDevice = true; | ||
235 | } | ||
236 | #else | ||
237 | // Linux | ||
209 | struct mntent *me; | 238 | struct mntent *me; |
210 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); | 239 | FILE *mntfp = setmntent( "/etc/mtab", "r" ); |
211 | if ( mntfp ) { | 240 | if ( mntfp ) { |
212 | while ( (me = getmntent( mntfp )) != 0 ) { | 241 | while ( (me = getmntent( mntfp )) != 0 ) { |
213 | QString deviceName = me->mnt_fsname; | 242 | QString deviceName = me->mnt_fsname; |
214 | // qDebug(deviceName); | 243 | // qDebug(deviceName); |
215 | if( deviceName.left(name.length()) == name) { | 244 | if( deviceName.left(name.length()) == name) { |
216 | hasDevice = true; | 245 | hasDevice = true; |
217 | } | 246 | } |
218 | } | 247 | } |
219 | } | 248 | } |
220 | endmntent( mntfp ); | 249 | endmntent( mntfp ); |
250 | #endif /* Q_OS_MACX */ | ||
251 | |||
252 | |||
221 | return hasDevice; | 253 | return hasDevice; |
222 | } | 254 | } |
223 | 255 | ||
224 | /*! | 256 | /*! |
225 | * @fn static bool StorageInfo::hasCf() | 257 | * @fn static bool StorageInfo::hasCf() |
226 | * @brief returns whether device has Cf mounted | 258 | * @brief returns whether device has Cf mounted |
227 | * | 259 | * |
228 | */ | 260 | */ |