Advertisement
Guest User

kgmailnotifier.patch

a guest
Jun 19th, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 8.50 KB | None | 0 0
  1. Only in kgmailnotifier-0.5.1/src/: CMakeLists.txt.user
  2. diff -crB kgmailnotifier-0.5.1-orig/kgmailnotifier-0.5.1/src//kgmailnotifier.cpp kgmailnotifier-0.5.1/src//kgmailnotifier.cpp
  3. *** kgmailnotifier-0.5.1-orig/kgmailnotifier-0.5.1/src//kgmailnotifier.cpp  Thu Dec  3 21:32:29 2009
  4. --- kgmailnotifier-0.5.1/src//kgmailnotifier.cpp    Sun Jun 19 18:09:42 2011
  5. ***************
  6. *** 35,40 ****
  7. --- 35,43 ----
  8.   #include <QMenu>
  9.   #include <QTextStream>
  10.  
  11. + #include <signal.h>
  12. + #include <unistd.h>
  13. +
  14.   static QTextStream cout(stdout, QIODevice::WriteOnly);
  15.  
  16.   #include <cstdlib>
  17. ***************
  18. *** 48,53 ****
  19. --- 51,58 ----
  20.       : KUniqueApplication(),
  21.         m_configurationDialog(0)
  22.   {
  23. +     signal(SIGSEGV, SIG_IGN);
  24. +
  25.       cout << endl;
  26.       cout << "Welcome to KGmailNotifier." << endl;
  27.       cout << "(C) 2007-2009 Marcel Hasler (mahasler@gmail.com)" << endl << endl;
  28. ***************
  29. *** 86,92 ****
  30.       m_actionCollection = new KActionCollection(this);
  31.  
  32.       m_trayIcon = new TrayIcon(0);
  33. !     m_trayIcon->setIcon(m_redIcon, false, 0);
  34.  
  35.       // Add tray icon menu items
  36.       KAction *action;
  37. --- 91,97 ----
  38.       m_actionCollection = new KActionCollection(this);
  39.  
  40.       m_trayIcon = new TrayIcon(0);
  41. !     m_trayIcon->setIcon(m_redIcon, false, 0, false);
  42.  
  43.       // Add tray icon menu items
  44.       KAction *action;
  45. ***************
  46. *** 172,177 ****
  47. --- 177,184 ----
  48.  
  49.       if (m_ledHandler)
  50.           delete m_ledHandler;
  51. +
  52. +     //exit();
  53.   }
  54.  
  55.  
  56. ***************
  57. *** 223,229 ****
  58.  
  59.       if (msgCount > 0)
  60.       {
  61. !         m_trayIcon->setIcon(m_blueIcon, Configuration::config()->numberOnSystray(), msgCount);
  62.           m_trayIcon->setToolTip(i18np("1 new message", "%1 new messages", msgCount));
  63.           m_popupWindow->setMessageCount(msgCount);
  64.           m_popupWindow->setSender(m_account->lastSender());
  65. --- 230,236 ----
  66.  
  67.       if (msgCount > 0)
  68.       {
  69. !         m_trayIcon->setIcon(m_blueIcon, Configuration::config()->numberOnSystray(), msgCount, false);
  70.           m_trayIcon->setToolTip(i18np("1 new message", "%1 new messages", msgCount));
  71.           m_popupWindow->setMessageCount(msgCount);
  72.           m_popupWindow->setSender(m_account->lastSender());
  73. ***************
  74. *** 246,252 ****
  75.  
  76.       else
  77.       {
  78. !         m_trayIcon->setIcon(m_redIcon, false, msgCount);
  79.           m_trayIcon->setToolTip(i18n("No new messages"));
  80.           m_popupWindow->setMessageCount(0);
  81.  
  82. --- 253,259 ----
  83.  
  84.       else
  85.       {
  86. !         m_trayIcon->setIcon(m_redIcon, false, msgCount, false);
  87.           m_trayIcon->setToolTip(i18n("No new messages"));
  88.           m_popupWindow->setMessageCount(0);
  89.  
  90. ***************
  91. *** 269,275 ****
  92.       else
  93.           errorMessage = i18n("Connection failed!");
  94.  
  95. !     m_trayIcon->setIcon(m_alertIcon, false, 0);
  96.       m_trayIcon->setToolTip(errorMessage);
  97.  
  98.       m_popupWindow->setConnectionFailed();
  99. --- 276,282 ----
  100.       else
  101.           errorMessage = i18n("Connection failed!");
  102.  
  103. !     m_trayIcon->setIcon(m_alertIcon, Configuration::config()->numberOnSystray(), 0, true);
  104.       m_trayIcon->setToolTip(errorMessage);
  105.  
  106.       m_popupWindow->setConnectionFailed();
  107. diff -crB kgmailnotifier-0.5.1-orig/kgmailnotifier-0.5.1/src//main.cpp kgmailnotifier-0.5.1/src//main.cpp
  108. *** kgmailnotifier-0.5.1-orig/kgmailnotifier-0.5.1/src//main.cpp    Thu Dec  3 21:32:29 2009
  109. --- kgmailnotifier-0.5.1/src//main.cpp  Fri Jun 17 14:40:14 2011
  110. ***************
  111. *** 41,47 ****
  112.       if (!KUniqueApplication::start())
  113.           exit(0);
  114.  
  115. !     KGmailNotifier *kgmailnotifier = new KGmailNotifier();
  116. !     return kgmailnotifier->exec();
  117.   }
  118.  
  119. --- 41,47 ----
  120.       if (!KUniqueApplication::start())
  121.           exit(0);
  122.  
  123. !     KGmailNotifier kgmailnotifier;
  124. !     return kgmailnotifier.exec();
  125.   }
  126.  
  127. diff -crB kgmailnotifier-0.5.1-orig/kgmailnotifier-0.5.1/src//trayicon.cpp kgmailnotifier-0.5.1/src//trayicon.cpp
  128. *** kgmailnotifier-0.5.1-orig/kgmailnotifier-0.5.1/src//trayicon.cpp    Thu Dec  3 21:32:29 2009
  129. --- kgmailnotifier-0.5.1/src//trayicon.cpp  Sun Jun 19 18:10:15 2011
  130. ***************
  131. *** 33,38 ****
  132. --- 33,39 ----
  133.   TrayIcon::TrayIcon(QWidget *parent)
  134.       : KSystemTrayIcon(parent)
  135.   {
  136. +     m_number = 0;
  137.       connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotActivated(QSystemTrayIcon::ActivationReason)));
  138.   }
  139.  
  140. ***************
  141. *** 47,55 ****
  142.   //    Public methods                                                                                                   //
  143.   // ------------------------------------------------------------------------------------------------------------------- //
  144.  
  145. ! void TrayIcon::setIcon(const QPixmap &icon, const bool showNumber, const unsigned int number)
  146.   {
  147. !     if (showNumber && number > 0) // Display number on systray
  148.       {
  149.           // The following code is inspired by Akregator's tray icon code
  150.           // and used in order to provide a more consistent systray look
  151. --- 48,61 ----
  152.   //    Public methods                                                                                                   //
  153.   // ------------------------------------------------------------------------------------------------------------------- //
  154.  
  155. ! void TrayIcon::setIcon(const QPixmap &icon, bool showNumber, unsigned int number, bool connectionProblem)
  156.   {
  157. !     if (!connectionProblem)
  158. !     {
  159. !         m_number = number;
  160. !     }
  161. !
  162. !     if ((showNumber && number > 0) || (connectionProblem && showNumber && m_number > 0)) // Display number on systray
  163.       {
  164.           // The following code is inspired by Akregator's tray icon code
  165.           // and used in order to provide a more consistent systray look
  166. ***************
  167. *** 57,63 ****
  168.           if (iconWidth == 0)
  169.               return;
  170.  
  171. !         QString numberStr = QString::number(number);
  172.           QFont f = KGlobalSettings::generalFont();
  173.           f.setBold(true);
  174.  
  175. --- 63,74 ----
  176.           if (iconWidth == 0)
  177.               return;
  178.  
  179. !         QString numberStr;
  180. !         if (!connectionProblem)
  181. !             numberStr = QString::number(number);
  182. !         else
  183. !             numberStr = QString::number(m_number);
  184. !
  185.           QFont f = KGlobalSettings::generalFont();
  186.           f.setBold(true);
  187.  
  188. ***************
  189. *** 86,92 ****
  190.                               (iconWidth - boundingRect.height()) / 2);
  191.  
  192.           // Draw the frame
  193. !         p.setOpacity(0.7f);
  194.           p.setBrush(scheme.background(KColorScheme::LinkBackground));
  195.           p.setPen(Qt::NoPen);
  196.           p.drawRoundedRect(boundingRect, 2.0, 2.0);
  197. --- 97,103 ----
  198.                               (iconWidth - boundingRect.height()) / 2);
  199.  
  200.           // Draw the frame
  201. !         p.setOpacity(0.5f);
  202.           p.setBrush(scheme.background(KColorScheme::LinkBackground));
  203.           p.setPen(Qt::NoPen);
  204.           p.drawRoundedRect(boundingRect, 2.0, 2.0);
  205. ***************
  206. *** 94,100 ****
  207.           // Draw the number
  208.           p.setOpacity(1.0f);
  209.           p.setBrush(Qt::NoBrush);
  210. !         p.setPen(Qt::darkBlue);
  211.           p.drawText(finalIcon.rect(), Qt::AlignCenter, numberStr);
  212.  
  213.           // Diplay the final icon
  214. --- 105,114 ----
  215.           // Draw the number
  216.           p.setOpacity(1.0f);
  217.           p.setBrush(Qt::NoBrush);
  218. !         if (connectionProblem)
  219. !             p.setPen(Qt::red);
  220. !         else
  221. !             p.setPen(Qt::darkBlue);
  222.           p.drawText(finalIcon.rect(), Qt::AlignCenter, numberStr);
  223.  
  224.           // Diplay the final icon
  225. diff -crB kgmailnotifier-0.5.1-orig/kgmailnotifier-0.5.1/src//trayicon.h kgmailnotifier-0.5.1/src//trayicon.h
  226. *** kgmailnotifier-0.5.1-orig/kgmailnotifier-0.5.1/src//trayicon.h  Thu Dec  3 21:32:29 2009
  227. --- kgmailnotifier-0.5.1/src//trayicon.h    Sun Jun 19 17:57:02 2011
  228. ***************
  229. *** 30,41 ****
  230.       TrayIcon(QWidget *parent);
  231.       ~TrayIcon();
  232.  
  233. !     void setIcon(const QPixmap &icon, const bool showNumber, const unsigned int number);
  234.  
  235.   private:
  236.       TrayIcon(const TrayIcon&);
  237.       TrayIcon& operator=(const TrayIcon&);
  238.  
  239.   private slots:
  240.       void slotActivated(QSystemTrayIcon::ActivationReason reason);
  241.  
  242. --- 30,42 ----
  243.       TrayIcon(QWidget *parent);
  244.       ~TrayIcon();
  245.  
  246. !     void setIcon(const QPixmap &icon, const bool showNumber, const unsigned int number, bool connectionProblem);
  247.  
  248.   private:
  249.       TrayIcon(const TrayIcon&);
  250.       TrayIcon& operator=(const TrayIcon&);
  251.  
  252. +     int m_number;
  253.   private slots:
  254.       void slotActivated(QSystemTrayIcon::ActivationReason reason);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement