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

List:       kopete-devel
Subject:    [kopete-devel] KDE/kdenetwork/kopete
From:       Dennis Nienhüser <earthwings () gentoo ! org>
Date:       2008-08-23 16:35:50
Message-ID: 1219509350.283306.16080.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 851433 by nienhueser:

Extend the auto connect at startup option to a global initial account status setting.
Patch by Cyrill Helg, thanks!
CCMAIL: kopete-devel@kde.org


 M  +51 -26    kopete/config/behavior/behaviorconfig_general.ui  
 M  +15 -3     kopete/kopeteapplication.cpp  
 M  +9 -2      libkopete/kopeteaccountmanager.cpp  
 M  +10 -3     libkopete/kopetebehaviorsettings.kcfg  
 M  +26 -0     libkopete/kopeteonlinestatusmanager.cpp  
 M  +7 -0      libkopete/kopeteonlinestatusmanager.h  


--- trunk/KDE/kdenetwork/kopete/kopete/config/behavior/behaviorconfig_general.ui \
#851432:851433 @@ -134,33 +134,57 @@
     </widget>
    </item>
    <item>
-    <widget class="QGroupBox" name="groupBox_3" >
-     <property name="title" >
-      <string>Miscellaneous</string>
-     </property>
-     <layout class="QVBoxLayout" >
-      <property name="spacing" >
-       <number>6</number>
-      </property>
-      <property name="margin" >
-       <number>9</number>
-      </property>
-      <item>
-       <widget class="QCheckBox" name="kcfg_autoConnect" >
-        <property name="toolTip" >
-         <string>Connect on startup and when a network is available</string>
-        </property>
-        <property name="whatsThis" >
-         <string>When starting Kopete, and whenever your computer is online, all \
your accounts will be connected automatically. You can exclude accounts individually \
                in their properties.</string>
-        </property>
-        <property name="text" >
-         <string>Connect automatically</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
-    </widget>
+	  <widget class="QGroupBox" name="initialStatusGroup" >
+	  <property name="title" >
+		  <string>Initial status</string>
+	  </property>
+	  <layout class="QVBoxLayout" >
+		<property name="spacing" >
+		  <number>6</number>
+		</property>
+		<property name="margin" >
+		  <number>9</number>
+		</property>
+		<item>
+		  <widget class="QComboBox" name="kcfg_initialStatus" >
+			<property name="toolTip" >
+			  <string>Set the initial status</string>
+			</property>
+			<property name="whatsThis" >
+			  <string>When starting Kopete, and whenever your computer is online, all your \
accounts will go into the status selected here. You can exclude accounts individually \
in their properties.</string> +			</property>
+			<item>
+			  <property name="text" >
+				<string>Offline</string>
+			  </property>
+			</item>
+			<item>
+			  <property name="text" >
+				<string>Online</string>
+			  </property>
+			</item>
+			<item>
+			  <property name="text" >
+				<string>Away</string>
+			  </property>
+			</item>
+			<item>
+			  <property name="text" >
+				<string>Busy</string>
+			  </property>
+			  </item>
+			<item>
+			<property name="text" >
+			  <string>Invisible</string>
+			</property>
+		  </item>
+		 </widget>
+		</item>
+	  </layout>
+	</widget>
    </item>
+
+
    <item>
     <spacer>
      <property name="orientation" >
@@ -186,6 +210,7 @@
   <tabstop>kcfg_startDocked</tabstop>
   <tabstop>kcfg_useMessageQueue</tabstop>
   <tabstop>kcfg_autoConnect</tabstop>
+  <tabstop>kcfg_initialStatus</tabstop>
  </tabstops>
  <resources/>
  <connections/>
--- trunk/KDE/kdenetwork/kopete/kopete/kopeteapplication.cpp #851432:851433
@@ -210,17 +210,26 @@
 	}
 }
 
+
 void KopeteApplication::slotAllPluginsLoaded()
 {
 	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
 	//FIXME: this should probably ask for the identities to connect instead of all \
accounts  // --noconnect not specified?
-	if ( args->isSet( "connect" )  && Kopete::BehaviorSettings::self()->autoConnect() \
&& +
+	Kopete::OnlineStatusManager::Category initStatus = \
Kopete::OnlineStatusManager::self()->initialStatus(); +
+	if ( args->isSet( "connect" )  &&  initStatus != \
Kopete::OnlineStatusManager::Offline &&  ( Solid::Networking::status() == \
                Solid::Networking::Unknown ||
-			  Solid::Networking::status() == Solid::Networking::Connected ) )
-		Kopete::AccountManager::self()->setOnlineStatus( \
Kopete::OnlineStatusManager::Online, QString(), \
Kopete::AccountManager::ConnectIfOffline ); +			  Solid::Networking::status() == \
Solid::Networking::Connected ) ){  
+		Kopete::AccountManager::self()->setOnlineStatus( initStatus, QString(), \
Kopete::AccountManager::ConnectIfOffline ); +
+	 }
+
+ 	kDebug(14000)<< "initial status set in config: " << initStatus;
+
 	QStringList connectArgs = args->getOptionList( "autoconnect" );
 
 	// toConnect will contain all the protocols to connect to
