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

List:       kde-commits
Subject:    branches/kdepim/enterprise/kdepim/kmail
From:       Till Adam <adam () kde ! org>
Date:       2007-05-17 18:25:10
Message-ID: 1179426310.303828.25130.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 665722 by tilladam:

For read-only folders (those where we can't adjust the alarm relevance of a
folder directly, offer to override teh alarm relevanve, that is, make it
possible to block alarms for other people's folders. The gui changes from
a combo box to a checkbox, in that case, and the "we have a local override"
flag prevents the change from being overwritten by the next sync. If the
alarms are re-enabled, that flag is reset, and the next sync restores the
state from the server.

(prokde35 feature w1-20)



 M  +5 -0      kmfoldercachedimap.cpp  
 M  +7 -0      kmfoldercachedimap.h  
 M  +52 -20    kmfolderdia.cpp  
 M  +1 -0      kmfolderdia.h  


--- branches/kdepim/enterprise/kdepim/kmail/kmfoldercachedimap.cpp #665721:665722
@@ -2773,4 +2773,9 @@
   return createIndexFromContents();
 }
 
+void KMFolderCachedImap::resetIncidencesForChanged()
+{
+  mIncidencesForChanged = false;
+}
+
 #include "kmfoldercachedimap.moc"
--- branches/kdepim/enterprise/kdepim/kmail/kmfoldercachedimap.h #665721:665722
@@ -383,6 +383,13 @@
   void slotCheckNamespace( const QStringList&, const QStringList&,
       const QStringList&, const QStringList&, const ImapAccountBase::jobData& );
 
+  /** 
+   * Reset the flag that is used to tell whether there are local changes to the
+   * incidencesFor annoation. This is needed to-redownload the annotation value
+   * when a local override needs to be cleared.
+   */
+  void resetIncidencesForChanged();
+
 private slots:
   void serverSyncInternal();
   void slotIncreaseProgress();
--- branches/kdepim/enterprise/kdepim/kmail/kmfolderdia.cpp #665721:665722
@@ -458,6 +458,9 @@
   } else {
     mContentsComboBox = 0;
   }
+  
+  mIncidencesForComboBox = 0;
+  mIncidencesForCheckBox = 0;
 
   // Kolab incidences-for annotation.
   // Show incidences-for combobox if the contents type can be changed (new folder),
@@ -466,13 +469,15 @@
          GlobalSettings::EnumTheIMAPResourceStorageFormat::XML ) &&
       mContentsComboBox ) {
     ++row;
-    QLabel* label = new QLabel( i18n( "Generate free/&busy and activate alarms for:" \
                ), this );
-    gl->addWidget( label, row, 0 );
-    mIncidencesForComboBox = new QComboBox( this );
-    label->setBuddy( mIncidencesForComboBox );
-    gl->addWidget( mIncidencesForComboBox, row, 1 );
+    const bool readOnly = !mDlg->folder()->isReadOnly();
+    if ( readOnly ) {
+      QLabel* label = new QLabel( i18n( "Generate free/&busy and activate alarms \
for:" ), this ); +      gl->addWidget( label, row, 0 );
+      mIncidencesForComboBox = new QComboBox( this );
+      label->setBuddy( mIncidencesForComboBox );
+      gl->addWidget( mIncidencesForComboBox, row, 1 );
 
-    QWhatsThis::add( mIncidencesForComboBox,
+      const QString whatsThisForMyOwnFolders = 
                      i18n( "This setting defines which users sharing "
                            "this folder should get \"busy\" periods in their \
                freebusy lists "
                            "and should see the alarms for the events or tasks in \
this folder. " @@ -485,20 +490,34 @@
                            "group meetings, all readers of the folders should be \
marked "  "as busy for meetings.\n"
                            "A company-wide folder with optional events in it would \
                use \"Nobody\" "
-                           "since it is not known who will go to those events." ) );
+                           "since it is not known who will go to those events." );
 
-    mIncidencesForComboBox->insertItem( i18n( "Nobody" ) );
-    mIncidencesForComboBox->insertItem( i18n( "Admins of This Folder" ) );
-    mIncidencesForComboBox->insertItem( i18n( "All Readers of This Folder" ) );
+      QWhatsThis::add( mIncidencesForComboBox, whatsThisForMyOwnFolders );
+      mIncidencesForComboBox->insertItem( i18n( "Nobody" ) );
+      mIncidencesForComboBox->insertItem( i18n( "Admins of This Folder" ) );
+      mIncidencesForComboBox->insertItem( i18n( "All Readers of This Folder" ) );
+    } else {
+      const QString whatsThisForReadOnlyFolders =
+        i18n( "This setting allows you to disable alarms for folders shared by "
+            "others. ");
+      mIncidencesForCheckBox = new QCheckBox( this );
+      gl->addWidget( mIncidencesForCheckBox, row, 0 );
+      QLabel* label = new QLabel( i18n( "Generate free/&busy and activate alarms" ), \
this ); +      gl->addWidget( label, row, 1 );
+      label->setBuddy( mIncidencesForCheckBox );
 
+      QWhatsThis::add( mIncidencesForCheckBox, whatsThisForReadOnlyFolders );
+    }
+
     if ( mDlg->folder()->storage()->contentsType() != KMail::ContentsTypeCalendar
       && mDlg->folder()->storage()->contentsType() != KMail::ContentsTypeTask ) {
-      mIncidencesForComboBox->setEnabled( false );
+      if ( readOnly ) {
+        mIncidencesForComboBox->setEnabled( false );
+      } else {
+        mIncidencesForCheckBox->setEnabled( false );
+      }
     }
