summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/fileselector.h5
-rw-r--r--library/library.pro3
-rw-r--r--library/qcom.h3
-rw-r--r--library/qpeapplication.cpp80
-rw-r--r--library/qpeapplication.h58
-rw-r--r--library/qpedecoration_qws.cpp3
-rw-r--r--library/qpeglobal.h41
-rw-r--r--library/qpemenubar.h4
-rw-r--r--library/qpetoolbar.h3
-rw-r--r--library/widget_showing.cpp74
10 files changed, 177 insertions, 97 deletions
diff --git a/library/fileselector.h b/library/fileselector.h
index e3ae891..f1738db 100644
--- a/library/fileselector.h
+++ b/library/fileselector.h
@@ -1,115 +1,116 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef FILESELECTOR_H
#define FILESELECTOR_H
#include <qhbox.h>
#include <qvbox.h>
#include <qtoolbutton.h>
#include <qlistview.h>
+#include "qpeglobal.h"
#include "filemanager.h"
#include "applnk.h"
class QPopupMenu;
class QPushButton;
class FileSelectorView;
class FileSelectorItem : public QListViewItem
{
public:
FileSelectorItem( QListView *parent, const DocLnk& f );
~FileSelectorItem();
DocLnk file() const { return fl; }
private:
DocLnk fl;
};
class FileSelectorPrivate;
class FileSelector : public QVBox
{
Q_OBJECT
public:
FileSelector( const QString &mimefilter, QWidget *parent, const char *name=0, bool newVisible = TRUE, bool closeVisible = TRUE );
~FileSelector();
void setNewVisible( bool b );
- void setCloseVisible( bool b );
+ void setCloseVisible( bool b ) QPE_DEPRECATED;
void setTypeComboVisible( bool b = TRUE );
void setCategorySelectVisible( bool b = TRUE );
void reread();
int fileCount();
DocLnk selectedDocument() const
{
const DocLnk* rp = ((FileSelector*)this)->selected();
if (!rp) {
DocLnk r;
return r;
}
DocLnk r(*rp);
delete rp;
return r;
}
QValueList<DocLnk> fileList() const
{
((FileSelector*)this)->fileCount(); // ensure all loaded when this is extended
QValueList<DocLnk> list;
FileSelectorItem *item = (FileSelectorItem *)((QListView*)view)->firstChild();
while (item) {
list.append(item->file());
item = (FileSelectorItem *)item->nextSibling();
}
return list;
}
signals:
void fileSelected( const DocLnk & );
void newSelected( const DocLnk & );
void closeMe();
private slots:
void createNew();
void fileClicked( int, QListViewItem *, const QPoint &, int );
// pressed to get 'right down'
void filePressed( int, QListViewItem *, const QPoint &, int );
void fileClicked( QListViewItem *);
void typeSelected( const QString &type );
void catSelected( int );
void cardMessage( const QCString &, const QByteArray &);
private:
void updateView();
void updateWhatsThis();
private:
// RESOLVE please -zecke@handhelds.org
- const DocLnk *selected(); // use selectedDocument() luckily no compiler is putting the access into the symbol name
+ const DocLnk *selected() QPE_DEPRECATED; // use selectedDocument() luckily no compiler is putting the access into the symbol name
FileSelectorView *view;
QString filter;
QToolButton *buttonNew, *buttonClose;
FileSelectorPrivate *d;
};
#endif
diff --git a/library/library.pro b/library/library.pro
index cdc1dab..45e69bc 100644
--- a/library/library.pro
+++ b/library/library.pro
@@ -72,73 +72,74 @@ SOURCES = calendar.cpp \
filemanager.cpp \
fontmanager.cpp \
qdawg.cpp \
datebookmonth.cpp \
fileselector.cpp \
imageedit.cpp \
resource.cpp \
qpedecoration_qws.cpp \
qcopenvelope_qws.cpp \
qpeapplication.cpp \
qpestyle.cpp \
qpedialog.cpp \
lightstyle.cpp \
config.cpp \
applnk.cpp \
sound.cpp \
tzselect.cpp \
qmath.c \
datebookdb.cpp \
alarmserver.cpp \
password.cpp \
process.cpp \
process_unix.cpp \
timestring.cpp \
fontdatabase.cpp \
power.cpp \
storage.cpp \
qpemessagebox.cpp \
backend/timeconversion.cpp \
qpedebug.cpp \
qpemenubar.cpp \
qpetoolbar.cpp \
backend/categories.cpp \
backend/stringutil.cpp \
backend/palmtoprecord.cpp \
backend/task.cpp \
backend/event.cpp \
backend/contact.cpp \
categorymenu.cpp \
categoryedit_p.cpp \
categoryselect.cpp \
categorywidget.cpp \
ir.cpp \
backend/vcc_yacc.cpp \
backend/vobject.cpp \
findwidget_p.cpp \
finddialog.cpp \
lnkproperties.cpp \
- qt_override.cpp
+ qt_override.cpp \
+ widget_showing.cpp
# Qt 3 compatibility
HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h
SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp
INCLUDEPATH += $(OPIEDIR)/include backend
LIBS += -ldl -lcrypt -lm
INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui
TARGET = qpe
DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
VERSION = 1.5.0.1
include ( $(OPIEDIR)/include.pro )
contains( CONFIG, no-override ){
DEFINES += OPIE_NO_OVERRIDE_QT
}
contains( CONFIG, LIBQPE_WITHROHFEEDBACK ){
DEFINES += OPIE_WITHROHFEEDBACK
SOURCES += backend/rohfeedback.cpp
HEADERS += backend/rohfeedback.h
}
diff --git a/library/qcom.h b/library/qcom.h
index 9972d8f..5703800 100644
--- a/library/qcom.h
+++ b/library/qcom.h
@@ -1,76 +1,77 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QCOM_H
#define QCOM_H
#include <qstringlist.h>
#ifndef QT_NO_COMPONENT
#include <qpe/quuid.h>
+#include <qpe/qpeglobal.h>
#define QRESULT unsigned long
#define QS_OK (QRESULT)0x00000000
#define QS_FALSE (QRESULT)0x00000001
#define QE_NOTIMPL (QRESULT)0x80000001
#define QE_OUTOFMEMORY (QRESULT)0x80000002
#define QE_INVALIDARG (QRESULT)0x80000003
#define QE_NOINTERFACE (QRESULT)0x80000004
#define QE_NOCOMPONENT (QRESULT)0x80000005
// {1D8518CD-E8F5-4366-99E8-879FD7E482DE}
#ifndef IID_QUnknown
#define IID_QUnknown QUuid(0x1d8518cd, 0xe8f5, 0x4366, 0x99, 0xe8, 0x87, 0x9f, 0xd7, 0xe4, 0x82, 0xde)
#endif
struct Q_EXPORT QUnknownInterface
{
virtual QRESULT queryInterface( const QUuid&, QUnknownInterface** ) = 0;
virtual ulong addRef() = 0;
virtual ulong release() = 0;
};
// {D16111D4-E1E7-4C47-8599-24483DAE2E07}
#ifndef IID_QLibrary
#define IID_QLibrary QUuid( 0xd16111d4, 0xe1e7, 0x4c47, 0x85, 0x99, 0x24, 0x48, 0x3d, 0xae, 0x2e, 0x07)
#endif
struct Q_EXPORT QLibraryInterface : public QUnknownInterface
{
virtual bool init() = 0;
virtual void cleanup() = 0;
virtual bool canUnload() const = 0;
};
#define Q_CREATE_INSTANCE( IMPLEMENTATION ) \
IMPLEMENTATION *i = new IMPLEMENTATION; \
QUnknownInterface* iface = 0; \
i->queryInterface( IID_QUnknown, &iface ); \
return iface;
template <class T>
class QInterfacePtr
{
public:
QInterfacePtr():iface(0){}
QInterfacePtr( T* i) {
@@ -106,66 +107,66 @@ public:
iface->addRef();
}
return *this;
}
bool operator==( const QInterfacePtr<T> &p ) const { return iface == p.iface; }
bool operator!= ( const QInterfacePtr<T>& p ) const { return !( *this == p ); }
bool isNull() const { return !iface; }
T* operator->() const { return iface; }
T& operator*() const { return *iface; }
operator T*() const { return iface; }
QUnknownInterface** operator &() const {
if( iface )
iface->release();
return (QUnknownInterface**)&iface;
}
T** operator &() {
if ( iface )
iface->release();
return &iface;
}
private:
T* iface;
};
// internal class that wraps an initialized ulong
struct Q_EXPORT QtULong
{
QtULong() : ref( 0 ) { }
operator unsigned long () const { return ref; }
unsigned long& operator++() { return ++ref; }
unsigned long operator++( int ) { return ref++; }
unsigned long& operator--() { return --ref; }
unsigned long operator--( int ) { return ref--; }
unsigned long ref;
};
#define Q_EXPORT_INTERFACE() \
- extern "C" QUnknownInterface* ucm_instantiate()
+ extern "C" QUnknownInterface* ucm_instantiate QPE_EXPORT_SYMBOL ()
#define Q_REFCOUNT \
private: \
QtULong qtrefcount; \
public: \
ulong addRef() {return qtrefcount++;} \
ulong release() {if(!--qtrefcount){delete this;return 0;}return qtrefcount;}
#else // QT_NO_COMPONENT
struct Q_EXPORT QUnknownInterface
{
};
#endif // QT_NO_COMPONENT
#endif // QCOM_H
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 4adfc8f..43a9be5 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -153,145 +153,145 @@ public:
QCString fontFamily;
int fontSize;
int smallIconSize;
int bigIconSize;
QString appName;
struct QCopRec
{
QCopRec( const QCString &ch, const QCString &msg,
const QByteArray &d ) :
channel( ch ), message( msg ), data( d )
{ }
QCString channel;
QCString message;
QByteArray data;
};
QWidget* qpe_main_widget;
QGuardedPtr<QWidget> lastraised;
QQueue<QCopRec> qcopq;
QString styleName;
QString decorationName;
void enqueueQCop( const QCString &ch, const QCString &msg,
const QByteArray &data )
{
qcopq.enqueue( new QCopRec( ch, msg, data ) );
}
void sendQCopQ()
{
if (!qcopQok )
return;
QCopRec * r;
while((r=qcopq.dequeue())) {
// remove from queue before sending...
// event loop can come around again before getting
// back from sendLocally
#ifndef QT_NO_COP
QCopChannel::sendLocally( r->channel, r->message, r->data );
#endif
delete r;
}
}
- static void show_mx(QWidget* mw, bool nomaximize, QString &strName)
- {
- if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") )
- {
- ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps );
- }
+ static void show_mx(QWidget* mw, bool nomaximize, QString &strName) {
+ if ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") )
+ {
+ ( ( QMainWindow* ) mw )->setUsesBigPixmaps( useBigPixmaps );
+ }
QPoint p;
QSize s;
bool max;
- if ( mw->isVisible() ) {
- if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
- mw->resize(s);
- mw->move(p);
- }
- mw->raise();
- } else {
- if ( mw->layout() && mw->inherits("QDialog") ) {
- if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
- mw->resize(s);
- mw->move(p);
+ if ( mw->isVisible() ) {
+ if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
+ mw->resize(s);
+ mw->move(p);
+ }
+ mw->raise();
+ } else {
- if ( max && !nomaximize ) {
- mw->showMaximized();
- } else {
- mw->show();
+ if ( mw->layout() && mw->inherits("QDialog") ) {
+ if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
+ mw->resize(s);
+ mw->move(p);
+
+ if ( max && !nomaximize ) {
+ mw->showMaximized();
+ } else {
+ mw->show();
+ }
+ } else {
+ QPEApplication::showDialog((QDialog*)mw,nomaximize);
}
- } else {
- QPEApplication::showDialog((QDialog*)mw,nomaximize);
- }
- } else {
- if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
- mw->resize(s);
- mw->move(p);
- } else { //no stored rectangle, make an estimation
- int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2;
- int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2;
- mw->move( QMAX(x,0), QMAX(y,0) );
+ } else {
+ if ( read_widget_rect(strName, max, p, s) && validate_widget_size(mw, p, s) ) {
+ mw->resize(s);
+ mw->move(p);
+ } else { //no stored rectangle, make an estimation
+ int x = (qApp->desktop()->width()-mw->frameGeometry().width())/2;
+ int y = (qApp->desktop()->height()-mw->frameGeometry().height())/2;
+ mw->move( QMAX(x,0), QMAX(y,0) );
#ifdef Q_WS_QWS
- if ( !nomaximize )
- mw->showMaximized();
+ if ( !nomaximize )
+ mw->showMaximized();
#endif
+ }
+ if ( max && !nomaximize )
+ mw->showMaximized();
+ else
+ mw->show();
+ }
}
- if ( max && !nomaximize )
- mw->showMaximized();
- else
- mw->show();
- }
- }
}
static bool read_widget_rect(const QString &app, bool &maximized, QPoint &p, QSize &s)
{
maximized = TRUE;
// 350 is the trigger in qwsdefaultdecoration for providing a resize button
if ( qApp->desktop()->width() <= 350 )
return FALSE;
Config cfg( "qpe" );
cfg.setGroup("ApplicationPositions");
QString str = cfg.readEntry( app, QString::null );
QStringList l = QStringList::split(",", str);
if ( l.count() == 5) {
p.setX( l[0].toInt() );
p.setY( l[1].toInt() );
s.setWidth( l[2].toInt() );
s.setHeight( l[3].toInt() );
maximized = l[4].toInt();
return TRUE;
}
return FALSE;
}
static bool validate_widget_size(const QWidget *w, QPoint &p, QSize &s)
{
#ifndef Q_WS_QWS
QRect qt_maxWindowRect = qApp->desktop()->geometry();
#endif
int maxX = qt_maxWindowRect.width();
int maxY = qt_maxWindowRect.height();
int wWidth = s.width() + ( w->frameGeometry().width() - w->geometry().width() );
int wHeight = s.height() + ( w->frameGeometry().height() - w->geometry().height() );
// total window size is not allowed to be larger than desktop window size
if ( ( wWidth >= maxX ) && ( wHeight >= maxY ) )
return FALSE;
if ( wWidth > maxX ) {
s.setWidth( maxX - (w->frameGeometry().width() - w->geometry().width() ) );
wWidth = maxX;
}
diff --git a/library/qpeapplication.h b/library/qpeapplication.h
index 579fc44..00d3d31 100644
--- a/library/qpeapplication.h
+++ b/library/qpeapplication.h
@@ -1,265 +1,231 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef __QPE_APPLICATION_H__
#define __QPE_APPLICATION_H__
#include <stdlib.h> // for setenv()
#include <qglobal.h>
#include <qapplication.h>
#include <qdialog.h>
#include <qwsdisplay_qws.h>
#if defined(_WS_QWS_) && !defined(Q_WS_QWS)
#define Q_WS_QWS
#endif
#include "qpedecoration_qws.h"
#include "timestring.h"
+#include "qpeglobal.h"
class QCopChannel;
class QPEApplicationData;
class QWSEvent;
class QWSKeyEvent;
/**
\brief The QPEApplication class implements various system services
that are available to all Qtopia applications.
Simply by using QPEApplication instead of QApplication, a standard Qt
application becomes a Qtopia application. It automatically follows
style changes, quits and raises, and in the
case of \link docwidget.html document-oriented\endlink applications,
changes the currently displayed document in response to the environment.
To create a \link docwidget.html document-oriented\endlink
application use showMainDocumentWidget(); to create a
non-document-oriented application use showMainWidget(). The
keepRunning() function indicates whether the application will
continue running after it's processed the last \link qcop.html
QCop\endlink message. This can be changed using setKeepRunning().
A variety of signals are emitted when certain events occur, for
example, timeChanged(), clockChanged(), weekChanged(),
dateFormatChanged() and volumeChanged(). If the application receives
a \link qcop.html QCop\endlink message on the application's
QPE/Application/\e{appname} channel, the appMessage() signal is
emitted. There are also flush() and reload() signals, which
are emitted when synching begins and ends respectively - upon these
signals, the application should save and reload any data
files that are involved in synching. Most of these signals will initially
be received and unfiltered through the appMessage() signal.
This class also provides a set of useful static functions. The
qpeDir() and documentDir() functions return the respective paths.
The grabKeyboard() and ungrabKeyboard() functions are used to
control whether the application takes control of the device's
physical buttons (e.g. application launch keys). The stylus' mode of
operation is set with setStylusOperation() and retrieved with
stylusOperation(). There are also setInputMethodHint() and
inputMethodHint() functions.
\ingroup qtopiaemb
*/
class QPEApplication : public QApplication
{
Q_OBJECT
public:
QPEApplication( int& argc, char **argv, Type=GuiClient );
~QPEApplication();
static QString qpeDir();
static QString documentDir();
void applyStyle();
void reset();
static int defaultRotation();
static void setDefaultRotation(int r);
static void setCurrentRotation(int r);
static void setCurrentMode(int x, int y, int depth );
static void grabKeyboard();
static void ungrabKeyboard();
enum StylusMode {
LeftOnly,
RightOnHold
// RightOnHoldLeftDelayed, etc.
};
static void setStylusOperation( QWidget*, StylusMode );
static StylusMode stylusOperation( QWidget* );
enum InputMethodHint {
Normal,
AlwaysOff,
AlwaysOn
};
enum screenSaverHint {
Disable = 0,
DisableLightOff = 1,
DisableSuspend = 2,
Enable = 100
};
static void setInputMethodHint( QWidget *, InputMethodHint );
static InputMethodHint inputMethodHint( QWidget * );
void showMainWidget( QWidget*, bool nomax=FALSE );
void showMainDocumentWidget( QWidget*, bool nomax=FALSE );
- static void showDialog( QDialog*, bool nomax=FALSE );
- static int execDialog( QDialog*, bool nomax=FALSE );
- static void showWidget( QWidget*, bool nomax=FALSE );
+
+ static void showDialog( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
+ static int execDialog ( QDialog*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
+ static void showWidget( QWidget*, bool nomax=FALSE ) QPE_WEAK_SYMBOL;
/* Merge setTempScreenSaverMode */
#ifdef QTOPIA_INTERNAL_INITAPP
void initApp( int argv, char **argv );
#endif
static void setKeepRunning();
bool keepRunning() const;
bool keyboardGrabbed() const;
int exec();
signals:
void clientMoused();
void timeChanged();
void clockChanged( bool pm );
void micChanged( bool muted );
void volumeChanged( bool muted );
void appMessage( const QCString& msg, const QByteArray& data);
void weekChanged( bool startOnMonday );
void dateFormatChanged( DateFormat );
void flush();
void reload();
/* linkChanged signal */
private slots:
void systemMessage( const QCString &msg, const QByteArray &data );
void pidMessage( const QCString &msg, const QByteArray &data );
void removeSenderFromStylusDict();
void hideOrQuit();
protected:
bool qwsEventFilter( QWSEvent * );
void internalSetStyle( const QString &style );
void prepareForTermination(bool willrestart);
virtual void restart();
virtual void shutdown();
bool eventFilter( QObject *, QEvent * );
void timerEvent( QTimerEvent * );
bool raiseAppropriateWindow();
virtual void tryQuit();
#ifndef OPIE_NO_ERASE_RECT_HACKFIX
#if QT_VERSION > 233
virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!)
#endif
#endif
private:
void mapToDefaultAction( QWSKeyEvent *ke, int defKey );
void processQCopFile();
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
QCopChannel *sysChannel;
QCopChannel *pidChannel;
#endif
QPEApplicationData *d;
bool reserved_sh;
};
-inline void QPEApplication::showDialog( QDialog* d, bool nomax )
-{
- showWidget( d, nomax );
-}
-inline int QPEApplication::execDialog( QDialog* d, bool nomax )
-{
- showDialog( d, nomax );
- return d->exec();
-}
-
-#ifdef Q_WS_QWS
-extern Q_EXPORT QRect qt_maxWindowRect;
-#endif
-
-inline void QPEApplication::showWidget( QWidget* wg, bool nomax )
-{
- if ( wg->isVisible() )
- wg->show();
- else
- {
- if ( !nomax
- && ( qApp->desktop()->width() <= 320 ) )
- {
- wg->showMaximized();
- } else {
- #ifdef Q_WS_QWS
- QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() );
- #else
- QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() );
- #endif
-
- QSize sh = wg->sizeHint();
- int w = QMAX( sh.width(), wg->width() );
- int h = QMAX( sh.height(), wg->height() );
- // desktop widget-frame taskbar
- w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) );
- h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) );
-
- wg->resize( w, h );
- wg->show();
- }
- }
-}
enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */
inline int TransToDeg ( Transformation t )
{
int d = static_cast<int>( t );
return d * 90;
}
inline Transformation DegToTrans ( int d )
{
Transformation t = static_cast<Transformation>( d / 90 );
return t;
}
/*
* Set current rotation of Opie, and rotation for newly started apps.
* Differs from setDefaultRotation in that 1) it rotates currently running apps,
* and 2) does not set deforient or save orientation to qpe.conf.
*/
inline void QPEApplication::setCurrentRotation( int r )
{
// setTransformation has been introduced in Qt/Embedded 2.3.4 snapshots
// for compatibility with the SharpROM use fallback to setDefaultTransformation()
#if QT_VERSION > 233
Transformation e = DegToTrans( r );
::setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
qApp->desktop()->qwsDisplay()->setTransformation( e );
#else
setDefaultRotation( r );
#endif
}
+/*
+ * -remove me
+ */
+#ifdef Q_WS_QWS
+extern Q_EXPORT QRect qt_maxWindowRect;
+#endif
+
#endif
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp
index 8b02de6..fa38180 100644
--- a/library/qpedecoration_qws.cpp
+++ b/library/qpedecoration_qws.cpp
@@ -65,97 +65,98 @@ static const char * const qpe_close_xpm[] = {
" .++...+...++. ",
" .+++.....+++. ",
" .++++...++++. ",
" .+++.....+++. ",
" .++...+...++. ",
" .+..+++..+. ",
" .+++++++++. ",
" ..+++++.. ",
" ..... ",
" "};
/* XPM */
static const char * const qpe_accept_xpm[] = {
"16 16 3 1",
" c None",
". c #FFFFFF",
"+ c #000000",
" ",
" ",
" ..... ",
" ..+++++.. ",
" .+++++++++. ",
" .+++++++++. ",
" .+++++++..++. ",
" .++.+++...++. ",
" .+...+...+++. ",
" .+......++++. ",
" .++....+++++. ",
" .++..+++++. ",
" .+++++++++. ",
" ..+++++.. ",
" ..... ",
" "};
#endif // QT_NO_IMAGEIO_XPM
class DecorHackWidget : public QWidget
{
public:
bool needsOk() {
return (getWState() & WState_Reserved1 ) ||
(inherits("QDialog") && !inherits("QMessageBox")
&& !inherits("QWizard") );
}
};
static QImage scaleButton( const QImage &img, int height )
{
- if ( img.height() != 0 && img.height() != height ) {
+ //ML: We don't want to scale if the difference is less than 4 pixels to prevent blurring
+ if ( img.height() != 0 && ::abs( img.height()-height ) > 4 ) {
return img.smoothScale( img.width()*height/img.height(), height );
} else {
return img;
}
}
class TLWidget : public QWidget
{
public:
QWSManager *manager()
{
return topData()->qwsManager;
}
QTLWExtra *topExtra()
{
return topData();
}
void setWState( uint s ) { QWidget::setWState( s ); }
void clearWState( uint s ) { QWidget::clearWState( s ); }
};
QPEManager::QPEManager( QPEDecoration *d, QObject *parent )
: QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE)
{
wtTimer = new QTimer( this );
connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) );
}
void QPEManager::updateActive()
{
QWidget *newActive = qApp->activeWindow();
if ( newActive && (QWidget*)active == newActive )
return;
if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) {
((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this );
}
if ( newActive && ((TLWidget *)newActive)->manager() ) {
active = newActive;
((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this );
} else if ( !newActive ) {
active = 0;
}
diff --git a/library/qpeglobal.h b/library/qpeglobal.h
index 96ce3a6..a84e435 100644
--- a/library/qpeglobal.h
+++ b/library/qpeglobal.h
@@ -1,55 +1,88 @@
/*
-               =. This file is part of the OPIE Project
-             .=l. Copyright (c) 2002,2003,2004 Holger Hans Peter Freyther <freyther@handhelds.org>
+ This file is part of the OPIE Project
+ Copyright (c) 2002,2003,2004 Holger Hans Peter Freyther <freyther@handhelds.org>
+ Copyright (c) 2002,2003,2004 Stefan Eilers <eilers@handhelds.org>
+
+               =.
+             .=l.
           .>+-=
 _;:,     .>    :=|. This library is free software; you can
.> <`_,   >  .   <= redistribute it and/or modify it under
:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
.="- .-=="i,     .._ License as published by the Free Software
 - .   .-<_>     .<> Foundation; either version 2 of the License,
     ._= =}       : or (at your option) any later version.
    .%`+i>       _;_.
    .i_,=:_.      -<s. This library is distributed in the hope that
     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
    : ..    .:,     . . . without even the implied warranty of
    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
..}^=.=       =       ; Library General Public License for more
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#ifndef QPE_GLOBAL_H
-#define QPE_GLOBAL_H
+#ifndef QPE_GLOBAL_DEFINES_H
+#define QPE_GLOBAL_DEFINES_H
/**
* Defines for used compiler attributes
*
*/
+
+/*
+ * commons
+ */
+#define QPE_DEPRECATED
+
+
#if defined(Q_OS_MACX)
#define QPE_WEAK_SYMBOL __attribute__((weak_import))
#define QPE_SYMBOL_USED
#define QPE_SYMBOL_UNUSED
+#define QPE_EXPORT_SYMBOL
#elif defined(_OS_UNIX_)
#define QPE_WEAK_SYMBOL __attribute__((weak))
#define QPE_SYMBOL_USED __attribute__((used))
#define QPE_SYMBOL_UNUSED __attribute__((unused))
+#define QPE_EXPORT_SYMBOL
+
+
+/*
+ * mark method as deprecated
+ */
+#if __GNUC__ - 0 > 3 || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 >= 2)
+ /* gcc >= 3.2 */
+#undef QPE_DEPRECATED
+#define QPE_DEPRECATED __attribute__((deprecated))
+#endif
+
+/*
+ * Defined if Compiler supports attributes
+ */
+#ifdef GCC_SUPPORTS_VISIBILITY
+#undef QPE_EXPORT_SYMBOL
+#define QPE_EXPORT_SYMBOL __attribute__((visibility("default")))
+#endif
+
#else // defined(Q_OS_WIN32)
#define QPE_WEAK_SYMBOL
#define QPE_SYMBOL_USED
#define QPE_SYMBOL_UNUSED
+#define QPE_EXPORT_SYMBOL
#endif
#endif
diff --git a/library/qpemenubar.h b/library/qpemenubar.h
index 66d0c85..64bf39c 100644
--- a/library/qpemenubar.h
+++ b/library/qpemenubar.h
@@ -1,85 +1,87 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QPEMENUBAR_H
#define QPEMENUBAR_H
#include <qmenubar.h>
#include <qguardedptr.h>
#include <qvaluelist.h>
+#include <qtopia/qpeglobal.h>
+
class QPEMenuToolFocusManager : public QObject
{
Q_OBJECT
public:
QPEMenuToolFocusManager();
void addWidget( QWidget *w );
void removeWidget( QWidget *w );
void setActive( bool a );
bool isActive() const;
void moveFocus( bool next );
static QPEMenuToolFocusManager *manager();
static void initialize();
protected:
void setFocus( QWidget *w, bool next=TRUE );
bool eventFilter( QObject *object, QEvent *event );
private slots:
void deactivate();
private:
typedef QGuardedPtr<QWidget> GuardedWidget;
QValueList<GuardedWidget> list;
GuardedWidget inFocus;
GuardedWidget oldFocus;
static QPEMenuToolFocusManager *me;
private: // Sharp ROM compatibility
void setMenukeyEnabled ( bool b );
};
-class QPEMenuBar : public QMenuBar
+class QPE_DEPRECATED QPEMenuBar : public QMenuBar
{
Q_OBJECT
public:
QPEMenuBar( QWidget *parent=0, const char* name=0 );
~QPEMenuBar();
protected:
virtual void keyPressEvent( QKeyEvent *e );
/* Patch from Mickey
* Sharp Qtopia1.5 seems to have these functions
* TO BE RESOLVED - zecke
*/
void activateItem( int index );
void goodbye();
// This is a special "lineo" add-on for the Sharp ROM
// nobody knows, what it does, though ...
int getOldFocus ( );
};
#endif
diff --git a/library/qpetoolbar.h b/library/qpetoolbar.h
index 53d21c0..c894ec9 100644
--- a/library/qpetoolbar.h
+++ b/library/qpetoolbar.h
@@ -1,39 +1,40 @@
/**********************************************************************
** Copyright (C) 2001 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QPETOOLBAR_H
#define QPETOOLBAR_H
#include <qtoolbar.h>
+#include <qtopia/qpeglobal.h>
class QMainWindow;
-class QPEToolBar : public QToolBar
+class QPE_DEPRECATED QPEToolBar : public QToolBar
{
Q_OBJECT
public:
QPEToolBar( QMainWindow *parent = 0, const char *name = 0 );
protected:
virtual void childEvent( QChildEvent *e );
};
#endif
diff --git a/library/widget_showing.cpp b/library/widget_showing.cpp
new file mode 100644
index 0000000..43ece64
--- a/dev/null
+++ b/library/widget_showing.cpp
@@ -0,0 +1,74 @@
+/*
+ This file is part of the OPIE Project
+ Copyright (c) 2004 Andreas Richter <ar@handhelds.org>
+ Copyright (c) 2004 Holger Hans Peter Freyther <freyther@handhelds.org>
+               =.
+             .=l.
+           .>+-=
+ _;:,     .>    :=|. This library is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This library is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.=       =       ; Library General Public License for more
+++=   -.     .`     .: details.
+ :     =  ...= . :.=-
+ -.   .:....=;==+<; You should have received a copy of the GNU
+  -_. . .   )=.  = Library General Public License along with
+    --        :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#include <qtopia/qpeapplication.h>
+
+#ifdef Q_WS_QWS
+extern Q_EXPORT QRect qt_maxWindowRect;
+#endif
+
+void QPEApplication::showDialog( QDialog* d, bool nomax )
+{
+ showWidget( d, nomax );
+}
+
+int QPEApplication::execDialog( QDialog* d, bool nomax )
+{
+ showDialog( d, nomax );
+ return d->exec();
+}
+
+void QPEApplication::showWidget( QWidget* wg, bool nomax ) {
+ if ( wg->isVisible() ) {
+ wg->show();
+ return;
+ }
+
+ if ( !nomax
+ && ( qApp->desktop()->width() <= 320 ) ){
+ wg->showMaximized();
+ } else {
+#ifdef Q_WS_QWS
+ QSize desk = QSize( qApp->desktop()->width(), qApp->desktop()->height() );
+#else
+ QSize desk = QSize( qt_maxWindowRect.width(), qt_maxWindowRect.height() );
+#endif
+
+ QSize sh = wg->sizeHint();
+ int w = QMAX( sh.width(), wg->width() );
+ int h = QMAX( sh.height(), wg->height() );
+// desktop widget-frame taskbar
+ w = QMIN( w, ( desk.width() - ( wg->frameGeometry().width() - wg->geometry().width() ) - 25 ) );
+ h = QMIN( h, ( desk.height() - ( wg->frameGeometry().height() - wg->geometry().height() ) - 25 ) );
+ wg->resize( w, h );
+ wg->show();
+ }
+}