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

List:       kde-commits
Subject:    playground/utils/charm/trunk/Charm
From:       Mirko Boehm <mirko () kde ! org>
Date:       2009-06-16 13:27:26
Message-ID: 1245158846.360263.32397.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 982624 by mirko:

- change prefiltering combobox into to toggle buttons
- one button limits the displayed tasks to the current ones
- one button filters to the subscribed ones


 M  +2 -2      Application.cpp  
 M  +27 -12    TasksView.cpp  
 M  +1 -1      TasksView.h  
 M  +32 -44    TasksView.ui  


--- trunk/playground/utils/charm/trunk/Charm/Application.cpp #982623:982624
@@ -372,7 +372,7 @@
         if (m_controller.connectToBackend())
         {
             // delay switch to Connected state a bit to show the start screen:
-            QTimer::singleShot(1200, this, SLOT(slotGoToConnectedState()));
+            QTimer::singleShot(0, this, SLOT(slotGoToConnectedState()));
         }
         else
         {
@@ -422,7 +422,7 @@
 
 void Application::enterShuttingDownState()
 {
-    QTimer::singleShot(1200, this, SLOT(quit()));
+    QTimer::singleShot(0, this, SLOT(quit()));
 }
 
 void Application::leaveShuttingDownState()
--- trunk/playground/utils/charm/trunk/Charm/TasksView.cpp #982623:982624
@@ -97,15 +97,16 @@
     // filter setup
     connect( m_ui->filterLineEdit, SIGNAL( textChanged( const QString& ) ),
              SLOT( slotFiltertextChanged( const QString& ) ) );
-    connect( m_ui->tasksCombo, SIGNAL( currentIndexChanged( int ) ),
-             SLOT( taskPrefilteringChanged( int ) ) );
+    connect( m_ui->showCurrentOnly, SIGNAL( clicked( bool ) ),
+             SLOT( taskPrefilteringChanged() ) );
+    connect( m_ui->showSubscribedOnly, SIGNAL( clicked( bool ) ),
+             SLOT( taskPrefilteringChanged() ) );
     m_ui->treeView->setContextMenuPolicy( Qt::CustomContextMenu );
     connect( m_ui->treeView, SIGNAL( customContextMenuRequested( const QPoint& ) ),
              SLOT( slotContextMenuRequested( const QPoint& ) ) );
 
     connect( m_ui->treeView, SIGNAL( doubleClicked( const QModelIndex& ) ),
              SLOT( slotItemDoubleClicked( const QModelIndex& ) ) );
-    m_ui->tasksCombo->setCurrentIndex( 0 );
 }
 
 TasksView::~TasksView()
@@ -350,8 +351,11 @@
 
  void TasksView::configurationChanged()
  {
-     Q_ASSERT( CONFIGURATION.taskPrefilteringMode >= 0 && \
                CONFIGURATION.taskPrefilteringMode < m_ui->tasksCombo->count() );
-     m_ui->tasksCombo->setCurrentIndex( CONFIGURATION.taskPrefilteringMode );
+     const Configuration::TaskPrefilteringMode mode = \
CONFIGURATION.taskPrefilteringMode; +     const bool showSubscribedOnly = mode == \
Configuration::TaskPrefilter_SubscribedOnly || mode == \
Configuration::TaskPrefilter_SubscribedAndCurrentOnly; +     const bool \
showCurrentOnly = mode == Configuration::TaskPrefilter_CurrentOnly || mode == \
Configuration::TaskPrefilter_SubscribedAndCurrentOnly; +     \
m_ui->showSubscribedOnly->setChecked( showSubscribedOnly ); +     \
m_ui->showCurrentOnly->setChecked( showCurrentOnly );  
      m_ui->treeView->setFont( configuredFont() );
      m_ui->treeView->header()->hide();
@@ -375,15 +379,26 @@
      if ( ! filtertextRaw.isEmpty() ) m_ui->treeView->expandAll();
  }
 
