-rw-r--r-- | library/applnk.cpp | 6 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 5 | ||||
-rw-r--r-- | library/qpeapplication.h | 5 |
3 files changed, 12 insertions, 4 deletions
diff --git a/library/applnk.cpp b/library/applnk.cpp index c82d3b9..874a1b6 100644 --- a/library/applnk.cpp +++ b/library/applnk.cpp | |||
@@ -640,99 +640,101 @@ AppLnk::AppLnk( const AppLnk © ) | |||
640 | mLinkFile = copy.mLinkFile; | 640 | mLinkFile = copy.mLinkFile; |
641 | mIconFile = copy.mIconFile; | 641 | mIconFile = copy.mIconFile; |
642 | mMimeTypes = copy.mMimeTypes; | 642 | mMimeTypes = copy.mMimeTypes; |
643 | mMimeTypeIcons = copy.mMimeTypeIcons; | 643 | mMimeTypeIcons = copy.mMimeTypeIcons; |
644 | mId = 0; | 644 | mId = 0; |
645 | d = new AppLnkPrivate(); | 645 | d = new AppLnkPrivate(); |
646 | d->mCat = copy.d->mCat; | 646 | d->mCat = copy.d->mCat; |
647 | d->mCatList = copy.d->mCatList; | 647 | d->mCatList = copy.d->mCatList; |
648 | d->mPixmaps = copy.d->mPixmaps; | 648 | d->mPixmaps = copy.d->mPixmaps; |
649 | } | 649 | } |
650 | 650 | ||
651 | /*! | 651 | /*! |
652 | Destroys the AppLnk. Note that if the AppLnk is currently a member | 652 | Destroys the AppLnk. Note that if the AppLnk is currently a member |
653 | of an AppLnkSet, this will produce a run-time warning. | 653 | of an AppLnkSet, this will produce a run-time warning. |
654 | 654 | ||
655 | \sa AppLnkSet::add() AppLnkSet::remove() | 655 | \sa AppLnkSet::add() AppLnkSet::remove() |
656 | */ | 656 | */ |
657 | AppLnk::~AppLnk() | 657 | AppLnk::~AppLnk() |
658 | { | 658 | { |
659 | if ( mId ) | 659 | if ( mId ) |
660 | qWarning("Deleting AppLnk that is in an AppLnkSet"); | 660 | qWarning("Deleting AppLnk that is in an AppLnkSet"); |
661 | if ( d ) | 661 | if ( d ) |
662 | delete d; | 662 | delete d; |
663 | } | 663 | } |
664 | 664 | ||
665 | /*! | 665 | /*! |
666 | \overload | 666 | \overload |
667 | Executes the application associated with this AppLnk. | 667 | Executes the application associated with this AppLnk. |
668 | 668 | ||
669 | \sa exec() | 669 | \sa exec() |
670 | */ | 670 | */ |
671 | void AppLnk::execute() const | 671 | void AppLnk::execute() const |
672 | { | 672 | { |
673 | execute( QStringList::split( ' ', property( "Arguments" ) ) ); | 673 | execute( QStringList::split( ' ', property( "Arguments" ) ) ); |
674 | } | 674 | } |
675 | 675 | ||
676 | /*! | 676 | /*! |
677 | Executes the application associated with this AppLnk, with | 677 | Executes the application associated with this AppLnk, with |
678 | \a args as arguments. | 678 | \a args as arguments. |
679 | 679 | ||
680 | \sa exec() | 680 | \sa exec() |
681 | */ | 681 | */ |
682 | void AppLnk::execute(const QStringList& args) const | 682 | void AppLnk::execute(const QStringList& args) const |
683 | { | 683 | { |
684 | #ifdef Q_WS_QWS | 684 | #ifdef Q_WS_QWS |
685 | if ( !mRotation.isEmpty() ) { | 685 | if ( !mRotation.isEmpty() ) { |
686 | // ######## this will only work in the server | 686 | // ######## this will only work in the server |
687 | int rot = QPEApplication::defaultRotation(); | 687 | int rot = QPEApplication::defaultRotation(); |
688 | int j = 0; | ||
688 | rot = (rot+mRotation.toInt())%360; | 689 | rot = (rot+mRotation.toInt())%360; |
689 | QCString old = getenv("QWS_DISPLAY"); | 690 | QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed"; |
690 | setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); | 691 | QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() ); |
692 | setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg( driver ).arg( rot ), 1 ); | ||
691 | invoke(args); | 693 | invoke(args); |
692 | setenv("QWS_DISPLAY", old.data(), 1); | 694 | setenv("QWS_DISPLAY", old.data(), 1); |
693 | } else | 695 | } else |
694 | #endif | 696 | #endif |
695 | invoke(args); | 697 | invoke(args); |
696 | } | 698 | } |
697 | 699 | ||
698 | /*! | 700 | /*! |
699 | Invokes the application associated with this AppLnk, with | 701 | Invokes the application associated with this AppLnk, with |
700 | \a args as arguments. Rotation is not taken into account by | 702 | \a args as arguments. Rotation is not taken into account by |
701 | this function, so you should not call it directly. | 703 | this function, so you should not call it directly. |
702 | 704 | ||
703 | \sa execute() | 705 | \sa execute() |
704 | */ | 706 | */ |
705 | void AppLnk::invoke(const QStringList& args) const | 707 | void AppLnk::invoke(const QStringList& args) const |
706 | { | 708 | { |
707 | if ( property( "Arguments" ).isEmpty() ) | 709 | if ( property( "Arguments" ).isEmpty() ) |
708 | Global::execute( exec(), args[0] ); | 710 | Global::execute( exec(), args[0] ); |
709 | else | 711 | else |
710 | Global::execute( exec(), args.join( " " ) ); | 712 | Global::execute( exec(), args.join( " " ) ); |
711 | } | 713 | } |
712 | 714 | ||
713 | /*! | 715 | /*! |
714 | Sets the Exec property to \a exec. | 716 | Sets the Exec property to \a exec. |
715 | 717 | ||
716 | \sa exec() name() | 718 | \sa exec() name() |
717 | */ | 719 | */ |
718 | void AppLnk::setExec( const QString& exec ) | 720 | void AppLnk::setExec( const QString& exec ) |
719 | { | 721 | { |
720 | mExec = exec; | 722 | mExec = exec; |
721 | } | 723 | } |
722 | 724 | ||
723 | #if 0 // this was inlined for better BC | 725 | #if 0 // this was inlined for better BC |
724 | /*! | 726 | /*! |
725 | Sets the Rotation property to \a rot. | 727 | Sets the Rotation property to \a rot. |
726 | 728 | ||
727 | \sa rotation() | 729 | \sa rotation() |
728 | */ | 730 | */ |
729 | void AppLnk::setRotation ( const QString &rot ) | 731 | void AppLnk::setRotation ( const QString &rot ) |
730 | { | 732 | { |
731 | mRotation = rot; | 733 | mRotation = rot; |
732 | } | 734 | } |
733 | #endif | 735 | #endif |
734 | 736 | ||
735 | /*! | 737 | /*! |
736 | Sets the Name property to \a docname. | 738 | Sets the Name property to \a docname. |
737 | 739 | ||
738 | \sa name() | 740 | \sa name() |
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 0f3e4a4..19e99f2 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1243,97 +1243,100 @@ QString QPEApplication::qpeDir() | |||
1243 | return dir; | 1243 | return dir; |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | /*! | 1246 | /*! |
1247 | Returns the user's current Document directory. There is a trailing "/". | 1247 | Returns the user's current Document directory. There is a trailing "/". |
1248 | .. well, it does now,, and there's no trailing '/' | 1248 | .. well, it does now,, and there's no trailing '/' |
1249 | */ | 1249 | */ |
1250 | QString QPEApplication::documentDir() | 1250 | QString QPEApplication::documentDir() |
1251 | { | 1251 | { |
1252 | const char* base = getenv( "HOME"); | 1252 | const char* base = getenv( "HOME"); |
1253 | if ( base ) | 1253 | if ( base ) |
1254 | return QString( base ) + "/Documents"; | 1254 | return QString( base ) + "/Documents"; |
1255 | 1255 | ||
1256 | return QString( "../Documents" ); | 1256 | return QString( "../Documents" ); |
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | static int deforient = -1; | 1259 | static int deforient = -1; |
1260 | 1260 | ||
1261 | /*! | 1261 | /*! |
1262 | \internal | 1262 | \internal |
1263 | */ | 1263 | */ |
1264 | int QPEApplication::defaultRotation() | 1264 | int QPEApplication::defaultRotation() |
1265 | { | 1265 | { |
1266 | if ( deforient < 0 ) { | 1266 | if ( deforient < 0 ) { |
1267 | QString d = getenv( "QWS_DISPLAY" ); | 1267 | QString d = getenv( "QWS_DISPLAY" ); |
1268 | if ( d.contains( "Rot90" ) ) { | 1268 | if ( d.contains( "Rot90" ) ) { |
1269 | deforient = 90; | 1269 | deforient = 90; |
1270 | } | 1270 | } |
1271 | else if ( d.contains( "Rot180" ) ) { | 1271 | else if ( d.contains( "Rot180" ) ) { |
1272 | deforient = 180; | 1272 | deforient = 180; |
1273 | } | 1273 | } |
1274 | else if ( d.contains( "Rot270" ) ) { | 1274 | else if ( d.contains( "Rot270" ) ) { |
1275 | deforient = 270; | 1275 | deforient = 270; |
1276 | } | 1276 | } |
1277 | else { | 1277 | else { |
1278 | deforient = 0; | 1278 | deforient = 0; |
1279 | } | 1279 | } |
1280 | } | 1280 | } |
1281 | return deforient; | 1281 | return deforient; |
1282 | } | 1282 | } |
1283 | 1283 | ||
1284 | /*! | 1284 | /*! |
1285 | \internal | 1285 | \internal |
1286 | */ | 1286 | */ |
1287 | void QPEApplication::setDefaultRotation( int r ) | 1287 | void QPEApplication::setDefaultRotation( int r ) |
1288 | { | 1288 | { |
1289 | if ( qApp->type() == GuiServer ) { | 1289 | if ( qApp->type() == GuiServer ) { |
1290 | deforient = r; | 1290 | deforient = r; |
1291 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 1291 | int j = 0; |
1292 | QCString old = getenv( "QWS_DISPLAY" ) ? getenv( "QWS_DISPLAY" ) : "Transformed"; | ||
1293 | QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() ); | ||
1294 | setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg(driver).arg( r ).latin1(), 1 ); | ||
1292 | Config config("qpe"); | 1295 | Config config("qpe"); |
1293 | config.setGroup( "Rotation" ); | 1296 | config.setGroup( "Rotation" ); |
1294 | config.writeEntry( "Rot", r ); | 1297 | config.writeEntry( "Rot", r ); |
1295 | } | 1298 | } |
1296 | else { | 1299 | else { |
1297 | #ifndef QT_NO_COP | 1300 | #ifndef QT_NO_COP |
1298 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 1301 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
1299 | e << r; | 1302 | e << r; |
1300 | } | 1303 | } |
1301 | #endif | 1304 | #endif |
1302 | 1305 | ||
1303 | } | 1306 | } |
1304 | } | 1307 | } |
1305 | 1308 | ||
1306 | #include <qgfx_qws.h> | 1309 | #include <qgfx_qws.h> |
1307 | #include <qwindowsystem_qws.h> | 1310 | #include <qwindowsystem_qws.h> |
1308 | 1311 | ||
1309 | #if QT_VERSION > 236 | 1312 | #if QT_VERSION > 236 |
1310 | extern void qws_clearLoadedFonts(); | 1313 | extern void qws_clearLoadedFonts(); |
1311 | #endif | 1314 | #endif |
1312 | 1315 | ||
1313 | void QPEApplication::setCurrentMode( int x, int y, int depth ) | 1316 | void QPEApplication::setCurrentMode( int x, int y, int depth ) |
1314 | { | 1317 | { |
1315 | // Reset the caches | 1318 | // Reset the caches |
1316 | #if QT_VERSION > 236 | 1319 | #if QT_VERSION > 236 |
1317 | qws_clearLoadedFonts(); | 1320 | qws_clearLoadedFonts(); |
1318 | #endif | 1321 | #endif |
1319 | QPixmapCache::clear(); | 1322 | QPixmapCache::clear(); |
1320 | 1323 | ||
1321 | // Change the screen mode | 1324 | // Change the screen mode |
1322 | qt_screen->setMode(x, y, depth); | 1325 | qt_screen->setMode(x, y, depth); |
1323 | 1326 | ||
1324 | if ( qApp->type() == GuiServer ) { | 1327 | if ( qApp->type() == GuiServer ) { |
1325 | #if QT_VERSION > 236 | 1328 | #if QT_VERSION > 236 |
1326 | // Reconfigure the GuiServer | 1329 | // Reconfigure the GuiServer |
1327 | qwsServer->beginDisplayReconfigure(); | 1330 | qwsServer->beginDisplayReconfigure(); |
1328 | qwsServer->endDisplayReconfigure(); | 1331 | qwsServer->endDisplayReconfigure(); |
1329 | #endif | 1332 | #endif |
1330 | // Get all the running apps to reset | 1333 | // Get all the running apps to reset |
1331 | QCopEnvelope env( "QPE/System", "reset()" ); | 1334 | QCopEnvelope env( "QPE/System", "reset()" ); |
1332 | } | 1335 | } |
1333 | } | 1336 | } |
1334 | 1337 | ||
1335 | void QPEApplication::reset() { | 1338 | void QPEApplication::reset() { |
1336 | // Reconnect to the screen | 1339 | // Reconnect to the screen |
1337 | qt_screen->disconnect(); | 1340 | qt_screen->disconnect(); |
1338 | qt_screen->connect( QString::null ); | 1341 | qt_screen->connect( QString::null ); |
1339 | 1342 | ||
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 167fe69..cff3e43 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -163,77 +163,80 @@ protected: | |||
163 | virtual void restart(); | 163 | virtual void restart(); |
164 | virtual void shutdown(); | 164 | virtual void shutdown(); |
165 | bool eventFilter( QObject *, QEvent * ); | 165 | bool eventFilter( QObject *, QEvent * ); |
166 | void timerEvent( QTimerEvent * ); | 166 | void timerEvent( QTimerEvent * ); |
167 | bool raiseAppropriateWindow(); | 167 | bool raiseAppropriateWindow(); |
168 | virtual void tryQuit(); | 168 | virtual void tryQuit(); |
169 | private: | 169 | private: |
170 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); | 170 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); |
171 | void processQCopFile(); | 171 | void processQCopFile(); |
172 | 172 | ||
173 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 173 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
174 | QCopChannel *sysChannel; | 174 | QCopChannel *sysChannel; |
175 | QCopChannel *pidChannel; | 175 | QCopChannel *pidChannel; |
176 | #endif | 176 | #endif |
177 | QPEApplicationData *d; | 177 | QPEApplicationData *d; |
178 | 178 | ||
179 | bool reserved_sh; | 179 | bool reserved_sh; |
180 | 180 | ||
181 | }; | 181 | }; |
182 | 182 | ||
183 | 183 | ||
184 | 184 | ||
185 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ | 185 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ |
186 | 186 | ||
187 | inline int TransToDeg ( Transformation t ) | 187 | inline int TransToDeg ( Transformation t ) |
188 | { | 188 | { |
189 | int d = static_cast<int>( t ); | 189 | int d = static_cast<int>( t ); |
190 | return d * 90; | 190 | return d * 90; |
191 | } | 191 | } |
192 | 192 | ||
193 | inline Transformation DegToTrans ( int d ) | 193 | inline Transformation DegToTrans ( int d ) |
194 | { | 194 | { |
195 | Transformation t = static_cast<Transformation>( d / 90 ); | 195 | Transformation t = static_cast<Transformation>( d / 90 ); |
196 | return t; | 196 | return t; |
197 | } | 197 | } |
198 | 198 | ||
199 | /* | 199 | /* |
200 | * Set current rotation of Opie, and rotation for newly started apps. | 200 | * Set current rotation of Opie, and rotation for newly started apps. |
201 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, | 201 | * Differs from setDefaultRotation in that 1) it rotates currently running apps, |
202 | * and 2) does not set deforient or save orientation to qpe.conf. | 202 | * and 2) does not set deforient or save orientation to qpe.conf. |
203 | */ | 203 | */ |
204 | 204 | ||
205 | inline void QPEApplication::setCurrentRotation( int r ) | 205 | inline void QPEApplication::setCurrentRotation( int r ) |
206 | { | 206 | { |
207 | // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots | 207 | // setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots |
208 | // for compatibility with the SharpROM use fallback to setDefaultTransformation() | 208 | // for compatibility with the SharpROM use fallback to setDefaultTransformation() |
209 | #if QT_VERSION > 233 | 209 | #if QT_VERSION > 233 |
210 | Transformation e = DegToTrans( r ); | 210 | Transformation e = DegToTrans( r ); |
211 | ::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 211 | QCString old = getenv("QWS_DISPLAY") ? getenv( "QWS_DISPLAY" ) : "Transformed"; |
212 | int j = 0; | ||
213 | QString driver( old.left( ( ( j = old.find( ':' ) ) >= 0 ) ? j : old.size() ).data() ); | ||
214 | ::setenv( "QWS_DISPLAY", QString( "%1:Rot%2:0" ).arg( driver ).arg( r ).latin1(), 1 ); | ||
212 | qApp->desktop()->qwsDisplay()->setTransformation( e ); | 215 | qApp->desktop()->qwsDisplay()->setTransformation( e ); |
213 | #else | 216 | #else |
214 | setDefaultRotation( r ); | 217 | setDefaultRotation( r ); |
215 | #endif | 218 | #endif |
216 | } | 219 | } |
217 | 220 | ||
218 | /* | 221 | /* |
219 | * Qtopia 1.7 SDK compatibility macros | 222 | * Qtopia 1.7 SDK compatibility macros |
220 | * FIXME: Support Opie Quicklaunch Interface | 223 | * FIXME: Support Opie Quicklaunch Interface |
221 | */ | 224 | */ |
222 | #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \ | 225 | #define QTOPIA_ADD_APPLICATION(NAME,IMPLEMENTATION) \ |
223 | int main( int argc, char** argv ) \ | 226 | int main( int argc, char** argv ) \ |
224 | { \ | 227 | { \ |
225 | QPEApplication app = QPEApplication( argc, argv );\ | 228 | QPEApplication app = QPEApplication( argc, argv );\ |
226 | IMPLEMENTATION* mw = new IMPLEMENTATION(); \ | 229 | IMPLEMENTATION* mw = new IMPLEMENTATION(); \ |
227 | app.showMainWidget( mw ); \ | 230 | app.showMainWidget( mw ); \ |
228 | app.exec(); \ | 231 | app.exec(); \ |
229 | } | 232 | } |
230 | #define QTOPIA_MAIN // Bee-Bop-Alula | 233 | #define QTOPIA_MAIN // Bee-Bop-Alula |
231 | 234 | ||
232 | /* | 235 | /* |
233 | * -remove me | 236 | * -remove me |
234 | */ | 237 | */ |
235 | #ifdef Q_WS_QWS | 238 | #ifdef Q_WS_QWS |
236 | extern Q_EXPORT QRect qt_maxWindowRect; | 239 | extern Q_EXPORT QRect qt_maxWindowRect; |
237 | #endif | 240 | #endif |
238 | 241 | ||
239 | #endif | 242 | #endif |