Hello community,
here is the log from the commit of package kdebase3
checked in at Mon Apr 14 20:00:07 CEST 2008.
--------
--- KDE/kdebase3/kdebase3.changes 2008-04-13 20:59:34.000000000 +0200
+++ kdebase3/kdebase3.changes 2008-04-14 18:11:13.000000000 +0200
@@ -1,0 +2,6 @@
+Mon Apr 14 18:09:05 CEST 2008 - llunak@suse.cz
+
+- improve the low-disk-space dialog (bnc#199054)
+- GUI for selecting the WM (bnc#332079)
+
+-------------------------------------------------------------------
Old:
----
optional-kwin.diff
New:
----
select-wm-gui.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ kdebase3.spec ++++++
--- /var/tmp/diff_new_pack.Dto396/_old 2008-04-14 19:59:11.000000000 +0200
+++ /var/tmp/diff_new_pack.Dto396/_new 2008-04-14 19:59:11.000000000 +0200
@@ -61,7 +61,7 @@
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Url: http://www.kde.org/
Version: 3.5.9
-Release: 32
+Release: 34
%define kde_version 3.5.9
Requires: kdebase3-runtime == %{version}
Source0: kdebase-%{kde_version}.tar.bz2
@@ -182,7 +182,7 @@
Patch169: systray_order.diff
Patch170: khotkeys-multimedia-action.diff
Patch171: khotkeys-multimedia-action2.diff
-Patch172: optional-kwin.diff
+Patch172: select-wm-gui.diff
Patch173: suspend-unmount.diff
Patch177: kio-media-errorhandling.diff
Patch179: restore-description-parens.diff
@@ -459,7 +459,7 @@
Summary: Set and list fileshares
Group: System/Management
Version: 2.0
-Release: 468
+Release: 470
%description -n fileshareset
This package contains the the fileshareset utility to allow users to
@@ -1661,6 +1661,9 @@
%verify(not mode) %attr(4755,root,shadow) /opt/kde3/bin/kcheckpass
%changelog
+* Mon Apr 14 2008 llunak@suse.cz
+- improve the low-disk-space dialog (bnc#199054)
+- GUI for selecting the WM (bnc#332079)
* Sun Apr 13 2008 dmueller@suse.de
- fix build against glibc 2.8
- fix session restore of kde3 apps if kde 4.x is installed
++++++ lowdiskspace.patch ++++++
--- /var/tmp/diff_new_pack.Dto396/_old 2008-04-14 19:59:13.000000000 +0200
+++ /var/tmp/diff_new_pack.Dto396/_new 2008-04-14 19:59:13.000000000 +0200
@@ -1,137 +1,401 @@
-Index: kioslave/media/medianotifier/medianotifier.cpp
-===================================================================
---- kioslave/media/medianotifier/medianotifier.cpp (Revision 593834)
-+++ kioslave/media/medianotifier/medianotifier.cpp (Arbeitskopie)
-@@ -19,8 +19,12 @@
+Subject: Dialog notifying about running low on disk space
+From: Lubos Lunak
+Feature: bnc#199054
+Patch-upstream: no
+
+--- kioslave/media/medianotifier/Makefile.am.sav 2005-07-26 14:13:37.000000000 +0200
++++ kioslave/media/medianotifier/Makefile.am 2008-04-11 17:34:00.000000000 +0200
+@@ -5,7 +5,8 @@ kded_medianotifier_la_LDFLAGS = -module
+ kded_medianotifier_la_LIBADD = ../libmediacommon/libmediacommon.la $(LIB_KDECORE) \
+ $(LIB_KDEUI) $(LIB_KIO)
+ kded_medianotifier_la_SOURCES = medianotifier.cpp medianotifier.skel \
+- notificationdialog.cpp notificationdialogview.ui
++ notificationdialog.cpp notificationdialogview.ui \
++ freespacenotifier.cpp freespacewidget.ui
- #include "medianotifier.h"
+ noinst_HEADERS = medianotifier.h notificationdialog.h
-+#include
+--- kioslave/media/medianotifier/medianotifier.h.sav 2008-04-11 16:47:21.000000000 +0200
++++ kioslave/media/medianotifier/medianotifier.h 2008-04-11 16:48:12.000000000 +0200
+@@ -27,6 +27,8 @@
+ #include
+ #include
+
++class FreeSpaceNotifier;
+
- #include
- #include
-+#include
-+#include
+ class MediaNotifier: public KDEDModule
+ {
+ Q_OBJECT
+@@ -52,6 +54,8 @@ private:
+ const QString &autoopenFile );
+
+ QMapKIO::Job*,bool m_allowNotificationMap;
++ FreeSpaceNotifier* m_freeSpaceNotifier;
+ };
++
+ #endif
- #include
- #include
-@@ -44,6 +48,11 @@
+--- kioslave/media/medianotifier/medianotifier.cpp.sav 2008-04-11 16:47:21.000000000 +0200
++++ kioslave/media/medianotifier/medianotifier.cpp 2008-04-11 16:49:22.000000000 +0200
+@@ -36,6 +36,7 @@
+ #include "notifiersettings.h"
+ #include "notifieraction.h"
+ #include "mediamanagersettings.h"
++#include "freespacenotifier.h"
+
+ MediaNotifier::MediaNotifier(const QCString &name) : KDEDModule(name)
+ {
+@@ -44,6 +45,8 @@ MediaNotifier::MediaNotifier(const QCStr
connectDCOPSignal( "kded", "mediamanager", "mediumChanged(QString, bool)",
"onMediumChange(QString, bool)", true );
+
-+ m_freeTimer = new QTimer( this );
-+ connect( m_freeTimer, SIGNAL( timeout() ), SLOT( checkFreeDiskSpace() ) );
-+ m_freeTimer->start( 1000*6*2 /* 20 minutes */ );
-+ m_freeDialog = 0;
++ m_freeSpaceNotifier = new FreeSpaceNotifier( this );
}
MediaNotifier::~MediaNotifier()
-@@ -309,4 +318,69 @@
- }
+@@ -53,6 +56,7 @@ MediaNotifier::~MediaNotifier()
+
+ disconnectDCOPSignal( "kded", "mediamanager", "mediumChanged(QString, bool)",
+ "onMediumChange(QString, bool)" );
++ delete m_freeSpaceNotifier;
}
-+void MediaNotifier::checkFreeDiskSpace()
+ void MediaNotifier::onMediumChange( const QString &name, bool allowNotification )
+--- kioslave/media/medianotifier/freespacenotifier.cpp.sav 2008-04-11 16:50:50.000000000 +0200
++++ kioslave/media/medianotifier/freespacenotifier.cpp 2008-04-11 20:08:59.000000000 +0200
+@@ -0,0 +1,159 @@
++/* This file is part of the KDE Project
++ Copyright (c) 2006 Lukas Tinkl
++ Copyright (c) 2008 Lubos Lunak
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program 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 General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see http://www.gnu.org/licenses/.
++*/
++
++#include "freespacenotifier.h"
++
++#include
++#include
++
++#include
++#include
++#include
++#include
++
++#include
++#include
++#include
++#include
++
++#include "freespacewidget.h"
++
++
++FreeSpaceNotifier::FreeSpaceNotifier( QObject* parent )
++ : QObject( parent )
++ , lastAvailTimer( NULL )
++ , dialog( NULL )
++ , lastAvail( -1 )
+{
-+ struct statfs sfs;
-+ long total, avail;
-+ if ( m_freeDialog )
-+ return;
++ connect( &timer, SIGNAL( timeout() ), SLOT( checkFreeDiskSpace() ) );
++ KConfig cfg( "lowspacesuse", true ); // read only
++ KConfigGroup group( &cfg, "General" );
++ limit = group.readNumEntry( "WarnMinimumFreeSpace", 200 ); // MiB
++ if( limit != 0 )
++ timer.start( 1000 * 60 /* 1 minute */ );
++}
++
++FreeSpaceNotifier::~FreeSpaceNotifier()
++{
++ delete dialog;
++}
+
++void FreeSpaceNotifier::checkFreeDiskSpace()
++{
++ if ( dialog )
++ return;
++ struct statfs sfs;
+ if ( statfs( QFile::encodeName( QDir::homeDirPath() ), &sfs ) == 0 )
+ {
-+ total = sfs.f_blocks;
-+ avail = ( getuid() ? sfs.f_bavail : sfs.f_bfree );
++ long avail = ( getuid() ? sfs.f_bavail : sfs.f_bfree );
+
-+ if (avail < 0 || total <= 0)
++ if (avail < 0 || sfs.f_blocks <= 0)
+ return; // we better do not say anything about it
-+
-+ int freeperc = static_cast<int>(100 * double(avail) / total);
-+
-+ if ( freeperc < 5 && KMessageBox::shouldBeShownContinue( "dontagainfreespace" ) ) // free disk space dropped under a limit
++
++ int availpct = int( 100 * avail / sfs.f_blocks );
++ avail = ((long long)avail) * sfs.f_bsize / ( 1024 * 1024 ); // to MiB
++ bool warn = false;
++ if( avail < limit ) // avail disk space dropped under a limit
++ {
++ if( lastAvail < 0 ) // always warn the first time
++ {
++ lastAvail = avail;
++ warn = true;
++ }
++ else if( avail > lastAvail ) // the user freed some space
++ lastAvail = avail; // so warn if it goes low again
++ else if( avail < lastAvail * 0.5 ) // available dropped to a half of previous one, warn again
++ {
++ warn = true;
++ lastAvail = avail;
++ }
++ // do not change lastAvail otherwise, to handle free space slowly going down
++ }
++ if ( warn )
+ {
-+ m_freeDialog= new KDialogBase(
++ dialog = new KDialogBase(
+ i18n( "Low Disk Space" ),
-+ KDialogBase::Yes | KDialogBase::No,
++ KDialogBase::Yes | KDialogBase::No | KDialogBase::Cancel,
+ KDialogBase::Yes, KDialogBase::No,
-+ 0, "warningYesNo", false, true,
-+ i18n( "Start Konqueror" ), KStdGuiItem::cancel());
-+
-+ QString text = i18n( "You are running low on disk space on your home partition (currently %1% free), would you like to "
-+ "run Konqueror to free some disk space and fix the problem?" ).arg( freeperc );
-+ bool checkboxResult = false;
-+ KMessageBox::createKMessageBox(m_freeDialog, QMessageBox::Warning, text, QStringList(),
-+ i18n("Do not ask again"),
-+ &checkboxResult, KMessageBox::Notify | KMessageBox::NoExec);
-+ m_freeDialog->show();
-+ connect( m_freeDialog, SIGNAL( yesClicked() ), SLOT( slotFreeContinue() ) );
-+ connect( m_freeDialog, SIGNAL( noClicked() ), SLOT( slotFreeCancel() ) );
++ 0, "lowdiskspacedialog", false, true,
++ i18n( "Open File Manager" ), i18n( "Do Nothing" ), i18n( "Disable Warning" ));
++ widget = new FreeSpaceWidget( dialog );
++ dialog->setMainWidget( widget );
++
++ QString text = i18n( "You are running low on disk space on your home partition (currently %2%, %1 MiB free)." )
++ .arg( avail ).arg( availpct );
++ widget->warningLabel->setText( text );
++ widget->spinbox->setMinValue( 0 );
++ widget->spinbox->setMaxValue( 100000 );
++ widget->spinbox->setValue( limit );
++ connect( dialog, SIGNAL( yesClicked() ), SLOT( slotYes() ) );
++ connect( dialog, SIGNAL( noClicked() ), SLOT( slotNo() ) );
++ connect( dialog, SIGNAL( cancelClicked() ), SLOT( slotCancel() ) );
++ dialog->show();
+ }
+ }
+}
+
-+void MediaNotifier::slotFreeContinue()
++void FreeSpaceNotifier::slotYes()
+{
-+ slotFreeFinished( KMessageBox::Continue );
++ ( void ) new KRun( KURL::fromPathOrURL( QDir::homeDirPath() ) );
++ cleanupDialog( widget->spinbox->value());
+}
+
-+void MediaNotifier::slotFreeCancel()
++void FreeSpaceNotifier::slotNo()
+{
-+ slotFreeFinished( KMessageBox::Cancel );
++ cleanupDialog( widget->spinbox->value());
+}
+
-+void MediaNotifier::slotFreeFinished( KMessageBox::ButtonCode res )
++void FreeSpaceNotifier::slotCancel()
+{
-+ QCheckBox *checkbox = ::qt_cast( m_freeDialog->child( 0, "QCheckBox" ) );
-+ if ( checkbox && checkbox->isChecked() )
-+ KMessageBox::saveDontShowAgainYesNo("dontagainfreespace", res);
-+ m_freeDialog->delayedDestruct();
-+ m_freeDialog = 0;
++ cleanupDialog( 0 ); // set limit to zero
++}
+
-+ if ( res == KMessageBox::Continue ) // start Konqi
++void FreeSpaceNotifier::cleanupDialog( long newLimit )
++{
++ dialog->deleteLater();
++ dialog = NULL;
++ if( limit != newLimit )
+ {
-+ ( void ) new KRun( KURL::fromPathOrURL( QDir::homeDirPath() ) );
++ KConfig cfg( "lowspacesuse" );
++ KConfigGroup group( &cfg, "General" );
++ limit = newLimit;
++ group.writeEntry( "WarnMinimumFreeSpace", limit );
++ if( limit == 0 )
++ timer.stop();
++ }
++ if( limit != 0 )
++ { // warn again if constanly below limit for too long
++ if( lastAvailTimer == NULL )
++ {
++ lastAvailTimer = new QTimer( this );
++ connect( lastAvailTimer, SIGNAL( timeout()), SLOT( resetLastAvailable()));
++ }
++ lastAvailTimer->start( 1000 * 60 * 60 /* 1 hour*/ );
+ }
-+ else // people don't want to be bothered, at least stop the timer; there's no way to save the dontshowagain entry in this case
-+ m_freeTimer->stop();
+}
+
- #include "medianotifier.moc"
-Index: kioslave/media/medianotifier/medianotifier.h
-===================================================================
---- kioslave/media/medianotifier/medianotifier.h (Revision 593834)
-+++ kioslave/media/medianotifier/medianotifier.h (Arbeitskopie)
-@@ -23,10 +23,13 @@
- #include
- #include
- #include
-+#include
-
- #include
- #include
-
-+class KDialogBase;
++void FreeSpaceNotifier::resetLastAvailable()
++{
++ lastAvail = -1;
++ lastAvailTimer->deleteLater();
++ lastAvailTimer = NULL;
++}
+
- class MediaNotifier: public KDEDModule
- {
- Q_OBJECT
-@@ -41,6 +44,10 @@
-
- private slots:
- void slotStatResult( KIO::Job *job );
-+ void checkFreeDiskSpace();
-+ void slotFreeFinished( KMessageBox::ButtonCode );
-+ void slotFreeContinue();
-+ void slotFreeCancel();
-
- private:
- bool autostart( const KFileItem &medium );
-@@ -52,6 +59,8 @@
- const QString &autoopenFile );
-
- QMapKIO::Job*,bool m_allowNotificationMap;
-+ QTimer * m_freeTimer;
-+ KDialogBase * m_freeDialog;
- };
- #endif
-
++#include "freespacenotifier.moc"
+--- kioslave/media/medianotifier/freespacenotifier.h.sav 2008-04-11 16:50:57.000000000 +0200
++++ kioslave/media/medianotifier/freespacenotifier.h 2008-04-11 19:25:27.000000000 +0200
+@@ -0,0 +1,51 @@
++/* This file is part of the KDE Project
++ Copyright (c) 2006 Lukas Tinkl
++ Copyright (c) 2008 Lubos Lunak
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program 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 General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program. If not, see http://www.gnu.org/licenses/.
++*/
++
++#ifndef _FREESPACENOTIFIER_H_
++#define _FREESPACENOTIFIER_H_
++
++#include
++
++#include
++
++class FreeSpaceWidget;
++
++class FreeSpaceNotifier
++: public QObject
++{
++ Q_OBJECT
++ public:
++ FreeSpaceNotifier( QObject* parent = NULL );
++ virtual ~FreeSpaceNotifier();
++ private slots:
++ void checkFreeDiskSpace();
++ void resetLastAvailable();
++ void slotYes();
++ void slotNo();
++ void slotCancel();
++ private:
++ void cleanupDialog( long newLimit );
++ QTimer timer;
++ QTimer* lastAvailTimer;
++ KDialogBase* dialog;
++ FreeSpaceWidget* widget;
++ long limit;
++ long lastAvail; // used to supress repeated warnings when available space hasn't changed
++};
++
++#endif
+--- kioslave/media/medianotifier/freespacewidget.ui.sav 2008-04-11 17:30:00.000000000 +0200
++++ kioslave/media/medianotifier/freespacewidget.ui 2008-04-11 18:03:03.000000000 +0200
+@@ -0,0 +1,118 @@
++<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
++<class>FreeSpaceWidget</class>
++<widget class="QWidget">
++ <property name="name">
++ <cstring>Form1</cstring>
++ </property>
++ <property name="geometry">
++ <rect>
++ <x>0</x>
++ <y>0</y>
++ <width>489</width>
++ <height>108</height>
++ </rect>
++ </property>
++ <property name="caption">
++ <string>Form1</string>
++ </property>
++ <vbox>
++ <property name="name">
++ <cstring>unnamed</cstring>
++ </property>
++ <widget class="QLabel">
++ <property name="name">
++ <cstring>warningLabel</cstring>
++ </property>
++ <property name="text">
++ <string></string>
++ </property>
++ </widget>
++ <widget class="QLabel">
++ <property name="name">
++ <cstring>textLabel2</cstring>
++ </property>
++ <property name="text">
++ <string>Would you like to run a file manager to free some disk space and fix the problem?</string>
++ </property>
++ </widget>
++ <spacer>
++ <property name="name">
++ <cstring>spacer3</cstring>
++ </property>
++ <property name="orientation">
++ <enum>Vertical</enum>
++ </property>
++ <property name="sizeType">
++ <enum>Expanding</enum>
++ </property>
++ <property name="sizeHint">
++ <size>
++ <width>20</width>
++ <height>40</height>
++ </size>
++ </property>
++ </spacer>
++ <widget class="QLayoutWidget">
++ <property name="name">
++ <cstring>layout3</cstring>
++ </property>
++ <hbox>
++ <property name="name">
++ <cstring>unnamed</cstring>
++ </property>
++ <widget class="QLabel">
++ <property name="name">
++ <cstring>textLabel3</cstring>
++ </property>
++ <property name="text">
++ <string>Warn again when the free space is below</string>
++ </property>
++ </widget>
++ <widget class="QSpinBox">
++ <property name="name">
++ <cstring>spinbox</cstring>
++ </property>
++ <property name="suffix">
++ <string> MiB</string>
++ </property>
++ </widget>
++ <spacer>
++ <property name="name">
++ <cstring>spacer1</cstring>
++ </property>
++ <property name="orientation">
++ <enum>Horizontal</enum>
++ </property>
++ <property name="sizeType">
++ <enum>Expanding</enum>
++ </property>
++ <property name="sizeHint">
++ <size>
++ <width>30</width>
++ <height>20</height>
++ </size>
++ </property>
++ </spacer>
++ </hbox>
++ </widget>
++ <spacer>
++ <property name="name">
++ <cstring>spacer2</cstring>
++ </property>
++ <property name="orientation">
++ <enum>Vertical</enum>
++ </property>
++ <property name="sizeType">
++ <enum>Expanding</enum>
++ </property>
++ <property name="sizeHint">
++ <size>
++ <width>20</width>
++ <height>16</height>
++ </size>
++ </property>
++ </spacer>
++ </vbox>
++</widget>
++<layoutdefaults spacing="6" margin="11"/>
++</UI>
++++++ select-wm-gui.diff ++++++
Subject: GUI configuration for selecting WM
From: Lubos Lunak
Feature: bnc#332079
Patch-upstream: no
--- ksmserver/server.h.sav 2008-04-14 15:53:56.000000000 +0200
+++ ksmserver/server.h 2008-04-14 16:50:05.000000000 +0200
@@ -30,6 +30,8 @@ Copyright (C) 2000 Matthias Ettrich & wmStartCommands );
+
public slots:
void cleanUp();
@@ -114,6 +118,7 @@ private slots:
void autoStart2();
void tryRestoreNext();
void startupSuspendTimeout();
+ void wmProcessChange();
private:
void handlePendingInteractions();
@@ -132,13 +137,14 @@ private:
void startProtection();
void endProtection();
- void startApplication( QStringList command,
+ KProcess* startApplication( QStringList command,
const QString& clientMachine = QString::null,
const QString& userId = QString::null );
void executeCommand( const QStringList& command );
bool isWM( const KSMClient* client ) const;
bool isWM( const QString& program ) const;
+ void selectWm( const QString& kdewm );
bool defaultSession() const; // empty session
void setupXIOErrorHandler();
@@ -211,6 +217,8 @@ private:
int lastAppStarted;
QString lastIdStarted;
+ QStringList wmCommands;
+ KProcess* wmProcess;
QStringList excludeApps;
WindowMap legacyWindows;
--- ksmserver/startup.cpp.sav 2008-04-14 15:53:56.000000000 +0200
+++ ksmserver/startup.cpp 2008-04-14 16:59:30.000000000 +0200
@@ -103,38 +103,28 @@ void KSMServer::restoreSession( QString
config->setGroup( sessionGroup );
int count = config->readNumEntry( "count" );
appsToStart = count;
-
- QValueList<QStringList> wmCommands;
- if ( !wm.isEmpty() ) {
- for ( int i = 1; i <= count; i++ ) {
- QString n = QString::number(i);
- if ( wm == config->readEntry( QString("program")+n ) ) {
- wmCommands << config->readListEntry( QString("restartCommand")+n );
- }
- }
- }
- if ( wmCommands.isEmpty() )
- wmCommands << ( QStringList() << wm );
-
publishProgress( appsToStart, true );
+ upAndRunning( "ksmserver" );
connectDCOPSignal( launcher, launcher, "autoStart0Done()",
"autoStart0Done()", true);
connectDCOPSignal( launcher, launcher, "autoStart1Done()",
"autoStart1Done()", true);
connectDCOPSignal( launcher, launcher, "autoStart2Done()",
"autoStart2Done()", true);
- upAndRunning( "ksmserver" );
- if ( !wmCommands.isEmpty() ) {
- // when we have a window manager, we start it first and give
- // it some time before launching other processes. Results in a
- // visually more appealing startup.
- for (uint i = 0; i < wmCommands.count(); i++)
- startApplication( wmCommands[i] );
- QTimer::singleShot( 4000, this, SLOT( autoStart0() ) );
- } else {
- autoStart0();
+ // find all commands to launch the wm in the session
+ QValueList<QStringList> wmStartCommands;
+ if ( !wm.isEmpty() ) {
+ for ( int i = 1; i <= count; i++ ) {
+ QString n = QString::number(i);
+ if ( wm == config->readEntry( QString("program")+n ) ) {
+ wmStartCommands << config->readListEntry( QString("restartCommand")+n );
+ }
+ }
}
+ if( wmStartCommands.isEmpty()) // otherwise use the configured default
+ wmStartCommands << wmCommands;
+ launchWM( wmStartCommands );
}
/*!
@@ -157,17 +147,54 @@ void KSMServer::startDefaultSession()
"autoStart1Done()", true);
connectDCOPSignal( launcher, launcher, "autoStart2Done()",
"autoStart2Done()", true);
- startApplication( wm );
+ launchWM( QValueList< QStringList >() << wmCommands );
+}
+
+void KSMServer::launchWM( const QValueList< QStringList >& wmStartCommands )
+{
+ assert( state == LaunchingWM );
+
+ // when we have a window manager, we start it first and give
+ // it some time before launching other processes. Results in a
+ // visually more appealing startup.
+ wmProcess = startApplication( wmStartCommands[ 0 ] );
+ connect( wmProcess, SIGNAL( error( QProcess::ProcessError )), SLOT( wmProcessChange()));
+ connect( wmProcess, SIGNAL( finished( int, QProcess::ExitStatus )), SLOT( wmProcessChange()));
+ // there can be possibly more wm's (because of forking for multihead),
+ // but in such case care only about the process of the first one
+ for (unsigned int i = 1; i < wmStartCommands.count(); i++)
+ startApplication( wmStartCommands[i] );
QTimer::singleShot( 4000, this, SLOT( autoStart0() ) );
}
void KSMServer::clientSetProgram( KSMClient* client )
{
- if ( !wm.isEmpty() && client->program() == wm )
+ if ( client->program() == wm )
autoStart0();
}
+void KSMServer::wmProcessChange()
+{
+ if( state != LaunchingWM )
+ { // don't care about the process when not in the wm-launching state anymore
+ wmProcess = NULL;
+ return;
+ }
+ if( !wmProcess->isRunning())
+ { // wm failed to launch for some reason, go with kwin instead
+ kdWarning( 1218 ) << "Window manager" << wm << "failed to launch";
+ if( wm == "kwin" )
+ return; // uhoh, kwin itself failed
+ kdDebug( 1218 ) << "Launching KWin";
+ wm = "kwin";
+ wmCommands = ( QStringList() << "kwin" );
+ // launch it
+ launchWM( QValueList< QStringList >() << wmCommands );
+ return;
+ }
+}
+
void KSMServer::autoStart0()
{
if( state != LaunchingWM )
--- ksmserver/windowmanagers/compiz-custom.desktop.sav 2008-04-14 16:37:19.000000000 +0200
+++ ksmserver/windowmanagers/compiz-custom.desktop 2008-04-14 16:37:19.000000000 +0200
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Name=Compiz custom (create wrapper script 'compiz-kde-launcher' to launch it)
+Exec=compiz-kde-launcher
+TryExec=compiz
+X-KDE-WindowManagerId=compiz
--- ksmserver/windowmanagers/compiz.desktop.sav 2008-04-14 16:37:19.000000000 +0200
+++ ksmserver/windowmanagers/compiz.desktop 2008-04-14 16:37:19.000000000 +0200
@@ -0,0 +1,4 @@
+[Desktop Entry]
+Name=Compiz
+Exec=compiz ccp
+TryExec=compiz
--- ksmserver/windowmanagers/metacity.desktop.sav 2008-04-14 16:37:19.000000000 +0200
+++ ksmserver/windowmanagers/metacity.desktop 2008-04-14 16:37:19.000000000 +0200
@@ -0,0 +1,4 @@
+[Desktop Entry]
+Name=Metacity (GNOME)
+Exec=metacity
+TryExec=metacity
--- ksmserver/windowmanagers/openbox.desktop.sav 2008-04-14 16:37:19.000000000 +0200
+++ ksmserver/windowmanagers/openbox.desktop 2008-04-14 16:37:19.000000000 +0200
@@ -0,0 +1,5 @@
+[Desktop Entry]
+Name=Openbox
+Exec=openbox
+TryExec=openbox
+
--- ksmserver/windowmanagers/kwin4.desktop.sav 2008-04-14 16:37:51.000000000 +0200
+++ ksmserver/windowmanagers/kwin4.desktop 2008-04-14 16:38:28.000000000 +0200
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=KWin (KDE4)
+Exec=kde4 /usr/bin/kwin
+TryExec=/usr/bin/kwin
+X-KDE-WindowManagerId=kwin
+
--- ksmserver/windowmanagers/Makefile.am.sav 2008-04-14 16:38:47.000000000 +0200
+++ ksmserver/windowmanagers/Makefile.am 2008-04-14 16:40:32.000000000 +0200
@@ -0,0 +1,2 @@
+windowmanager_DATA = compiz-custom.desktop compiz.desktop kwin4.desktop metacity.desktop openbox.desktop
+windowmanagerdir = $(kde_datadir)/ksmserver/windowmanagers
--- ksmserver/server.cpp.sav 2008-04-14 15:53:56.000000000 +0200
+++ ksmserver/server.cpp 2008-04-14 16:57:42.000000000 +0200
@@ -77,6 +77,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE
#include
#include
#include
+#include
+#include
#include "server.h"
#include "global.h"
@@ -98,11 +100,11 @@ KSMServer* KSMServer::self()
/*! Utility function to execute a command on the local machine. Used
* to restart applications.
*/
-void KSMServer::startApplication( QStringList command, const QString& clientMachine,
+KProcess* KSMServer::startApplication( QStringList command, const QString& clientMachine,
const QString& userId )
{
if ( command.isEmpty() )
- return;
+ return NULL;
if ( !userId.isEmpty()) {
struct passwd* pw = getpwuid( getuid());
if( pw != NULL && userId != QString::fromLocal8Bit( pw->pw_name )) {
@@ -116,12 +118,12 @@ void KSMServer::startApplication( QStrin
command.prepend( clientMachine );
command.prepend( xonCommand ); // "xon" by default
}
- int n = command.count();
- QCString app = command[0].latin1();
- QValueList<QCString> argList;
- for ( int i=1; i < n; i++)
- argList.append( QCString(command[i].latin1()));
- DCOPRef( launcher ).send( "exec_blind", app, DCOPArg( argList, "QValueList<QCString>" ) );
+ KProcess* process = new KProcess( this );
+ *process << command;
+ // make it auto-delete
+ connect( process, SIGNAL( processExited( KProcess* )), process, SLOT( deleteLater()));
+ process->start();
+ return process;
}
/*! Utility function to execute a command on the local machine. Used
@@ -580,10 +582,10 @@ extern "C" int _IceTransNoListen(const c
KSMServer::KSMServer( const QString& windowManager, bool _only_local )
: DCOPObject("ksmserver"), sessionGroup( "" )
+ , wmProcess( NULL )
{
the_server = this;
clean = false;
- wm = windowManager;
shutdownType = KApplication::ShutdownTypeNone;
@@ -595,6 +597,9 @@ KSMServer::KSMServer( const QString& win
config->setGroup("General" );
clientInteracting = 0;
xonCommand = config->readEntry( "xonCommand", "xon" );
+
+ KGlobal::dirs()->addResourceType( "windowmanagers", "share/apps/ksmserver/windowmanagers" );
+ selectWm( windowManager );
connect( &knotifyTimeoutTimer, SIGNAL( timeout()), SLOT( knotifyTimeout()));
connect( &startupSuspendTimeoutTimer, SIGNAL( timeout()), SLOT( startupSuspendTimeout()));
@@ -851,14 +856,12 @@ void KSMServer::storeSession()
config->setGroup( sessionGroup );
count = 0;
- if ( !wm.isEmpty() ) {
- // put the wm first
- for ( KSMClient* c = clients.first(); c; c = clients.next() )
- if ( c->program() == wm ) {
- clients.prepend( clients.take() );
- break;
- }
- }
+ // put the wm first
+ for ( KSMClient* c = clients.first(); c; c = clients.next() )
+ if ( c->program() == wm ) {
+ clients.prepend( clients.take() );
+ break;
+ }
for ( KSMClient* c = clients.first(); c; c = clients.next() ) {
int restartHint = c->restartStyleHint();
@@ -909,14 +912,65 @@ bool KSMServer::isWM( const KSMClient* c
bool KSMServer::isWM( const QString& program ) const
{
- // KWin relies on ksmserver's special treatment in phase1,
- // therefore make sure it's recognized even if ksmserver
- // was initially started with different WM, and kwin replaced
- // it later
- return program == wm || program == "kwin";
+ return program == wm;
}
bool KSMServer::defaultSession() const
{
return sessionGroup.isEmpty();
}
+
+static bool noDisplay( KDesktopFile& f )
+{
+ KConfigGroup gr( &f, "Desktop Entry" );
+ if (gr.readBoolEntry("NoDisplay", false)) {
+ return true;
+ }
+ if (gr.hasKey("OnlyShowIn")) {
+ if (!gr.readListEntry("OnlyShowIn", ';').contains("KDE"))
+ return true;
+ }
+ if (gr.hasKey("NotShowIn")) {
+ if (gr.readListEntry("NotShowIn", ';').contains("KDE"))
+ return true;
+ }
+ return false;
+}
+
+// selection logic:
+// - $KDEWM is set - use that
+// - a wm is selected using the kcm - use that
+// - if that fails, just use KWin
+void KSMServer::selectWm( const QString& kdewm )
+{
+ wm = "kwin"; // defaults
+ wmCommands = ( QStringList() << "kwin" );
+ if( !kdewm.isEmpty())
+ {
+ wmCommands = ( QStringList() << kdewm );
+ wm = kdewm;
+ return;
+ }
+ KConfigGroup config(KGlobal::config(), "General");
+ QString cfgwm = config.readEntry( "windowManager", "kwin" );
+ KDesktopFile file( cfgwm + ".desktop", true, "windowmanagers" );
+ if( noDisplay( file ))
+ return;
+ if( !file.tryExec())
+ return;
+ file.setDesktopGroup();
+ QString testexec = file.readEntry( "X-KDE-WindowManagerTestExec" );
+ if( !testexec.isEmpty())
+ {
+ int ret = system( QFile::encodeName( testexec ));
+ if( !WIFEXITED( ret ) || WEXITSTATUS( ret ) != 0 )
+ return;
+ }
+ QStringList cfgWmCommands = KShell::splitArgs( file.readEntry( "Exec" ));
+ if( cfgWmCommands.isEmpty())
+ return;
+ QString smname = file.readEntry( "X-KDE-WindowManagerId" );
+ // ok
+ wm = smname.isEmpty() ? cfgwm : smname;
+ wmCommands = cfgWmCommands;
+}
--- ksmserver/main.cpp.sav 2008-04-14 15:53:56.000000000 +0200
+++ ksmserver/main.cpp 2008-04-14 16:50:27.000000000 +0200
@@ -203,8 +203,6 @@ extern "C" KDE_EXPORT int kdemain( int a
}
QCString wm = args->getOption("windowmanager");
- if ( wm.isEmpty() )
- wm = "kwin";
bool only_local = args->isSet("local");
#ifndef HAVE__ICETRANSNOLISTEN
--- ksmserver/Makefile.am.sav 2007-01-26 15:31:18.000000000 +0100
+++ ksmserver/Makefile.am 2008-04-14 16:50:45.000000000 +0200
@@ -15,7 +15,7 @@
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-SUBDIRS = .
+SUBDIRS = . windowmanagers
INCLUDES= -I$(top_srcdir)/kdmlib $(all_includes)
--- kcontrol/smserver/kcmsmserver.cpp.sav 2008-04-14 15:53:40.000000000 +0200
+++ kcontrol/smserver/kcmsmserver.cpp 2008-04-14 16:30:34.000000000 +0200
@@ -22,6 +22,8 @@
#include
#include
#include
+#include
+#include
#include
@@ -29,6 +31,12 @@
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
+#include
#include "kcmsmserver.h"
#include "smserverconfigimpl.h"
@@ -52,6 +60,7 @@ SMServerConfig::SMServerConfig( QWidget
dialog->show();
topLayout->add(dialog);
+ KGlobal::dirs()->addResourceType( "windowmanagers", "share/apps/ksmserver/windowmanagers" );
load();
}
@@ -90,6 +99,7 @@ void SMServerConfig::load(bool useDefaul
dialog->logoutRadio->setChecked(true);
break;
}
+ loadWMs(c->readEntry("windowManager", "kwin"));
dialog->excludeLineedit->setText( c->readEntry("excludeApps"));
delete c;
@@ -116,6 +126,7 @@ void SMServerConfig::save()
dialog->rebootRadio->isChecked() ?
int(KApplication::ShutdownTypeReboot) :
int(KApplication::ShutdownTypeNone));
+ c->writeEntry("windowManager", currentWM());
c->writeEntry("excludeApps", dialog->excludeLineedit->text());
c->sync();
delete c;
@@ -123,6 +134,12 @@ void SMServerConfig::save()
// update the k menu if necessary
QByteArray data;
kapp->dcopClient()->send( "kicker", "kicker", "configure()", data );
+ if( oldwm != currentWM())
+ { // TODO switch it already in the session instead and tell ksmserver
+ KMessageBox::information( this,
+ i18n( "The new window manager will be used when KDE is started the next time." ),
+ i18n( "Window manager change" ), "windowmanagerchange" );
+ }
}
void SMServerConfig::defaults()
@@ -130,5 +147,72 @@ void SMServerConfig::defaults()
load( true );
}
+static bool noDisplay( KDesktopFile& f )
+{
+ KConfigGroup gr( &f, "Desktop Entry" );
+ if (gr.readBoolEntry("NoDisplay", false)) {
+ return true;
+ }
+ if (gr.hasKey("OnlyShowIn")) {
+ if (!gr.readListEntry("OnlyShowIn", ';').contains("KDE"))
+ return true;
+ }
+ if (gr.hasKey("NotShowIn")) {
+ if (gr.readListEntry("NotShowIn", ';').contains("KDE"))
+ return true;
+ }
+ return false;
+}
+
+void SMServerConfig::loadWMs( const QString& current )
+{
+ QString kwinname = i18n( "KWin (KDE default)" );
+ dialog->windowManagerCombo->insertItem( kwinname );
+ dialog->windowManagerCombo->setCurrentItem( 0 );
+ wms[ kwinname ] = "kwin";
+ oldwm = "kwin";
+ QStringList list = KGlobal::dirs()->findAllResources( "windowmanagers", QString(), false, true );
+ QRegExp reg( ".*/([^/\\.]*)\\.[^/\\.]*" );
+ for( QStringList::ConstIterator it = list.begin();
+ it != list.end();
+ ++it )
+ {
+ QString wmfile = *it;
+ KDesktopFile file( wmfile );
+ if( noDisplay( file ))
+ continue;
+ if( !file.tryExec())
+ continue;
+ file.setDesktopGroup();
+ QString testexec = file.readEntry( "X-KDE-WindowManagerTestExec" );
+ if( !testexec.isEmpty())
+ {
+ int ret = system( QFile::encodeName( testexec ));
+ if( !WIFEXITED( ret ) || WEXITSTATUS( ret ) != 0 )
+ continue;
+ }
+ QString name = file.readName();
+ if( name.isEmpty())
+ continue;
+ if( !reg.exactMatch( wmfile ))
+ continue;
+ QString wm = reg.cap( 1 );
+ if( wms.values().contains( wm ))
+ continue;
+ wms[ name ] = wm;
+ dialog->windowManagerCombo->insertItem( name );
+ if( wms[ name ] == current ) // make it selected
+ {
+ dialog->windowManagerCombo->setCurrentItem( dialog->windowManagerCombo->count() - 1 );
+ oldwm = wm;
+ }
+ }
+}
+
+QString SMServerConfig::currentWM() const
+{
+ return wms[ dialog->windowManagerCombo->currentText() ];
+}
+
#include "kcmsmserver.moc"
--- kcontrol/smserver/kcmsmserver.h.sav 2008-04-14 15:53:40.000000000 +0200
+++ kcontrol/smserver/kcmsmserver.h 2008-04-14 16:08:34.000000000 +0200
@@ -40,6 +40,10 @@ public:
private:
SMServerConfigImpl* dialog;
+ void loadWMs( const QString& current );
+ QString currentWM() const;
+ QMap< QString, QString > wms; // i18n text -> internal name
+ QString oldwm; // the original value
};
--- kcontrol/smserver/smserverconfigdlg.ui.sav 2008-04-14 15:53:40.000000000 +0200
+++ kcontrol/smserver/smserverconfigdlg.ui 2008-04-14 16:03:19.000000000 +0200
@@ -1,4 +1,4 @@
-<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>SMServerConfigDlg</class>
<widget class="QWidget">
<property name="name">
@@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>325</width>
- <height>366</height>
+ <width>334</width>
+ <height>476</height>
</rect>
</property>
<property name="caption">
@@ -148,6 +148,24 @@
</widget>
</vbox>
</widget>
+ <widget class="QGroupBox">
+ <property name="name">
+ <cstring>windowManagerGroup</cstring>
+ </property>
+ <property name="title">
+ <string>Window Manager</string>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QComboBox">
+ <property name="name">
+ <cstring>windowManagerCombo</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
<widget class="QButtonGroup">
<property name="name">
<cstring>advancedGroup</cstring>
@@ -236,6 +254,12 @@
<receiver>SMServerConfigDlg</receiver>
<slot>configChanged()</slot>
</connection>
+ <connection>
+ <sender>windowManagerCombo</sender>
+ <signal>activated(int)</signal>
+ <receiver>SMServerConfigDlg</receiver>
+ <slot>configChanged()</slot>
+ </connection>
</connections>
<includes>
<include location="global" impldecl="in implementation">kdialog.h</include>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org