Bug 35700

Summary: Select a month instead of a date range when printing the month view
Product: [Applications] korganizer Reporter: Ewout Prangsma <e.prangsma>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: bradh
Priority: NOR    
Version: 2.2.1   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ewout Prangsma 2001-12-03 07:11:13 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           korganizer
Version:           2.2.1 (using KDE 2.2.2 )
Severity:          wishlist
Installed from:    RedHat RPMs
Compiler:          gcc 2.96
OS:                Linux
OS/Compiler notes: Not Specified

When I start the print action a dialog is shown where I must select a date range and a print "view type".
I would expect that when I select the month view type I'm only able to select one (more more) month not a date range.

(Submitted via bugs.kde.org)
Comment 1 Reinhold Kainhofer 2004-06-24 00:50:13 UTC
*** Bug 83688 has been marked as a duplicate of this bug. ***
Comment 2 Reinhold Kainhofer 2006-11-02 19:24:34 UTC
Reassigning all KOrganizer bug reports and wishes to the newly created 
korganizer-devel mailing list.
Comment 3 Reinhold Kainhofer 2007-01-02 01:12:45 UTC
SVN commit 618661 by kainhofe:

Instead of using a date selector to select a month (where the day is completely ignored and thus only confusing), now use a month name combo and a year number spin box for both the start and end month of the printout.

BUG:35700


 M  +21 -7     calprintdefaultplugins.cpp  
 M  +72 -53    calprintmonthconfig_base.ui  


--- branches/KDE/3.5/kdepim/korganizer/printing/calprintdefaultplugins.cpp #618660:618661
@@ -35,6 +35,8 @@
 #include <kdebug.h>
 #include <kconfig.h>
 #include <kcalendarsystem.h>
+#include <knuminput.h>
+#include <kcombobox.h>
 
 #include "calprintdefaultplugins.h"
 
@@ -820,8 +822,8 @@
   CalPrintMonthConfig_Base *cfg =
       dynamic_cast<CalPrintMonthConfig_Base *>( mConfigWidget );
   if ( cfg ) {
-    mFromDate = cfg->mFromDate->date();
-    mToDate = cfg->mToDate->date();
+    mFromDate = QDate( cfg->mFromYear->value(), cfg->mFromMonth->currentItem()+1, 1 );
+    mToDate = QDate( cfg->mToYear->value(), cfg->mToMonth->currentItem()+1, 1 );
 
     mWeekNumbers =  cfg->mWeekNumbers->isChecked();
     mRecurDaily = cfg->mRecurDaily->isChecked();
@@ -835,10 +837,8 @@
 {
   CalPrintMonthConfig_Base *cfg =
       dynamic_cast<CalPrintMonthConfig_Base *>( mConfigWidget );
+  setDateRange( mFromDate, mToDate );
   if ( cfg ) {
-    cfg->mFromDate->setDate( mFromDate );
-    cfg->mToDate->setDate( mToDate );
-
     cfg->mWeekNumbers->setChecked( mWeekNumbers );
     cfg->mRecurDaily->setChecked( mRecurDaily );
     cfg->mRecurWeekly->setChecked( mRecurWeekly );
@@ -874,9 +874,23 @@
   CalPrintPluginBase::setDateRange( from, to );
   CalPrintMonthConfig_Base *cfg =
       dynamic_cast<CalPrintMonthConfig_Base *>( mConfigWidget );
+  const KCalendarSystem *calSys = calendarSystem();
+  if ( cfg && calSys ) {
+    cfg->mFromMonth->clear();
+    for ( int i=0; i<calSys->monthsInYear( mFromDate ); ++i ) {
+      cfg->mFromMonth->insertItem( calSys->monthName( i+1, mFromDate.year() ) );
+    }
+    cfg->mToMonth->clear();
+    for ( int i=0; i<calSys->monthsInYear( mToDate ); ++i ) {
+      cfg->mToMonth->insertItem( calSys->monthName( i+1, mToDate.year() ) );
+    }
+  }
+kdDebug()<<"vor SetSettingsWidget()"<<endl;
   if ( cfg ) {
-    cfg->mFromDate->setDate( from );
-    cfg->mToDate->setDate( to );
+    cfg->mFromMonth->setCurrentItem( from.month()-1 );
+    cfg->mFromYear->setValue( to.year() );
+    cfg->mToMonth->setCurrentItem( mToDate.month()-1 );
+    cfg->mToYear->setValue( mToDate.year() );
   }
 }
 
--- branches/KDE/3.5/kdepim/korganizer/printing/calprintmonthconfig_base.ui #618660:618661
@@ -10,10 +10,13 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>401</width>
-            <height>173</height>
+            <width>431</width>
+            <height>161</height>
         </rect>
     </property>
+    <property name="caption">
+        <string>CalPrintMonth_Base</string>
+    </property>
     <grid>
         <property name="name">
             <cstring>unnamed</cstring>
@@ -45,90 +48,104 @@
             <property name="title">
                 <string>Date &amp;&amp; Time Range</string>
             </property>
-            <grid>
+            <hbox>
                 <property name="name">
                     <cstring>unnamed</cstring>
                 </property>
-                <spacer row="0" column="4">
+                <widget class="QLabel">
                     <property name="name">
-                        <cstring>spacer1</cstring>
+                        <cstring>mFromDateLabel</cstring>
                     </property>
-                    <property name="orientation">
-                        <enum>Horizontal</enum>
+                    <property name="text">
+                        <string>&amp;Start month:</string>
                     </property>
-                    <property name="sizeType">
-                        <enum>Expanding</enum>
+                    <property name="buddy" stdset="0">
+                        <cstring>mFromMonth</cstring>
                     </property>
-                    <property name="sizeHint">
-                        <size>
-                            <width>17</width>
-                            <height>21</height>
-                        </size>
+                    <property name="whatsThis" stdset="0">
+                        <string>When you want to print more months at once, you can define a month range. This option defines the first month to be printed. Use the option &lt;i&gt;End month&lt;/i&gt; to define the last month in this range.</string>
                     </property>
-                </spacer>
-                <widget class="QLabel" row="0" column="2">
+                </widget>
+                <widget class="KComboBox">
                     <property name="name">
+                        <cstring>mFromMonth</cstring>
+                    </property>
+                    <property name="whatsThis" stdset="0">
+                        <string>When you want to print more months at once, you can define a month range. This option defines the fi
+rst month to be printed. Use the option &amp;lt;i&amp;gt;End month&amp;lt;/i&amp;gt; to define the last month in this range.</string>
+                    </property>
+                </widget>
+                <widget class="KIntSpinBox">
+                    <property name="name">
+                        <cstring>mFromYear</cstring>
+                    </property>
+                    <property name="maxValue">
+                        <number>3000</number>
+                    </property>
+                    <property name="value">
+                        <number>2007</number>
+                    </property>
+                    <property name="whatsThis" stdset="0">
+                        <string>When you want to print more months at once, you can define a month range. This option defines the fi
+rst month to be printed. Use the option &amp;lt;i&amp;gt;End month&amp;lt;/i&amp;gt; to define the last month in this range.</string>
+                    </property>
+                </widget>
+                <widget class="QLabel">
+                    <property name="name">
                         <cstring>mToDateLabel</cstring>
                     </property>
                     <property name="text">
                         <string>&amp;End month:</string>
                     </property>
                     <property name="buddy" stdset="0">
-                        <cstring>mToDate</cstring>
+                        <cstring>mToMonth</cstring>
                     </property>
                     <property name="whatsThis" stdset="0">
                         <string>When you want to print more months at once, you can define a month range. This option defines the last month to be printed. Use the option &lt;i&gt;Start month&lt;/i&gt; to define the first month in this range.</string>
                     </property>
                 </widget>
-                <widget class="QLabel" row="0" column="0">
+                <widget class="KComboBox">
                     <property name="name">
-                        <cstring>mFromDateLabel</cstring>
+                        <cstring>mToMonth</cstring>
                     </property>
-                    <property name="text">
-                        <string>&amp;Start month:</string>
-                    </property>
-                    <property name="buddy" stdset="0">
-                        <cstring>mFromDate</cstring>
-                    </property>
                     <property name="whatsThis" stdset="0">
-                        <string>When you want to print more months at once, you can define a month range. This option defines the first month to be printed. Use the option &lt;i&gt;End month&lt;/i&gt; to define the last month in this range.</string>
+                        <string>When you want to print more months at once, you can define a month range. This option defines the la
+st month to be printed. Use the option &amp;lt;i&amp;gt;Start month&amp;lt;/i&amp;gt; to define the first month in this range.</string>
                     </property>
                 </widget>
-                <widget class="KDateEdit" row="0" column="3">
+                <widget class="KIntSpinBox">
                     <property name="name">
-                        <cstring>mToDate</cstring>
+                        <cstring>mToYear</cstring>
                     </property>
-                    <property name="minimumSize">
-                        <size>
-                            <width>50</width>
-                            <height>0</height>
-                        </size>
+                    <property name="maxValue">
+                        <number>3000</number>
                     </property>
-                    <property name="focusPolicy">
-                        <enum>StrongFocus</enum>
+                    <property name="value">
+                        <number>2007</number>
                     </property>
                     <property name="whatsThis" stdset="0">
-                        <string>When you want to print more months at once, you can define a month range. This option defines the last month to be printed. Use the option &lt;i&gt;Start month&lt;/i&gt; to define the first month in this range.</string>
+                        <string>When you want to print more months at once, you can define a month range. This option defines the la
+st month to be printed. Use the option &amp;lt;i&amp;gt;Start month&amp;lt;/i&amp;gt; to define the first month in this range.</string>
                     </property>
                 </widget>
-                <widget class="KDateEdit" row="0" column="1">
+                <spacer>
                     <property name="name">
-                        <cstring>mFromDate</cstring>
+                        <cstring>spacer1</cstring>
                     </property>
-                    <property name="minimumSize">
+                    <property name="orientation">
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property name="sizeType">
+                        <enum>Expanding</enum>
+                    </property>
+                    <property name="sizeHint">
                         <size>
-                            <width>50</width>
-                            <height>0</height>
+                            <width>17</width>
+                            <height>21</height>
                         </size>
                     </property>
-                    <property name="focusPolicy">
-                        <enum>StrongFocus</enum>
-                    </property>
-                    <property name="whatsThis" stdset="0">
-                        <string>When you want to print more months at once, you can define a month range. This option defines the first month to be printed.</string>
-                    </property>
-                </widget>
-            </grid>
+                </spacer>
+            </hbox>
         </widget>
         <widget class="QCheckBox" row="4" column="0">
             <property name="name">
@@ -179,9 +196,9 @@
         </widget>
     </grid>
 </widget>
+<customwidgets>
+</customwidgets>
 <tabstops>
-    <tabstop>mFromDate</tabstop>
-    <tabstop>mToDate</tabstop>
     <tabstop>mWeekNumbers</tabstop>
     <tabstop>mRecurDaily</tabstop>
     <tabstop>mRecurWeekly</tabstop>
@@ -192,7 +209,9 @@
 </includes>
 <layoutdefaults spacing="6" margin="11"/>
 <includehints>
-    <includehint>libkdepim/kdateedit.h</includehint>
-    <includehint>libkdepim/kdateedit.h</includehint>
+    <includehint>kcombobox.h</includehint>
+    <includehint>knuminput.h</includehint>
+    <includehint>kcombobox.h</includehint>
+    <includehint>knuminput.h</includehint>
 </includehints>
 </UI>