- void TasksView::taskPrefilteringChanged( int index )
+ void TasksView::taskPrefilteringChanged()
  {
+     // find out about the selected mode:
+     Configuration::TaskPrefilteringMode mode;
+     const bool showCurrentOnly = m_ui->showCurrentOnly->isChecked();
+     const bool showSubscribedOnly = m_ui->showSubscribedOnly->isChecked();
+     if (  showCurrentOnly && showSubscribedOnly ) {
+         mode = Configuration::TaskPrefilter_SubscribedAndCurrentOnly;
+     } else if ( showCurrentOnly && ! showSubscribedOnly ) {
+         mode = Configuration::TaskPrefilter_CurrentOnly;
+     } else if ( ! showCurrentOnly && showSubscribedOnly ) {
+         mode = Configuration::TaskPrefilter_SubscribedOnly;
+     } else {
+         mode = Configuration::TaskPrefilter_ShowAll;
+     }
+
      ViewFilter* filter = Application::instance().model().taskModel();
-     if ( index >= 0 && index < Configuration::TaskPrefilter_NumberOfModes ) {
-         const Configuration::TaskPrefilteringMode mode = \
                static_cast<Configuration::TaskPrefilteringMode>( index );
-         CONFIGURATION.taskPrefilteringMode = mode;
-         filter->prefilteringModeChanged();
-         emit saveConfiguration();
-     }
+     CONFIGURATION.taskPrefilteringMode = mode;
+     filter->prefilteringModeChanged();
+     emit saveConfiguration();
  }
 
  void TasksView::slotContextMenuRequested( const QPoint& point )
--- trunk/playground/utils/charm/trunk/Charm/TasksView.h #982623:982624
@@ -63,7 +63,7 @@
     void actionEditTask();
     void actionDeleteTask();
     void slotFiltertextChanged( const QString& filtertext );
-    void taskPrefilteringChanged( int );
+    void taskPrefilteringChanged();
     void slotContextMenuRequested( const QPoint& );
 
     void slotEventActivated( EventId );
--- trunk/playground/utils/charm/trunk/Charm/TasksView.ui #982623:982624
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>455</width>
-    <height>197</height>
+    <width>359</width>
+    <height>350</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -34,54 +34,43 @@
       </widget>
      </item>
      <item>
-      <spacer>
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
+      <widget class="QToolButton" name="showCurrentOnly">
+       <property name="toolTip">
+        <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; \
&quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; \
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; \
/&gt;&lt;style type=&quot;text/css&quot;&gt; +p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Bitstream Vera Sans'; \
font-size:10pt; font-weight:400; font-style:normal;&quot;&gt; +&lt;p style=&quot; \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;&quot;&gt;Show only &lt;span style=&quot; \
text-decoration: underline;&quot;&gt;current&lt;/span&gt; tasks. Tasks are current \
if&lt;/p&gt; +&lt;ul style=&quot;-qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; \
margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;&quot;&gt;the date they are valid from is in the \
past, or empty,&lt;/li&gt; +&lt;li style=&quot; margin-top:0px; margin-bottom:12px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;and \
if the date they are valid to is in the future, or \
empty.&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>  </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>40</width>
-         <height>20</height>
-        </size>
+       <property name="text">
+        <string>current</string>
        </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QComboBox" name="tasksCombo">
-       <item>
-        <property name="text">
-         <string>All Tasks</string>
-        </property>
-       </item>
-       <item>
-        <property name="text">
-         <string>Current Tasks</string>
-        </property>
-       </item>
-       <item>
-        <property name="text">
-         <string>Subscribed Tasks</string>
-        </property>
-       </item>
-       <item>
-        <property name="text">
-         <string>Current And Subscribed Tasks</string>
-        </property>
-       </item>
+       <property name="checkable">
+        <bool>true</bool>
+       </property>
       </widget>
      </item>
      <item>
-      <spacer>
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
+      <widget class="QToolButton" name="showSubscribedOnly">
+       <property name="toolTip">
+        <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; \
&quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; \
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; \
/&gt;&lt;style type=&quot;text/css&quot;&gt; +p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Bitstream Vera Sans'; \
font-size:10pt; font-weight:400; font-style:normal;&quot;&gt; +&lt;p style=&quot; \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px;&quot;&gt;Show only &lt;span style=&quot; \
text-decoration: underline;&quot;&gt;subscribed&lt;/span&gt; tasks. To subscribe to \
tasks, check the box on the right of the task \
name.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>  </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>0</width>
-         <height>20</height>
-        </size>
+       <property name="text">
+        <string>my tasks</string>
        </property>
-      </spacer>
+       <property name="checkable">
+        <bool>true</bool>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
      </item>
      <item>
       <widget class="QToolButton" name="buttonClearFilter">
@@ -119,7 +108,6 @@
  <tabstops>
   <tabstop>goButton</tabstop>
   <tabstop>stopButton</tabstop>
-  <tabstop>tasksCombo</tabstop>
   <tabstop>filterLineEdit</tabstop>
   <tabstop>buttonClearFilter</tabstop>
   <tabstop>treeView</tabstop>


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

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