~ubuntu-branches/ubuntu/raring/kdepimlibs/raring-proposed

« back to all changes in this revision

Viewing changes to akonadi/kmime/specialmailcollections.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-07-26 17:13:11 UTC
  • mfrom: (1.1.81)
  • Revision ID: package-import@ubuntu.com-20120726171311-j2heoxylb6lbhg4w
Tags: 4:4.9.0-0ubuntu1
* New upstream release
* Use direct build-depends versions rather than kde-sc-dev-latest

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
*/
19
19
 
20
20
#include "specialmailcollections.h"
21
 
 
 
21
#include "akonadi/entitydisplayattribute.h"
 
22
#include "akonadi/collectionmodifyjob.h"
22
23
#include "specialmailcollectionssettings.h"
23
24
 
24
25
#include <KGlobal>
25
 
 
 
26
#include <KLocale>
26
27
#include "akonadi/agentinstance.h"
27
28
 
28
29
using namespace Akonadi;
101
102
  return SpecialCollections::defaultCollection( enumToType( type ) );
102
103
}
103
104
 
 
105
void SpecialMailCollections::verifyI18nDefaultCollection( Type type )
 
106
{
 
107
  Collection collection = defaultCollection( type );
 
108
  QString defaultI18n;
 
109
 
 
110
  switch ( type ) {
 
111
  case SpecialMailCollections::Inbox:
 
112
    defaultI18n = i18nc( "local mail folder", "inbox" );
 
113
    break;
 
114
  case SpecialMailCollections::Outbox:
 
115
    defaultI18n = i18nc( "local mail folder", "outbox" );
 
116
    break;
 
117
  case SpecialMailCollections::SentMail:
 
118
    defaultI18n = i18nc( "local mail folder", "sent-mail" );
 
119
    break;
 
120
  case SpecialMailCollections::Trash:
 
121
     defaultI18n = i18nc( "local mail folder", "trash" );
 
122
     break;
 
123
  case SpecialMailCollections::Drafts:
 
124
     defaultI18n = i18nc( "local mail folder", "drafts" );
 
125
     break;
 
126
  case SpecialMailCollections::Templates:
 
127
     defaultI18n = i18nc( "local mail folder", "templates" );
 
128
     break;
 
129
  default:
 
130
     break;
 
131
  }
 
132
  if(!defaultI18n.isEmpty()) {
 
133
    if(collection.hasAttribute<Akonadi::EntityDisplayAttribute>()) {
 
134
      if( collection.attribute<Akonadi::EntityDisplayAttribute>()->displayName() != defaultI18n) {
 
135
          collection.attribute<Akonadi::EntityDisplayAttribute>()->setDisplayName( defaultI18n );
 
136
          Akonadi::CollectionModifyJob *job = new Akonadi::CollectionModifyJob( collection, this );
 
137
          connect( job, SIGNAL(result(KJob*)), this, SLOT(slotCollectionModified(KJob*)) );
 
138
      }
 
139
    }
 
140
  }
 
141
}
 
142
 
 
143
void SpecialMailCollections::slotCollectionModified(KJob*job)
 
144
{
 
145
  if ( job->error() ) {
 
146
    kDebug()<<" Error when we modified collection";
 
147
    return;
 
148
  }
 
149
}
 
150
 
104
151
#include "specialmailcollections.moc"