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

List:       kde-commits
Subject:    [Konversation] 1cae2ba: Do not cut notifications
From:       Aurelien Gateau <agateau () kde ! org>
Date:       2010-03-31 19:30:04
Message-ID: 201003311930.o2VJU4kt001935 () kore ! kollide ! net
[Download RAW message or body]

commit 1cae2bad4a61c6c94ffa681aa33ebd3b91f022de
Author: Aurelien Gateau <agateau@kde.org>
Date:   Wed Mar 31 11:08:38 2010 +0200

    Do not cut notifications
    
    Blindly cutting notifications every 50 characters looks bad because the cut
    often lands in the middle of the word. It also occasionally lands in the
    middle of an html tag (for example because the text contains a '<' or a
    '>' character) causing even weirder renderings.
    
    It's better to leave formatting to the notification system.

diff --git a/src/notificationhandler.cpp b/src/notificationhandler.cpp
index 94753c2..a86c709 100644
--- a/src/notificationhandler.cpp
+++ b/src/notificationhandler.cpp
@@ -46,7 +46,7 @@ namespace Konversation
             return;
 
         QString cleanedMessage = removeIrcMarkup(message);
-        QString forKNotify = addLineBreaks(Qt::escape(cleanedMessage));
+        QString forKNotify = Qt::escape(cleanedMessage);
 
         KNotification::event(QString::fromLatin1("message"), QString("<qt>&lt;%1&gt; \
%2</qt>").arg(fromNick).arg(forKNotify), QPixmap(), m_mainWindow);  
@@ -74,7 +74,7 @@ namespace Konversation
             return;
 
         QString cleanedMessage = removeIrcMarkup(message);
-        QString forKNotify = addLineBreaks(Qt::escape(cleanedMessage));
+        QString forKNotify = Qt::escape(cleanedMessage);
 
         KNotification::event(QString::fromLatin1("nick"), QString("<qt>&lt;%1&gt; \
%2</qt>").arg(fromNick).arg(forKNotify), QPixmap(), m_mainWindow);  
@@ -100,7 +100,7 @@ namespace Konversation
             return;
 
         QString cleanedMessage = removeIrcMarkup(message);
-        QString forKNotify = addLineBreaks(Qt::escape(cleanedMessage));
+        QString forKNotify = Qt::escape(cleanedMessage);
 
         KNotification::event(QString::fromLatin1("queryMessage"), \
QString("<qt>&lt;%1&gt; %2</qt>").arg(fromNick).arg(forKNotify), QPixmap(), \
m_mainWindow);  
@@ -315,7 +315,7 @@ namespace Konversation
         startTrayNotification(chatWin);
 
         QString cleanedMessage = removeIrcMarkup(message);
-        QString forKNotify = addLineBreaks(Qt::escape(cleanedMessage));
+        QString forKNotify = Qt::escape(cleanedMessage);
 
         if(fromNick.isEmpty())
             KNotification::event(QString::fromLatin1("highlight"), QString("<qt>(%1) \
*** %2</qt>").arg(chatWin->getName()).arg(forKNotify), QPixmap(), m_mainWindow); @@ \
                -358,20 +358,6 @@ namespace Konversation
         KNotification::event(QString::fromLatin1("channelJoin"), i18n("You have \
joined %1.",channel), QPixmap(), m_mainWindow);  }
 
-    QString NotificationHandler::addLineBreaks(const QString& string)
-    {
-        QString forKNotify = string;
-        int offset = 0;
-
-        for(int i = 0; i < string.length(); i += 50)
-        {
-            forKNotify.insert(i + (offset * 4), "<br>");
-            ++offset;
-        }
-
-        return forKNotify;
-    }
-
 }
 
 #include "notificationhandler.moc"
diff --git a/src/notificationhandler.h b/src/notificationhandler.h
index e268449..520d1ee 100644
--- a/src/notificationhandler.h
+++ b/src/notificationhandler.h
@@ -53,7 +53,6 @@ namespace Konversation
 
         protected:
             void startTrayNotification(ChatWindow* chatWin);
-            QString addLineBreaks(const QString& string);
 
         private:
             MainWindow* m_mainWindow;


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

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