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

List:       kde-commits
Subject:    KDE/kdepim/messagelist
From:       Thomas McGuire <mcguire () kde ! org>
Date:       2010-07-13 14:14:03
Message-ID: 20100713141403.D50D4AC8E9 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1149456 by tmcguire:

Add support for an invitation icon in the messagelist

This is a merge of multiple commits from kolab/issue4240.

 M  +8 -0      core/manager.cpp  
 M  +3 -0      core/manager.h  
 M  +24 -1     core/theme.cpp  
 M  +6 -1      core/theme.h  
 M  +19 -0     core/themedelegate.cpp  
 M  +6 -0      storagemodel.cpp  
 M  +5 -0      utils/themeeditor.cpp  


--- trunk/KDE/kdepim/messagelist/core/manager.cpp #1149455:1149456
@@ -83,6 +83,7 @@
   mPixmapMessageNotEncrypted = new QPixmap( SmallIcon( "text-plain" ) );
   mPixmapMessageAttachment = new QPixmap( SmallIcon( "mail-attachment" ) );
   mPixmapMessageAnnotation = new QPixmap( SmallIcon( "view-pim-notes" ) );
+  mPixmapMessageInvitation = new QPixmap( SmallIcon( "mail-invitation" ) );
   //mPixmapShowMore = new QPixmap( SmallIcon( "list-add.png" ) );
   //mPixmapShowLess = new QPixmap( SmallIcon( "list-remove.png" ) );
   if ( KApplication::isRightToLeft() )
@@ -131,6 +132,7 @@
   delete mPixmapMessageNotEncrypted;
   delete mPixmapMessageAttachment;
   delete mPixmapMessageAnnotation;
+  delete mPixmapMessageInvitation;
   delete mPixmapShowMore;
   delete mPixmapShowLess;
   delete mPixmapVerticalLine;
@@ -715,6 +717,9 @@
         i = new Theme::ContentItem( Theme::ContentItem::AnnotationIcon );
         i->setHideWhenDisabled( true );
       r->addLeftItem( i );
+        i = new Theme::ContentItem( Theme::ContentItem::InvitationIcon );
+        i->setHideWhenDisabled( true );
+      r->addLeftItem( i );
         i = new Theme::ContentItem( Theme::ContentItem::SignatureStateIcon );
         i->setHideWhenDisabled( true );
       r->addLeftItem( i );
@@ -784,6 +789,9 @@
         i = new Theme::ContentItem( Theme::ContentItem::AnnotationIcon );
         i->setHideWhenDisabled( true );
       r->addRightItem( i );
+        i = new Theme::ContentItem( Theme::ContentItem::InvitationIcon );
+        i->setHideWhenDisabled( true );
+      r->addRightItem( i );
         i = new Theme::ContentItem( Theme::ContentItem::EncryptionStateIcon );
         i->setHideWhenDisabled( true );
       r->addRightItem( i );
--- trunk/KDE/kdepim/messagelist/core/manager.h #1149455:1149456
@@ -101,6 +101,7 @@
   QPixmap * mPixmapMessageNotEncrypted;
   QPixmap * mPixmapMessageAttachment;
   QPixmap * mPixmapMessageAnnotation;
+  QPixmap * mPixmapMessageInvitation;
   QPixmap * mPixmapShowMore;
   QPixmap * mPixmapShowLess;
   QPixmap * mPixmapVerticalLine;
@@ -169,6 +170,8 @@
     { return mPixmapMessageAttachment; };
   const QPixmap * pixmapMessageAnnotation() const
     { return mPixmapMessageAnnotation; };
+  const QPixmap * pixmapMessageInvitation() const
+    { return mPixmapMessageInvitation; };
   const QPixmap * pixmapShowMore() const
     { return mPixmapShowMore; };
   const QPixmap * pixmapShowLess() const
--- trunk/KDE/kdepim/messagelist/core/theme.cpp #1149455:1149456
@@ -44,8 +44,9 @@
 //  0x1016  08.03.2009      Added support for sorting by New/Unread status
 //  0x1017  16.08.2009      Added support for column icon
 //  0x1018  17.01.2010      Added support for annotation icon
+//  0x1019  13.07.2010      Added support for invitation icon
 //
