[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [patch] KApplication
From:       Jarosław_Staniek <js () iidea ! pl>
Date:       2004-10-14 19:04:04
Message-ID: 416EDBF8.9050801 () iidea ! pl
[Download RAW message or body]

- K_WS_QTONLY removed (eventually it will be totally removed)
- KApplication_init_windows() added

-- 
regards / pozdrawiam,
   Jaroslaw Staniek / OpenOffice Polska
   Kexi project: http://koffice.org/kexi/ http://www.kexi-project.org/
   Qt-KDE Wrapper project: http://iidea.pl/~js/qkw/

["kdecore.patch" (text/plain)]

Index: kapplication.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kapplication.cpp,v
retrieving revision 1.684
diff -u -r1.684 kapplication.cpp
--- kapplication.cpp	13 Oct 2004 11:15:40 -0000	1.684
+++ kapplication.cpp	14 Oct 2004 18:59:26 -0000
@@ -73,7 +73,7 @@
 #include <kprotocolinfo.h>
 #include <kkeynative.h>
 
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
 #include <kstartupinfo.h>
 #endif
 
@@ -101,7 +101,7 @@
 #include <errno.h>
 #include <string.h>
 #include <netdb.h>
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
 //#ifndef Q_WS_QWS //FIXME(E): NetWM should talk to QWS...
 #include <netwm.h>
 #endif
@@ -112,7 +112,6 @@
 #include <paths.h>
 #endif
 
-//#if defined Q_WS_X11 && ! defined K_WS_QTONLY
 #ifdef Q_WS_X11
 #include <X11/Xlib.h> // schrode
 #include <X11/Xutil.h> // schrode
@@ -138,7 +137,7 @@
 #define DISPLAY "QWS_DISPLAY"
 #endif
 
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
 #include <kipc.h>
 #endif
 
@@ -191,6 +190,10 @@
 }
 #endif
 
+#ifdef Q_WS_WIN
+void KApplication_init_windows(bool GUIenabled);
+#endif
+
 /*
   Private data to make keeping binary compatibility easier
  */
@@ -498,7 +501,7 @@
     if( t == QEvent::Show && receiver->isWidgetType())
     {
     QWidget* w = static_cast< QWidget* >( receiver );
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
         if( w->isTopLevel() && !startupId().isEmpty()) // TODO better done using window group leader?
             KStartupInfo::setWindowStartupId( w->winId(), startupId());
 #endif
@@ -518,7 +521,7 @@
 
 void KApplication::checkAppStartedSlot()
 {
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
     KStartupInfo::handleAutoAppStartedSending();
 #endif
 }
@@ -781,7 +784,7 @@
   smw = 0;
 
   // Initial KIPC event mask.
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
   kipcEventMask = (1 << KIPC::StyleChanged) | (1 << KIPC::PaletteChanged) |
                   (1 << KIPC::FontChanged) | (1 << KIPC::BackgroundChanged) |
                   (1 << KIPC::ToolbarStyleChanged) | (1 << KIPC::SettingsChanged) |
@@ -879,6 +882,8 @@
 		    32, PropModeReplace, (unsigned char *)&data, 1);
   }
   d->oldIceIOErrorHandler = IceSetIOErrorHandler( kde_ice_ioerrorhandler );
+#elif defined(Q_WS_WIN)
+  KApplication_init_windows(GUIenabled);
 #else
   // FIXME(E): Implement for Qt Embedded
 #endif
@@ -1715,7 +1720,6 @@
         }
     }
 
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
     if ((_event->type == ClientMessage) &&
             (_event->xclient.message_type == kipcCommAtom))
     {
@@ -1780,14 +1784,13 @@
         }
         return true;
     }
-#endif // Q_WS_X11 && ! K_WS_QTONLY
     return false;
 }
-#endif
+#endif // Q_WS_X11
 
 void KApplication::updateUserTimestamp( unsigned long time )
 {
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
     if( time == 0 )
     { // get current X timestamp
         Window w = XCreateSimpleWindow( qt_xdisplay(), qt_xrootwin(), 0, 0, 1, 1, 0, 0, 0 );
@@ -1807,7 +1810,7 @@
 
 unsigned long KApplication::userTimestamp() const
 {
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
     return qt_x_user_time;
 #else
     return 0;
@@ -1816,7 +1819,7 @@
 
 void KApplication::updateRemoteUserTimestamp( const QCString& dcopId, unsigned long time )
 {
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
     if( time == 0 )
         time = qt_x_user_time;
     DCOPRef( dcopId, "MainApplication-Interface" ).call( "updateUserTimestamp", time );
@@ -2463,7 +2466,7 @@
    }
 #endif
    stream << envs;
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
    // make sure there is id, so that user timestamp exists
    stream << ( startup_id.isEmpty() ? KStartupInfo::createNewStartupId() : startup_id );
 #endif
@@ -2702,7 +2705,7 @@
 
     // set the specified icons
     topWidget->setIcon( icon() ); //standard X11
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
 //#ifdef Q_WS_X11 // FIXME(E): Implement for Qt/Embedded
     KWin::setIcons(topWidget->winId(), icon(), miniIcon() ); // NET_WM hints for KWin
 
@@ -2723,7 +2726,7 @@
     else
         {
         d->startup_id = startup_id;
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
         KStartupInfoId id;
         id.initId( startup_id );
         long timestamp = id.timestamp();
@@ -2737,7 +2740,7 @@
 // not to propagate it to processes started from this app
 void KApplication::read_app_startup_id()
 {
-#if defined Q_WS_X11 && ! defined K_WS_QTONLY
+#if defined Q_WS_X11
     KStartupInfoId id = KStartupInfo::currentStartupIdEnv();
     KStartupInfo::resetStartupEnv();
     d->startup_id = id.id();

["kapplication_win.cpp" (text/x-c++src)]

/*
   This file is part of the KDE libraries
   Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   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 <kapplication.h>
#include <kstandarddirs.h>
#include <klocale.h>

/**
 * MS Windows-related actions for KApplication startup.
 * 
 * - Use Qt translation which will be usable for QFileDialog 
 *    and other Qt-only GUIs. The "qt_<language>.qm" file should be stored
 *    in the same place as .po files for a given language.
 *
 * @internal
*/
void KApplication_init_windows(bool /*GUIenabled*/)
{
	QString qt_transl_file = ::locate( "locale", KGlobal::locale()->language() 
		+ "/LC_MESSAGES/qt_" + KGlobal::locale()->language() + ".qm" );
	QTranslator *qt_transl = new QTranslator();
	if (qt_transl->load( qt_transl_file, ""))
		kapp->installTranslator( qt_transl );
	else
		delete qt_transl;
}



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic