"This patch adds the ability to adjust the priority of a jabber resource when going to an "away" state. This can be used to "redirect" messages to a different resource (e.g an IM client on a mobile device) base on the presence state of kopete."
See http://reviewboard.kde.org/r/4274/ Patch from Ralf Haferkamp, thanks! FEATURE: 97998 GUI: CCMAIL: rhafer at suse.de M +7 -1 jabberaccount.cpp M +56 -0 ui/dlgjabbereditaccountwidget.ui M +28 -0 ui/jabbereditaccountwidget.cpp M +1 -0 ui/jabbereditaccountwidget.h --- trunk/KDE/kdenetwork/kopete/protocols/jabber/jabberaccount.cpp #1145737:1145738 @@ -1069,7 +1069,13 @@ } // make sure the status gets the correct priority - newStatus.setPriority ( configGroup()->readEntry ( "Priority", 5 ) ); + int newPriority = configGroup()->readEntry ( "Priority", 5 ); + if ( newStatus.isAway() && configGroup()->hasKey( "AwayPriority" )) + { + newPriority = configGroup()->readEntry( "AwayPriority", 0 ); + } + newStatus.setPriority ( newPriority ); + kDebug(JABBER_DEBUG_GLOBAL) << "New priority: " << newPriority; XMPP::Jid jid ( myself()->contactId () ); XMPP::Resource newResource ( resource (), newStatus ); --- trunk/KDE/kdenetwork/kopete/protocols/jabber/ui/dlgjabbereditaccountwidget.ui #1145737:1145738 @@ -467,6 +467,8 @@ <property name="title" > <string>Location Settings</string> </property> + <layout class="QVBoxLayout" name="verticalLayout_5"> + <item> <layout class="QHBoxLayout" > <property name="spacing" > <number>6</number> @@ -587,9 +589,63 @@ </widget> </item> </layout> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <property name="spacing"> + <number>6</number> + </property> + <property name="margin" > + <number>9</number> + </property> + <item> + <widget class="QCheckBox" name="cbAdjustPriority"> + <property name="text"> + <string>When absent, adjust priority to:</string> + </property> </widget> </item> <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QSpinBox" name="mAwayPriority"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="minimum"> + <number>-127</number> + </property> + <property name="maximum"> + <number>128</number> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> <widget class="QCheckBox" name="mergeMessages"> <property name="text"> <string>Merge all messages from all resources to one window/tab</string> --- trunk/KDE/kdenetwork/kopete/protocols/jabber/ui/jabbereditaccountwidget.cpp #1145737:1145738 @@ -68,6 +68,8 @@ connect (privacyListsButton, SIGNAL ( clicked() ), this, SLOT ( slotPrivacyListsClicked() ) ); + connect (cbAdjustPriority, SIGNAL (toggled (bool)), this, SLOT ( awayPriorityToggled (bool))); + #ifdef JINGLE_SUPPORT checkAudioDevices(); #else @@ -197,6 +199,17 @@ mServer->setText(mID->text().section('@', 1)); } + if ( account()->configGroup()->hasKey("AwayPriority") ) + { + cbAdjustPriority->setChecked(true); + mAwayPriority->setValue( account()->configGroup()->readEntry("AwayPriority",0)); + } + else + { + cbAdjustPriority->setChecked(false); + mAwayPriority->setEnabled(false); + } + cbAllowPlainTextPassword->setChecked (account()->configGroup()->readEntry("AllowPlainTextPassword", true)); KConfigGroup config = KGlobal::config()->group("Jabber"); @@ -288,6 +301,16 @@ account()->configGroup()->writeEntry("Server", mServer->text().trimmed ()); account()->configGroup()->writeEntry("Resource", mResource->text ()); account()->configGroup()->writeEntry("Priority", QString::number (mPriority->value ())); + + if ( cbAdjustPriority->isChecked() ) + { + account()->configGroup()->writeEntry("AwayPriority", QString::number( mAwayPriority->value ())); + } + else + { + account()->configGroup()->deleteEntry("AwayPriority"); + } + account()->configGroup()->writeEntry("Port", QString::number (mPort->value ())); #ifdef JINGLE_SUPPORT @@ -373,6 +396,11 @@ } +void JabberEditAccountWidget::awayPriorityToggled(bool enabled) +{ + mAwayPriority->setEnabled(enabled); +} + void JabberEditAccountWidget::deleteClicked () { --- trunk/KDE/kdenetwork/kopete/protocols/jabber/ui/jabbereditaccountwidget.h #1145737:1145738 @@ -52,6 +52,7 @@ void slotChangePasswordFinished (); void deleteClicked (); void sslToggled (bool); + void awayPriorityToggled (bool); void updateServerField (); void slotPrivacyListsClicked ();