-  } else {
-    mIncidencesForComboBox = 0;
   }
-
   topLayout->addStretch( 100 ); // eat all superfluous space
 
   initializeWithValuesFromFolder( mDlg->folder() );
@@ -548,6 +567,10 @@
     KMFolderCachedImap* dimap = static_cast<KMFolderCachedImap *>( folder->storage() \
);  mIncidencesForComboBox->setCurrentItem( dimap->incidencesFor() );
   }
+  if ( mIncidencesForCheckBox ) {
+    KMFolderCachedImap* dimap = static_cast<KMFolderCachedImap *>( folder->storage() \
); +    mIncidencesForCheckBox->setChecked( dimap->incidencesFor() != \
KMFolderCachedImap::IncForNobody ); +  }
 }
 
 //-----------------------------------------------------------------------------
@@ -569,10 +592,12 @@
         "to temporarily disable hiding of groupware folders to be able to see it.");
     KMessageBox::information( this, message );
   }
-
+  const bool enable = type == KMail::ContentsTypeCalendar ||
+                                          type == KMail::ContentsTypeTask;
   if ( mIncidencesForComboBox )
-      mIncidencesForComboBox->setEnabled( type == KMail::ContentsTypeCalendar ||
-                                          type == KMail::ContentsTypeTask );
+      mIncidencesForComboBox->setEnabled( enable );
+  if ( mIncidencesForComboBox )
+      mIncidencesForCheckBox->setEnabled( enable );
 }
 
 //-----------------------------------------------------------------------------
@@ -634,12 +659,19 @@
       folder->storage()->setContentsType( type );
     }
 
-    if ( mIncidencesForComboBox && folder->folderType() == KMFolderTypeCachedImap ) \
                {
-      KMFolderCachedImap::IncidencesFor incfor =
-        static_cast<KMFolderCachedImap::IncidencesFor>( \
mIncidencesForComboBox->currentItem() ); +    if ( folder->folderType() == \
                KMFolderTypeCachedImap ) {
       KMFolderCachedImap* dimap = static_cast<KMFolderCachedImap *>( \
mDlg->folder()->storage() ); +      KMFolderCachedImap::IncidencesFor incfor = \
KMFolderCachedImap::IncForAdmins; +      if ( mIncidencesForComboBox ) {
+        incfor = static_cast<KMFolderCachedImap::IncidencesFor>( \
mIncidencesForComboBox->currentItem() ); +      }
+      if ( mIncidencesForCheckBox ) {
+        incfor = mIncidencesForCheckBox->isChecked() ? \
KMFolderCachedImap::IncForAdmins: KMFolderCachedImap::IncForNobody; +      }
       if ( dimap->incidencesFor() != incfor ) {
         dimap->setIncidencesFor( incfor );
+        if ( mIncidencesForCheckBox && incfor != KMFolderCachedImap::IncForNobody )
+          dimap->resetIncidencesForChanged();
         dimap->writeConfig();
       }
     }
--- branches/kdepim/enterprise/kdepim/kmail/kmfolderdia.h #665721:665722
@@ -136,6 +136,7 @@
   QComboBox *mShowSenderReceiverComboBox;
   QComboBox *mContentsComboBox;
   QComboBox *mIncidencesForComboBox;
+  QCheckBox *mIncidencesForCheckBox;
   QLabel      *mNormalIconLabel;
   KIconButton *mNormalIconButton;
   QLabel      *mUnreadIconLabel;


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

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