@@ -267,6 +276,8 @@
 	handleURLArgs();
 }
 
+
+
 int KopeteApplication::newInstance()
 {
 //	kDebug(14000) ;
@@ -293,6 +304,7 @@
 	} // END args->count() > 0
 }
 
+
 void KopeteApplication::quitKopete()
 {
 	kDebug( 14000 ) ;
--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteaccountmanager.cpp #851432:851433
@@ -43,6 +43,7 @@
 #include "kopetegroup.h"
 #include "kopetestatusmanager.h"
 
+
 namespace Kopete {
 
 static int compareAccountsByPriority( Account *a, Account *b )
@@ -420,10 +421,16 @@
 
 void AccountManager::networkConnected()
 {
-	if ( Kopete::BehaviorSettings::self()->autoConnect() )
-		setOnlineStatus( Kopete::OnlineStatusManager::Online, QString(), ConnectIfOffline \
); +	Kopete::OnlineStatusManager::Category initStatus = \
Kopete::OnlineStatusManager::self()->initialStatus(); +	//we check for network \
availability here too +	if ( Solid::Networking::status() == \
Solid::Networking::Unknown || +			  Solid::Networking::status() == \
Solid::Networking::Connected ){ +
+		Kopete::AccountManager::self()->setOnlineStatus( initStatus, QString(), \
Kopete::AccountManager::ConnectIfOffline ); +	}
 }
 
+
 void AccountManager::networkDisconnected()
 {
 	setOnlineStatus( Kopete::OnlineStatusManager::Offline );
--- trunk/KDE/kdenetwork/kopete/libkopete/kopetebehaviorsettings.kcfg #851432:851433
@@ -36,9 +36,16 @@
 			<label>Reconnect on disconnect.</label>
 			<default>true</default>
 		</entry>
-		<entry key="autoConnect" type="Bool">
-			<label>Auto connect on Kopete load.</label>
-			<default>false</default>
+		<entry key="initialStatus" type="Enum">
+			<label>Initial Status</label>
+			<choices>
+				<choice name="Offline" />
+				<choice name="Online" />
+				<choice name="Away" />
+				<choice name="Busy" />
+				<choice name="Invisible" />
+			</choices>
+			<default>Offline</default>
 		</entry>
 		<!-- Event Behavior -->
 		<entry key="raiseMessageWindow" type="Bool">
--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteonlinestatusmanager.cpp \
#851432:851433 @@ -19,6 +19,7 @@
 #include "kopeteonlinestatusmanager.h"
 
 #include "kopeteprotocol.h"
+#include "kopetebehaviorsettings.h"
 
 #include <kiconloader.h>
 #include <kiconeffect.h>
@@ -126,6 +127,31 @@
 	return OnlineStatus();
 }
 
+OnlineStatusManager::Category OnlineStatusManager::initialStatus() const
+{
+    Kopete::OnlineStatusManager::Category statusValue;
+		switch( Kopete::BehaviorSettings::self()->initialStatus() )
+		{
+		  case Kopete::BehaviorSettings::EnumInitialStatus::Offline:
+			statusValue = Kopete::OnlineStatusManager::Offline;
+		  break;
+		  case Kopete::BehaviorSettings::EnumInitialStatus::Online:
+			statusValue = Kopete::OnlineStatusManager::Online;
+		  break;
+		  case Kopete::BehaviorSettings::EnumInitialStatus::Away:
+			statusValue = Kopete::OnlineStatusManager::Away;
+		  break;
+		  case Kopete::BehaviorSettings::EnumInitialStatus::Busy:
+			statusValue = Kopete::OnlineStatusManager::Busy;
+		  break;
+		  case Kopete::BehaviorSettings::EnumInitialStatus::Invisible:
+			statusValue = Kopete::OnlineStatusManager::Invisible;
+		  break;
+		}
+
+    return statusValue;
+}
+
 QString OnlineStatusManager::fingerprint( const OnlineStatus &statusFor, const \
QString& icon, int size, QColor color, bool idle)  {
 	// create a 'fingerprint' to use as a hash key
--- trunk/KDE/kdenetwork/kopete/libkopete/kopeteonlinestatusmanager.h #851432:851433
@@ -120,6 +120,13 @@
 	 */
 	static KIcon pixmapForCategory( Categories category );
 
+	/**
+	 * This returns status from config as Kopete::OnlineStatusManager::Category
+	 *
+	 * @return the desired initial status
+	 */
+	Kopete::OnlineStatusManager::Category initialStatus() const;
+
 private:
 	friend class OnlineStatus;
 	friend class OnlineStatusIconEngine;
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


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

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