-static const int gThemeCurrentVersion = 0x1018; // increase if you add new fields or \
change the meaning of some +static const int gThemeCurrentVersion = 0x1019; // \
increase if you add new fields or change the meaning of some  // you don't need to \
change the values below, but you might want to add new ones  static const int \
gThemeMinimumSupportedVersion = 0x1013;  static const int \
gThemeMinimumVersionWithColumnRuntimeData = 0x1014; @@ -53,6 +54,7 @@
 static const int gThemeMinimumVersionWithSortingByUnreadStatusAllowed = 0x1016;
 static const int gThemeMinimumVersionWithColumnIcon = 0x1017;
 static const int gThemeMinimumVersionWithAnnotationIcon = 0x1018;
+static const int gThemeMinimumVersionWithInvitationIcon = 0x1019;
 
 // the default icon size
 static const int gThemeDefaultIconSize = 16;
@@ -143,6 +145,8 @@
     break;
     case AnnotationIcon:
       return i18n( "Note Icon" );
+    case InvitationIcon:
+      return i18n( "Invitation Icon" );
     default:
       return i18nc( "Description for an Unknown Type", "Unknown" );
     break;
@@ -204,6 +208,7 @@
     case CombinedReadRepliedStateIcon:
     case TagList:
     case AnnotationIcon:
+    case InvitationIcon:
       // ok
     break;
     default:
@@ -353,7 +358,17 @@
       annotationItem->setHideWhenDisabled( true );
       addLeftItem( annotationItem );
     }
+
+    // Same as above, for the invitation icon
+    if ( ci->type() == ContentItem::AttachmentStateIcon &&
+         themeVersion < gThemeMinimumVersionWithInvitationIcon &&
+         val > 1 ) {
+      kDebug() << "Old theme version detected, adding invitation item next to \
attachment icon."; +      ContentItem *invitationItem = new ContentItem( \
ContentItem::InvitationIcon ) ; +      invitationItem->setHideWhenDisabled( true );
+      addLeftItem( invitationItem );
   }
+  }
 
   // right item count
 
@@ -380,7 +395,15 @@
       annotationItem->setHideWhenDisabled( true );
       addRightItem( annotationItem );
     }
+    if ( ci->type() == ContentItem::AttachmentStateIcon &&
+         themeVersion < gThemeMinimumVersionWithInvitationIcon &&
+         val > 1 ) {
+      kDebug() << "Old theme version detected, adding invitation item next to \
attachment icon."; +      ContentItem *invitationItem = new ContentItem( \
ContentItem::InvitationIcon ) ; +      invitationItem->setHideWhenDisabled( true );
+      addRightItem( invitationItem );
   }
+  }
 
   return true;
 }
--- trunk/KDE/kdepim/messagelist/core/theme.h #1149455:1149456
@@ -215,7 +215,12 @@
       /**
        * Whether the message has a annotation/note
        */
-      AnnotationIcon               = 23 | ApplicableToMessageItems | IsIcon | \
CanBeDisabled | IsClickable +      AnnotationIcon               = 23 | \
ApplicableToMessageItems | IsIcon | CanBeDisabled | IsClickable, +
+      /**
+       * Whether the message is an invitation
+       */
+      InvitationIcon               = 24 | ApplicableToMessageItems | IsIcon
 #if 0
       TotalMessageCount
       UnreadMessageCount
--- trunk/KDE/kdepim/messagelist/core/themedelegate.cpp #1149455:1149456
@@ -936,6 +936,11 @@
                                       \
                Manager::instance()->pixmapMessageAnnotation(), ci, painter,
                                       l, top, r, layoutDir == Qt::LeftToRight, \
