File 1_1_BRANCH.diff of Package konversation

--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,23 @@
+Changes since 1.1:
+* Enabled the (experimental, hackish) Amarok 2 support in the 'media' script.
+* Fixed a bug that could cause channel notifications to be lost across recon-
+  nects.
+* Removed the code to recreate hidden-to-tray state across application re-
+  starts. It was broken after the shutdown procedures were moved to a point
+  in time after after the main window is hidden to cover quit-by-DCOP, and
+  Konversation 1.1 features an explicit hidden startup option that fulfills
+  user demands more accurately anyhow. This fixes a bug that made Konversa-
+  tion always hide to tray on startup regardless of the aforementioned op-
+  tion when the system tray icon was enabled.
+* Added a network settings lookup fallback to retrieving the key of a channel.
+  Previously, this relied solely on the channel's mode map. Closes the brief
+  gap between a channel join and the server's reply to MODE where possible,
+  so that e.g. reconnecting directly after auto-joining a channel with a key
+  doesn't result in a failed rejoin due to not having the key by way of the
+  MODE reply yet.
+* Fixed opening URLs from the channel topic context menu in Channel List tabs.
+
+
 Changes from 1.0.1 to 1.1:
 We are extremely pleased to announce Konversation's newest major release, v1.1.
 Konversation 1.1 is a special release for us in multiple ways: It's our farewell
--- konversation/scripts/media
+++ konversation/scripts/media
@@ -44,7 +44,7 @@
 ## If you add a new player, you must add it here or it won't get checked when in audio-only or video-only modes.
 playerRankings= {
     'video' :['kaffeine','kmplayer', 'kplayer', 'noatun', 'kdetv'],
-    'audio' :['amarok', 'MPD' 'juk', 'noatun', 'kscd', 'kaffeine', 'kmplayer', 'Audacious', 'xmms', 'yammi']
+    'audio' :['amarok', 'juk', 'noatun', 'kscd', 'kaffeine', 'kmplayer', 'amarok2', 'yammi', 'Audacious', 'xmms', 'MPD']
 }
 
 ## Title, album and artist fields to be quoted depending on contents
@@ -244,36 +244,36 @@
                 return ''
         return data
 
-#class Amarok2Player(Player):
-#    def __init__(self):
-#        Player.__init__(self, 'Amarok2', 'audio')
-#        self.isRunning()
-#
-#    def getData(self):
-#        playing=os.popen("qdbus org.mpris.amarok /Player PositionGet").readline().strip() != "0"
-#        if playing and self.isRunning():
-#            for line in os.popen("qdbus org.mpris.amarok /Player GetMetadata").readlines():
-#                if re.match("^title", line):
-#                    title=self.reEncodeString(line.strip().split(None,1)[1])
-#                if re.match("^artist", line):
-#                    artist=self.reEncodeString(line.strip().split(None,1)[1])
-#                if re.match("^album", line):
-#                    album=self.reEncodeString(line.strip().split(None,1)[1])
-#            return (title, artist, album)
-#        else:
-#            return ''
-#
-#    def isRunning(self):
-#        qdbus_items=subprocess.Popen(['qdbus'], stdout=subprocess.PIPE).communicate()[0]
-#        running=re.findall('^ org.mpris.amarok$', qdbus_items, re.M)
-#        if type(running) is list:
-#            try:
-#                running=running[0]
-#            except IndexError:
-#                running=''
-#        self.running=bool(running.strip())
-#        return self.running
+class Amarok2Player(Player):
+    def __init__(self):
+        Player.__init__(self, 'Amarok2', 'audio')
+        self.isRunning()
 
+    def getData(self):
+        playing=os.popen("qdbus org.mpris.amarok /Player PositionGet").readline().strip() != "0"
+        if playing and self.isRunning():
+            for line in os.popen("qdbus org.mpris.amarok /Player GetMetadata").readlines():
+                if re.match("^title", line):
+                    title=self.reEncodeString(line.strip().split(None,1)[1])
+                if re.match("^artist", line):
+                    artist=self.reEncodeString(line.strip().split(None,1)[1])
+                if re.match("^album", line):
+                    album=self.reEncodeString(line.strip().split(None,1)[1])
+            return (title, artist, album)
+        else:
+            return ''
+
+    def isRunning(self):
+        qdbus_items=subprocess.Popen(['qdbus'], stdout=subprocess.PIPE).communicate()[0]
+        running=re.findall('^ org.mpris.amarok$', qdbus_items, re.M)
+        if type(running) is list:
+            try:
+                running=running[0]
+            except IndexError:
+                running=''
+        self.running=bool(running.strip())
+        return self.running
+
 import socket
 
 class MPD(Player):
@@ -439,8 +439,9 @@
 StupidPlayer("KPlayer","kplayer","kplayer-mainwindow#1 caption",playerType="video audio"),
 DCOPPlayer("KsCD","kscd","CDPlayer currentTrackTitle","CDPlayer currentArtist","CDPlayer currentAlbum"),
 DCOPPlayer("kdetv","kdetv","KdetvIface channelName",playerType='video'),
+Amarok2Player(),
+DCOPPlayer("Yammi","yammi","YammiPlayer songTitle","YammiPlayer songArtist","YammiPlayer songAlbum"),
 AudaciousPlayer('Audacious'), XmmsPlayer('XMMS'),
-DCOPPlayer("Yammi","yammi","YammiPlayer songTitle","YammiPlayer songArtist","YammiPlayer songAlbum"),
 MPD('MPD')
 ]
 
--- konversation/src/channellistpanel.h
+++ konversation/src/channellistpanel.h
@@ -73,6 +73,7 @@
         void regExpClicked();
 
         void contextMenu (KListView* l, QListViewItem* i, const QPoint& p);
+        void openURL();
 
         //Used to disable functions when not connected
         virtual void serverOnline(bool online);
--- konversation/src/version.h
+++ konversation/src/version.h
@@ -1,3 +1,3 @@
 #ifndef KONVI_VERSION
-#define KONVI_VERSION "1.1"
+#define KONVI_VERSION "1.1+"
 #endif
--- konversation/src/konversationapplication.cpp
+++ konversation/src/konversationapplication.cpp
@@ -139,7 +139,7 @@
         // apply GUI settings
         emit appearanceChanged();
 
-        if (Preferences::showTrayIcon() && (Preferences::hiddenToTray() || Preferences::hideToTrayOnStartup()))
+        if (Preferences::showTrayIcon() && Preferences::hideToTrayOnStartup())
             mainWindow->hide();
         else
             mainWindow->show();
@@ -212,11 +212,6 @@
 
 void KonversationApplication::prepareShutdown()
 {
-    if (mainWindow->isHidden() && Preferences::showTrayIcon())
-        Preferences::setHiddenToTray(true);
-    else
-        Preferences::setHiddenToTray(false);
-
     mainWindow->getViewContainer()->prepareShutdown();
 
     m_awayManager->blockSignals(true);
--- konversation/src/channellistpanel.cpp
+++ konversation/src/channellistpanel.cpp
@@ -18,6 +18,7 @@
 #include "server.h"
 #include "common.h"
 
+#include <qaction.h>
 #include <qhbox.h>
 #include <qvbox.h>
 #include <qgrid.h>
@@ -544,7 +545,10 @@
             pos+=url.length();
 
             // tell the program that we have found a new url
-            showURLmenu->insertItem(href);
+            QAction* action = new QAction(showURLmenu);
+            action->setText(href);
+            action->addTo(showURLmenu);
+            connect(action, SIGNAL(activated()), this, SLOT(openURL()));
         }
         else
         {
@@ -558,16 +562,19 @@
         showURLmenu->setItemEnabled(5,false);
     }
 
