LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File kmix-autostart.diff of Package kdemultimedia3 (Project KDE:KDE3)

Index: kmix/kmixprefdlg.h
===================================================================
--- kmix/kmixprefdlg.h.orig
+++ kmix/kmixprefdlg.h
@@ -57,6 +57,7 @@ KMixPrefDlg : public KDialogBase
    QCheckBox *m_showTicks;
    QCheckBox *m_showLabels;
    QCheckBox *m_onLogin;
+   QCheckBox *m_disableAutoStart;
    QRadioButton *_rbVertical;
    QRadioButton *_rbHorizontal;
    QRadioButton *_rbNone;
Index: kmix/kmix.cpp
===================================================================
--- kmix/kmix.cpp.orig
+++ kmix/kmix.cpp
@@ -29,6 +29,7 @@
 #include <qtooltip.h>
 
 // include files for KDE
+#include <kcmdlineargs.h>
 #include <kcombobox.h>
 #include <kiconloader.h>
 #include <kmessagebox.h>
@@ -81,6 +82,9 @@ KMixWindow::KMixWindow()
 	initPrefDlg();
 	updateDocking();
 
+	if (KCmdLineArgs::parsedArgs()->isSet("autostart") && ! Mixer::mixers().first())
+		QTimer::singleShot(0, kapp, SLOT(quit()));
+
 	if ( m_startVisible )
 	{
 		 /* Started visible: We should do probably do:
@@ -249,6 +253,7 @@ KMixWindow::saveConfig()
    config->writeEntry( "Tickmarks", m_showTicks );
    config->writeEntry( "Labels", m_showLabels );
    config->writeEntry( "startkdeRestore", m_onLogin );
+   config->writeEntry( "AutoStart", m_autoStart);
    Mixer* mixerMasterCard = Mixer::masterCard();
    if ( mixerMasterCard != 0 ) {
       config->writeEntry( "MasterMixer", mixerMasterCard->id() );
@@ -299,6 +304,7 @@ KMixWindow::loadConfig()
    const QString& valueStyleString = config->readEntry("ValueStyle", "None");
    m_onLogin = config->readBoolEntry("startkdeRestore", true );
    m_startVisible = config->readBoolEntry("Visible", true);
+   m_autoStart = config->readBoolEntry("AutoStart", true);
    m_multiDriverMode = config->readBoolEntry("MultiDriver", false);
    m_surroundView    = config->readBoolEntry("Experimental-ViewSurround", false );
    m_gridView    = config->readBoolEntry("Experimental-ViewGrid", false );
@@ -428,6 +434,7 @@ KMixWindow::showSettings()
       m_prefDlg->m_showTicks->setChecked( m_showTicks );
       m_prefDlg->m_showLabels->setChecked( m_showLabels );
       m_prefDlg->m_onLogin->setChecked( m_onLogin );
+      m_prefDlg->m_disableAutoStart->setChecked( !m_autoStart);
       m_prefDlg->_rbVertical  ->setChecked( m_toplevelOrientation == Qt::Vertical );
       m_prefDlg->_rbHorizontal->setChecked( m_toplevelOrientation == Qt::Horizontal );
       m_prefDlg->_rbNone->setChecked( m_valueStyle == MixDeviceWidget::NNONE );
@@ -497,6 +504,7 @@ KMixWindow::applyPrefs( KMixPrefDlg *pre
    m_showTicks = prefDlg->m_showTicks->isChecked();
    m_showLabels = prefDlg->m_showLabels->isChecked();
    m_onLogin = prefDlg->m_onLogin->isChecked();
+   m_autoStart = !prefDlg->m_disableAutoStart->isChecked();
 
    if ( prefDlg->_rbNone->isChecked() ) {
      m_valueStyle = MixDeviceWidget::NNONE;
Index: kmix/KMixApp.cpp
===================================================================
--- kmix/KMixApp.cpp.orig
+++ kmix/KMixApp.cpp
@@ -23,6 +23,7 @@
 #include "KMixApp.h"
 #include "kmix.h"
 #include <kdebug.h>
+#include <kcmdlineargs.h>
 
 
 KMixApp::KMixApp()
@@ -40,9 +41,19 @@ KMixApp::~KMixApp()
 int
 KMixApp::newInstance()
 {
+	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+
+	if (args->isSet("autostart"))
+	{
+		kapp->disableSessionManagement();
+
+		if ( m_kmix )
+			return 0;
+	}
+
 	if ( m_kmix )
 	{
-		m_kmix->show();
+			m_kmix->show();
 	}
 	else
 	{
@@ -69,3 +80,4 @@ KMixApp::quitExtended()
 }
 
 #include "KMixApp.moc"
+// vim: sw=8:noet:
Index: kmix/kmix.h
===================================================================
--- kmix/kmix.h.orig
+++ kmix/kmix.h
@@ -99,6 +99,7 @@ KMixWindow : public KMainWindow
    bool m_showDockWidget;
    bool m_volumeWidget;
    bool m_hideOnClose;
+   bool m_autoStart;
    bool m_showTicks;
    bool m_showLabels;
    MixDeviceWidget::ValueStyle m_valueStyle;             // No numbers by default
Index: kmix/main.cpp
===================================================================
--- kmix/main.cpp.orig
+++ kmix/main.cpp
@@ -33,8 +33,8 @@ I18N_NOOP("KMix - KDE's full featured mi
 
 static KCmdLineOptions options[] =
 {
+   { "autostart", "", 0 },
    KCmdLineLastOption
-   // INSERT YOUR COMMANDLINE OPTIONS HERE
 };
 
 extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
Index: kmix/kmixprefdlg.cpp
===================================================================
--- kmix/kmixprefdlg.cpp.orig
+++ kmix/kmixprefdlg.cpp
@@ -68,6 +68,10 @@ KMixPrefDlg::KMixPrefDlg( QWidget *paren
    m_onLogin = new QCheckBox( i18n("Restore volumes on login"), m_generalTab );
    layout->addWidget( m_onLogin );
 
+   m_disableAutoStart = new QCheckBox(
+           i18n("Disable automatic startup on login"), m_generalTab);
+   layout->addWidget(m_disableAutoStart);
+
    QBoxLayout *numbersLayout = new QHBoxLayout( layout );
    QButtonGroup *numbersGroup = new QButtonGroup( 3, Qt::Horizontal, i18n("Numbers"), m_generalTab );
    numbersGroup->setRadioButtonExclusive(true);