mTheme->iconSize() );  break;
+        case Theme::ContentItem::InvitationIcon:
+          if ( messageItem )
+            paint_boolean_state_icon( messageItem->status().hasInvitation(),
+                                      \
Manager::instance()->pixmapMessageInvitation(), ci, painter, +                        \
l, top, r, layoutDir == Qt::LeftToRight, mTheme->iconSize() );  case \
Theme::ContentItem::ActionItemStateIcon:  if ( messageItem )
             paint_boolean_state_icon( messageItem->status().isToAct(),
@@ -1096,6 +1101,12 @@
                                       \
                Manager::instance()->pixmapMessageAnnotation(), ci, painter,
                                       l, top, r, layoutDir != Qt::LeftToRight, \
mTheme->iconSize() );  break;
+        case Theme::ContentItem::InvitationIcon:
+          if ( messageItem )
+            paint_boolean_state_icon( messageItem->status().hasInvitation(),
+                                      \
Manager::instance()->pixmapMessageInvitation(), ci, painter, +                        \
l, top, r, layoutDir != Qt::LeftToRight, mTheme->iconSize() ); +        break;
         case Theme::ContentItem::ActionItemStateIcon:
           if ( messageItem )
             paint_boolean_state_icon( messageItem->status().isToAct(),
@@ -1330,6 +1341,10 @@
           if ( messageItem )
             compute_bounding_rect_for_boolean_state_icon( \
messageItem->hasAnnotation(), ci, l, top, r, mHitContentItemRect, layoutDir == \
Qt::LeftToRight, mTheme->iconSize() );  break;
+        case Theme::ContentItem::InvitationIcon:
+          if ( messageItem )
+            compute_bounding_rect_for_boolean_state_icon( \
messageItem->status().hasInvitation(), ci, l, top, r, mHitContentItemRect, layoutDir \
== Qt::LeftToRight, mTheme->iconSize() ); +        break;
         case Theme::ContentItem::ActionItemStateIcon:
           if ( messageItem )
             compute_bounding_rect_for_boolean_state_icon( \
messageItem->status().isToAct(), ci, l, top, r, mHitContentItemRect, layoutDir == \
Qt::LeftToRight, mTheme->iconSize() ); @@ -1479,6 +1494,10 @@
           if ( messageItem )
             compute_bounding_rect_for_boolean_state_icon( \
messageItem->hasAnnotation(), ci, l, top, r, mHitContentItemRect, layoutDir != \
Qt::LeftToRight, mTheme->iconSize() );  break;
+        case Theme::ContentItem::InvitationIcon:
+          if ( messageItem )
+            compute_bounding_rect_for_boolean_state_icon( \
messageItem->status().hasInvitation(), ci, l, top, r, mHitContentItemRect, layoutDir \
!= Qt::LeftToRight, mTheme->iconSize() ); +        break;
         case Theme::ContentItem::ActionItemStateIcon:
           if ( messageItem )
             compute_bounding_rect_for_boolean_state_icon( \
messageItem->status().isToAct(), ci, l, top, r, mHitContentItemRect, layoutDir != \
                Qt::LeftToRight, mTheme->iconSize() );
--- trunk/KDE/kdepim/messagelist/storagemodel.cpp #1149455:1149456
@@ -20,6 +20,7 @@
 
 #include <messagecore/stringutil.h>
 #include <messagecore/globalsettings.h>
+#include <messagecore/nodehelper.h>
 
 #include <akonadi/attributefactory.h>
 #include <akonadi/collection.h>
@@ -303,6 +304,11 @@
   KPIM::MessageStatus stat;
   stat.setStatusFromFlags( item.flags() );
 
+  // FIXME: Attachment and invitation state should be stored on the server as well!
+  if ( MessageCore::NodeHelper::isInvitation( mail.get() ) ) {
+    stat.setHasInvitation( true );
+  }
+
   mi->setStatus( stat );
 
   mi->setEncryptionState( Core::MessageItem::EncryptionStateUnknown );
--- trunk/KDE/kdepim/messagelist/utils/themeeditor.cpp #1149455:1149456
@@ -226,6 +226,7 @@
   stat.setSent( false );
   stat.setSpam( true );
   stat.setWatched( true );
+  stat.setHasInvitation();
   //stat.setHasAttachment( false );
 
   mSampleMessageItem->setStatus( stat );
@@ -1401,6 +1402,10 @@
   cil->setToolTip( Theme::ContentItem::description( cil->type() ) );
   gblayout->addWidget( cil, 1, 5 );
 
+  cil = new ThemeContentItemSourceLabel( gb, Theme::ContentItem::InvitationIcon );
+  cil->setPixmap( *( Manager::instance()->pixmapMessageInvitation() ) );
+  cil->setToolTip( Theme::ContentItem::description( cil->type() ) );
+  gblayout->addWidget( cil, 2, 5 );
 
 
 


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

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