Em Wednesday 08 July 2009, Olivier Goffart escreveu:
> Le Wednesday 08 July 2009, Lamarque Vieira Souza a écrit :
> >     I have changed it to i18n( "%1 new message%2 in your Hotmail inbox.",
> > unread_inbox, unread_inbox > 1 ? "s": ""), it is shorter this way. Is it
> > ok to use this kind of code to add the plural to "messages" or it can
> > cause problems to the translation team?
>
> Use i18np here.
> Different languages has different way to express plural.

        Ok.

> >     I am trying to figure out how to open hotmail inbox. I have looked at
> > the Kopete 3.5 msn plugin source code and what it does is just call
> > sendCommand("URL", "INBOX" ), where sendCommand just write a formated
> > string to the socket, is that simple?
>
> when we send URL INBOX to the server, we received back a URL command with
> the actual URL.  When receiving the reply, we open the browser with the
> given URL (it was in handleCommand or something)

        I will take a look at that.

> >     I would like to see this code in KDE 4.3.1. I am not familiar with KDE
> > feature freeze details, but since this code fix a regression from Kopete
> > 3.5.x I think it is better add this code to 4.3.1. By the way, I already
> > have write access to KDE's svn repository.
>
> Depends on how the patch looks like, but this looks more like a KDE 4.4
> feature.

        I have attached the last patch version. I am using KDE 4.2.4 to develop 
it, 
when I finish the changes I am going to port it to trunk. The patch adds three 
new strings: the two notifications strings and "Open inbox..." string at WLM 
plugin's context menu. When I finish the opening inbox implementation I will 
have to add a button to open the inbox at the notification window(s), so 
probably there will be one or two more strings changes.

        I think this feature is very important, there is at least one person 
(https://bugs.kde.org/show_bug.cgi?id=163225) that stopped using Kopete 
because this feature was removed in KDE 4.x, probably there are more people 
who did the same. I myself started using aMSN to have webcam chat feature, 
which is the next feature I plan to implement in Kopete when I finish the 
opening inbox feature. I use aMSN but I strongly disliske tcl/tk :-/ My point 
is that Kopete should keep essencial features like mail notification and 
webcam chat, without those features people will stop using Kopete. I wrote 
"keep" because those features exist in Kopete 3.5.x.

-- 
Lamarque V. Souza
http://www.geographicguide.com/brazil.htm
Linux User #57137 - http://counter.li.org/
diff -Nru --show-c-function kopete-4.2.4-r1-orig/work/kopete-4.2.4/kopete/protocols/wlm/wlmaccount.cpp kopete-4.2.4-r1/work/kopete-4.2.4/kopete/protocols/wlm/wlmaccount.cpp
--- kopete-4.2.4-r1-orig/work/kopete-4.2.4/kopete/protocols/wlm/wlmaccount.cpp	2009-05-31 12:35:12.000000000 -0300
+++ kopete-4.2.4-r1/work/kopete-4.2.4/kopete/protocols/wlm/wlmaccount.cpp	2009-07-08 08:11:54.758951897 -0300
@@ -103,7 +103,7 @@ WlmAccount::fillActionMenu (KActionMenu 
     actionMenu->addAction(m_changeDNAction);
 //     actionMenu->addAction(m_startChatAction);
 
-//     actionMenu->addAction(m_openInboxAction);
+    actionMenu->addAction(m_openInboxAction);
     actionMenu->addAction(m_openStatusAction);
 }
 
@@ -254,6 +254,7 @@ WlmAccount::slotOpenInbox()
 {
 //     if (m_notifySocket)
 //         m_notifySocket->slotOpenInbox();
+    KToolInvocation::invokeBrowser(QLatin1String("http://www.hotmail.com";)) ;
 }
 
 void
@@ -319,6 +320,10 @@ WlmAccount::connectWithPassword (const Q
                             (MSN::NotificationServerConnection *)));
     QObject::connect (&m_server->cb, SIGNAL (wrongPassword ()), this,
                       SLOT (wrongPassword ()));
+    QObject::connect (&m_server->cb, SIGNAL (initialEmailNotification(int)), this,
+                      SLOT (slotInitialEmailNotification(int)));
+    QObject::connect (&m_server->cb, SIGNAL (newEmailNotification(QString, QString)), this,
+                      SLOT (slotNewEmailNotification(QString, QString)));
 
     myself ()->setOnlineStatus (WlmProtocol::protocol ()->wlmConnecting);
 }
@@ -1105,6 +1110,23 @@ void WlmAccount::downloadPendingDisplayP
     }
 }
 
