summaryrefslogtreecommitdiff
path: root/x11/libqpe-x11
Side-by-side diff
Diffstat (limited to 'x11/libqpe-x11') (more/less context) (ignore whitespace changes)
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp
index 3cb8faf..73e7ce4 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.cpp
+++ b/x11/libqpe-x11/qpe/qpeapplication.cpp
@@ -47,214 +47,214 @@ const int XKeyRelease = KeyRelease;
#undef KeyRelease
namespace {
struct QCopRec{
QCopRec( const QCString& ch, const QCString& msg, const QByteArray& ar )
: channel(ch), message(msg), data(ar) {
}
QCString channel;
QCString message;
QByteArray data;
};
};
class QPEApplication::Private {
public:
Private();
~Private();
void enqueueQCop( const QCString& ch, const QCString& msg,
const QByteArray& );
void sendQCopQ();
static void show_mx(QWidget* mw, bool nomaximize );
void show( QWidget* mw, bool nomax );
void loadTextCodecs();
void loadImageCodecs();
int kbgrabber;
int presstimer;
bool rightpressed : 1;
bool kbregrab : 1;
bool notbusysent : 1;
bool preloaded : 1;
bool forceshow : 1;
bool nomaximize : 1;
bool keep_running : 1;
QWidget* presswidget;
QPoint presspos;
QWidget* qpe_main_widget;
QString appName;
QString styleName;
QString decorationName;
Atom wm_delete_window;
Atom wm_take_focus;
Atom wm_context_help;
Atom wm_context_accept;
Atom wm_protocols;
private:
QList<QCopRec> qcopq;
};
QPEApplication::Private::~Private() {
}
QPEApplication::Private::Private()
: kbgrabber(0 ), presstimer(0 ), rightpressed( FALSE ), kbregrab( FALSE ), notbusysent( FALSE ),
preloaded( FALSE ), forceshow( FALSE ), nomaximize( FALSE ), keep_running( TRUE ),
presswidget( 0 ), qpe_main_widget(0 ) {
qcopq.setAutoDelete( TRUE );
}
void QPEApplication::Private::enqueueQCop( const QCString& chan, const QCString& msg,
const QByteArray& ar ) {
qcopq.append( new QCopRec(chan, msg, ar ) );
}
void QPEApplication::Private::sendQCopQ() {
QCopRec* r;
for ( r = qcopq.first(); r; r = qcopq.next() ) {
QCopChannel::sendLocally( r->channel, r->message, r->data );
}
qcopq.clear();
}
void QPEApplication::Private::show_mx(QWidget* mw, bool nomaximize ) {
if (mw->layout() && mw->inherits("QDialog") ) {
QPEApplication::showDialog( (QDialog*)mw, nomaximize );
}else {
if (!nomaximize )
mw->showMaximized();
else
mw->show();
}
}
void QPEApplication::Private::show( QWidget* mw, bool nomax ) {
nomaximize = nomax;
qpe_main_widget = mw;
sendQCopQ();
if ( preloaded ) {
if (forceshow )
show_mx(mw, nomax );
}else if ( keep_running )
show_mx( mw, nomax );
}
void QPEApplication::Private::loadTextCodecs() {
- QString path = QPEApplication::qpeDir() + "/plugins/textcodecs";
+ QString path = QPEApplication::qpeDir() + "plugins/textcodecs";
QDir dir( path, "lib*.so" );
QStringList list = dir.entryList();
QStringList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
TextCodecInterface *iface = 0;
QLibrary *lib = new QLibrary( path + "/" + *it );
if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
QValueList<int> mibs = iface->mibEnums();
for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) {
(void)iface->createForMib(*i);
// ### it exists now; need to remember if we can delete it
}
}
else {
lib->unload();
delete lib;
}
}
}
void QPEApplication::Private::loadImageCodecs() {
- QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs";
+ QString path = QPEApplication::qpeDir() + "plugins/imagecodecs";
QDir dir( path, "lib*.so" );
QStringList list = dir.entryList();
QStringList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
ImageCodecInterface *iface = 0;
QLibrary *lib = new QLibrary( path + "/" + *it );
if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
QStringList formats = iface->keys();
for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) {
(void)iface->installIOHandler(*i);
// ### it exists now; need to remember if we can delete it
}
}
else {
lib->unload();
delete lib;
}
}
}
// The Help System hook
namespace {
class ResourceMimeFactory : public QMimeSourceFactory
{
public:
ResourceMimeFactory();
~ResourceMimeFactory();
const QMimeSource* data( const QString& abs_name )const;
};
ResourceMimeFactory::ResourceMimeFactory()
{
setFilePath( Global::helpPath() );
setExtensionType( "html", "text/html;charset=UTF-8" );
}
ResourceMimeFactory::~ResourceMimeFactory() {
}
const QMimeSource* ResourceMimeFactory::data( const QString& abs_name ) const
{
const QMimeSource * r = QMimeSourceFactory::data( abs_name );
if ( !r ) {
int sl = abs_name.length();
do {
sl = abs_name.findRev( '/', sl - 1 );
QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name;
int dot = name.findRev( '.' );
if ( dot >= 0 )
name = name.left( dot );
QImage img = Resource::loadImage( name );
if ( !img.isNull() )
r = new QImageDrag( img );
}
while ( !r && sl > 0 );
}
return r;
};
};
// QPEApplication
QPEApplication::~QPEApplication() {
qWarning("~QPEApplication");
ungrabKeyboard();
qWarning("UngrabKeyboard");
// delete m_sys;
// delete m_pid;
delete d;
}
QPEApplication::QPEApplication(int &arg, char** argv, Type t)
: QApplication( arg, argv, t ) {
d = new Private;
d->loadTextCodecs();
d->loadImageCodecs();
// Init X-Atom
Atom *atoms[5];
Atom atoms_re[5];
char* names[5];
int n = 0;
atoms[n] = &d->wm_delete_window;
names[n++] = "WM_DELETE_WINDOW";
atoms[n] = &d->wm_take_focus;
names[n++] = "WM_TAKE_FOCUS";
atoms[n] = &d->wm_context_help;
names[n++] = "_NET_WM_CONTEXT_HELP";
atoms[n] = &d->wm_context_accept;
names[n++] = "_NET_WM_CONTEXT_ACCEPT";
atoms[n] = &d->wm_protocols;
names[n++] = "WM_PROTOCOLS";
XInternAtoms( qt_xdisplay(), names, n, FALSE, atoms_re);
// now copy the values over to the properties