-    int selected = showURLmenu->exec(p);
-    if (selected!=-1)
-    {
-        QMenuItem* item = showURLmenu->findItem( selected );
-        new KRun(KURL(item->text().replace("&&","&")));
-    }
+    showURLmenu->exec(p);
 
     delete showURLmenu;
 }
 
+void ChannelListPanel::openURL()
+{
+    const QAction* action = static_cast<const QAction*>(sender());
+
+    if (action)
+        new KRun(KURL(action->text().replace("&&","&")));
+}
+
 void ChannelListPanel::appendInputText(const QString& text, bool fromCursor)
 {
     Q_UNUSED(fromCursor);
--- konversation/src/config/konversation.kcfg
+++ konversation/src/config/konversation.kcfg
@@ -270,10 +270,6 @@
       <label></label>
       <whatsthis></whatsthis>
     </entry>
-    <entry key="HiddenToTray" type="Bool">
-      <default>false</default>
-      <label>Hidden to system tray</label>
-    </entry>
     <entry key="HideToTrayOnStartup" type="Bool">
       <default>false</default>
       <label>Start with hidden mainwindow</label>
--- konversation/src/commit.h
+++ konversation/src/commit.h
@@ -1,4 +1,4 @@
 // This COMMIT number is added to version string to be used as "patch level"
 #ifndef COMMIT
-#define COMMIT 3300
+#define COMMIT 3302
 #endif
--- konversation/src/main.cpp
+++ konversation/src/main.cpp
@@ -24,6 +24,9 @@
 #include "version.h"
 #include "commit.h"
 
+#define HACKSTR(x) #x
+#define STRHACK(x) HACKSTR(x)
+
 /*
   Don't use i18n() here, use I18N_NOOP() instead!
   i18n() will only work as soon as a kapplication object was made.
@@ -47,7 +50,7 @@
 {
     KAboutData aboutData("konversation",
         I18N_NOOP("Konversation"),
-        KONVI_VERSION,
+        KONVI_VERSION " #" STRHACK(COMMIT),
         shortDescription,
         KAboutData::License_GPL,
         I18N_NOOP("(C) 2002-2008 by the Konversation team"),
--- konversation/src/inputfilter.cpp
+++ konversation/src/inputfilter.cpp
@@ -243,8 +243,10 @@
                     else
                     {
                         // Do not internationalize the below version string
-                        reply = QString("Konversation %1 (C) 2002-2008 by the Konversation team")
-                            .arg(QString(KONVI_VERSION));
+                        reply = QString("Konversation %1 Build %2 (C) 2002-2008 by the Konversation team")
+                            .arg(QString(KONVI_VERSION))
+                            .arg(QString::number(COMMIT));
+
                     }
                     server->ctcpReply(sourceNick,"VERSION "+reply);
                 }
--- konversation/src/channel.cpp
+++ konversation/src/channel.cpp
@@ -974,6 +974,16 @@
         if ((*it)[0] == 'k') password = (*it).mid(1);
     }
 
+    if (password.isEmpty() && m_server->getServerGroup())
+    {
+        Konversation::ChannelList channelList = m_server->getServerGroup()->channelList();
+        Konversation::ChannelSettings channelSettings(getName());
+        QValueListIterator<Konversation::ChannelSettings> it = channelList.find(channelSettings);
+
+        if (it != channelList.end())
+            password = (*it).password();
+    }
+
     return password;
 }
 
@@ -1273,7 +1283,7 @@
         setActive(true);
 
         //HACK the way the notification priorities work sucks, this forces the tab text color to ungray right now.
-        if (m_currentTabNotify == Konversation::tnfNone || !Preferences::tabNotificationsEvents())
+        if (m_currentTabNotify == Konversation::tnfNone || (!Preferences::tabNotificationsEvents() && m_currentTabNotify == Konversation::tnfControl))
             KonversationApplication::instance()->getMainWindow()->getViewContainer()->unsetViewNotification(this);
 
         KonversationApplication::instance()->notificationHandler()->channelJoin(this,getName());
openSUSE Build Service is sponsored by