+void 
+WlmAccount::slotInitialEmailNotification (const int unread_inbox)
+{
+    KNotification::event(QString::fromLatin1( "msn_mail" ),
+                         i18np( "%1 new message in your Hotmail inbox.",
+                                "%1 new messages in your Hotmail inbox.", unread_inbox),
+                         QPixmap(), 0L, KNotification::Persistent);
+}
+
+void 
+WlmAccount::slotNewEmailNotification (const QString from, const QString subject)
+{
+    KNotification::event(QString::fromLatin1( "msn_mail" ),
+                         i18n( "New e-mail from %1 in your Hotmail inbox<p>Subject: %2", from, subject),
+                         QPixmap(), 0L, KNotification::Persistent );
+}
+
 void WlmAccount::gotAddedGroup (bool added,
                                 const QString & groupName,
                                 const QString & groupId)
diff -Nru --show-c-function kopete-4.2.4-r1-orig/work/kopete-4.2.4/kopete/protocols/wlm/wlmaccount.h kopete-4.2.4-r1/work/kopete-4.2.4/kopete/protocols/wlm/wlmaccount.h
--- kopete-4.2.4-r1-orig/work/kopete-4.2.4/kopete/protocols/wlm/wlmaccount.h	2009-05-31 12:35:12.000000000 -0300
+++ kopete-4.2.4-r1/work/kopete-4.2.4/kopete/protocols/wlm/wlmaccount.h	2009-07-08 08:11:54.758951897 -0300
@@ -239,7 +239,11 @@ public slots:
     void
     downloadPendingDisplayPicture();
 
-	
+    void
+    slotInitialEmailNotification(const int unread_inbox);
+
+    void
+    slotNewEmailNotification(const QString from, const QString subject);
 
   protected:
         /**
diff -Nru --show-c-function kopete-4.2.4-r1-orig/work/kopete-4.2.4/kopete/protocols/wlm/wlmlibmsn.cpp kopete-4.2.4-r1/work/kopete-4.2.4/kopete/protocols/wlm/wlmlibmsn.cpp
--- kopete-4.2.4-r1-orig/work/kopete-4.2.4/kopete/protocols/wlm/wlmlibmsn.cpp	2009-05-31 12:35:12.000000000 -0300
+++ kopete-4.2.4-r1/work/kopete-4.2.4/kopete/protocols/wlm/wlmlibmsn.cpp	2009-07-08 08:11:50.678953435 -0300
@@ -50,6 +50,7 @@
 #include <string>
 #include <iostream>
 #include <kdebug.h>
+#include <kmime/kmime_util.h>
 
 #include <QObject>
 #include <QApplication>
@@ -557,11 +558,16 @@ Callbacks::gotInitialEmailNotification (
     Q_UNUSED( unread_inbox );
     Q_UNUSED( msgs_folders );
     Q_UNUSED( unread_folders );
-/*
+
     if (unread_inbox > 0)
+    {
+/*
         printf ("You have %d new messages in your Inbox. Total: %d\n",
                 unread_inbox, msgs_inbox);
-
+*/
+	emit initialEmailNotification (unread_inbox);
+    }
+/*
     if (unread_folders > 0)
         printf ("You have %d new messages in other folders. Total: %d\n",
                 unread_folders, msgs_folders);
@@ -577,6 +583,7 @@ Callbacks::gotNewEmailNotification (MSN:
     Q_UNUSED( subject );
 //    printf ("New e-mail has arrived from %s.\nSubject: %s\n", from.c_str (),
 //            subject.c_str ());
+    emit newEmailNotification (QString(from.c_str()), KMime::decodeRFC2047String(subject.c_str()));
 }
 
 void
diff -Nru --show-c-function kopete-4.2.4-r1-orig/work/kopete-4.2.4/kopete/protocols/wlm/wlmlibmsn.h kopete-4.2.4-r1/work/kopete-4.2.4/kopete/protocols/wlm/wlmlibmsn.h
--- kopete-4.2.4-r1-orig/work/kopete-4.2.4/kopete/protocols/wlm/wlmlibmsn.h	2009-05-31 12:35:12.000000000 -0300
+++ kopete-4.2.4-r1/work/kopete-4.2.4/kopete/protocols/wlm/wlmlibmsn.h	2009-07-08 08:11:50.678953435 -0300
@@ -448,6 +448,12 @@ class Callbacks:public QObject,
 
     void socketError( int error );
 
+    void
+    initialEmailNotification(const int unread_inbox);
+
+    void
+    newEmailNotification(const QString from, const QString subject);
+
 private slots:
     void emitSocketError( QAbstractSocket::SocketError error );
 };
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to