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

List:       kde-commits
Subject:    KDE/kdepim/mobile
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2010-11-18 12:23:45
Message-ID: 20101118122345.96F06AC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1198436 by tokoe:

Show the number of recipients in the composer's 'Send'
button and draw its background red if the too-many-recipients
threshold has been exceeded.


 M  +1 -1      lib/Button2.qml  
 M  +2 -0      mail/EditorView.qml  
 M  +16 -1     mail/composerview.cpp  
 M  +6 -0      mail/composerview.h  
 M  +14 -0     mail/settings.kcfg  


--- trunk/KDE/kdepim/mobile/lib/Button2.qml #1198435:1198436
@@ -21,7 +21,7 @@
 
 import Qt 4.7 as QML
 
-QML.Item {
+QML.Rectangle {
   id: root
   property alias icon: iconImage.source
   property alias buttonText: buttonLabel.text
--- trunk/KDE/kdepim/mobile/mail/EditorView.qml #1198435:1198436
@@ -159,6 +159,8 @@
       width: height * 1.5;
       height: identityCombo.height
       icon: KDE.iconPath( "mail-folder-outbox", 64 );
+      color: window.tooManyRecipients ? "red" : "#00000000"
+      buttonText: window.recipientsCount == 0 ? "" : window.recipientsCount
       onClicked: window.send();
     }
   }
--- trunk/KDE/kdepim/mobile/mail/composerview.cpp #1198435:1198436
@@ -255,9 +255,13 @@
   m_composerBase->recipientsEditor()->setCompletionMode( \
KGlobalSettings::CompletionAuto );  \
m_composerBase->recipientsEditor()->setAutoResizeView( true );  
+  connect( m_composerBase->recipientsEditor(), SIGNAL( lineAdded( \
KPIM::MultiplyingLine* ) ), +           SIGNAL( recipientsCountChanged() ) );
+  connect( m_composerBase->recipientsEditor(), SIGNAL( lineDeleted( int ) ),
+           SIGNAL( recipientsCountChanged() ) );
+
   if ( m_message )
     setMessage( m_message );
-
 }
 
 void ComposerView::setMessage(const KMime::Message::Ptr& msg)
@@ -514,6 +518,17 @@
   return m_encrypt;
 }
 
+bool ComposerView::tooManyRecipients() const
+{
+  const int threshold = Settings::self()->recipientThreshold();
+  return (Settings::self()->tooManyRecipients() && (recipientsCount() > threshold));
+}
+
+int ComposerView::recipientsCount() const
+{
+  return (m_composerBase->recipientsEditor() ? \
m_composerBase->recipientsEditor()->recipients().count() : 0); +}
+
 void ComposerView::signEmail( bool sign )
 {
   m_sign = sign;
--- trunk/KDE/kdepim/mobile/mail/composerview.h #1198435:1198436
@@ -50,6 +50,8 @@
   Q_PROPERTY( bool busy READ busy WRITE setBusy NOTIFY busyChanged )
   Q_PROPERTY( bool isSigned READ isSigned NOTIFY cryptoStateChanged )
   Q_PROPERTY( bool isEncrypted READ isEncrypted NOTIFY cryptoStateChanged )
+  Q_PROPERTY( bool tooManyRecipients READ tooManyRecipients NOTIFY \
recipientsCountChanged ) +  Q_PROPERTY( int recipientsCount READ recipientsCount \
NOTIFY recipientsCountChanged )  
   public:
     explicit ComposerView(QWidget* parent = 0);
@@ -69,6 +71,9 @@
     bool isSigned() const;
     bool isEncrypted() const;
 
+    bool tooManyRecipients() const;
+    int recipientsCount() const;
+
   public slots:
     void setMessage( const KMime::Message::Ptr &msg );
     QObject* getAction( const QString &name ) const;
@@ -89,6 +94,7 @@
     void changed();
     void busyChanged();
     void cryptoStateChanged();
+    void recipientsCountChanged();
 
   protected slots:
     void delayedInit();
--- trunk/KDE/kdepim/mobile/mail/settings.kcfg #1198435:1198436
@@ -32,6 +32,20 @@
     <entry name="ComposerTemplatesReplyToSender" type="String" />
     <entry name="ComposerTemplatesReplyToAll" type="String" />
     <entry name="ComposerTemplatesForwardMessage" type="String" />
+
+    <entry name="TooManyRecipients" type="Bool" key="too-many-recipients">
+      <label>Warn if the number of recipients is larger than</label>
+      <default>true</default>
+      <!-- <default>${WARN_TOOMANY_RECIPIENTS_DEFAULT}</default> -->
+      <whatsthis>If the number of recipients is larger than this value, KMail Mobile \
will warn and ask for a confirmation before sending the mail. The warning can be \
turned off.</whatsthis> +    </entry>
+    <entry name="RecipientThreshold" type="Int" key="recipient-threshold">
+      <label></label>
+      <default>5</default>
+      <min>1</min>
+      <max>100</max>
+      <whatsthis>If the number of recipients is larger than this value, KMail Mobile \
will warn and ask for a confirmation before sending the mail. The warning can be \
turned off.</whatsthis> +    </entry>
   </group>
 
   <group name="Invitations">


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

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