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

List:       kde-commits
Subject:    branches/KDE/4.2/kdepim/korganizer
From:       Sergio Luis Martins <iamsergio () gmail ! com>
Date:       2009-05-20 21:48:40
Message-ID: 1242856120.451551.28930.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 970824 by smartins:

Backport r968954 by smartins from trunk to the 4.2 branch:

CalendarView::activeDate() returned the correct date for month view because month \
view's selectedDates() returned the selected cell's date and not the incidence's.

So now that MonthView::selectedDates() does the right thing I moved agenda's \
selectionStart() and selectionEnd() to baseview and implemented it in monthview so it \
can be used to get the selected cell's date.

BaseView::selectedDates() should probably by renamed to \
BaseView::selectedIncidenceDates().


 M  +3 -7      calendarview.cpp  
 M  +13 -0     interfaces/korganizer/baseview.h  
 M  +5 -3      views/agendaview/koagendaview.h  
 M  +15 -0     views/monthview/monthview.cpp  
 M  +4 -0      views/monthview/monthview.h  


--- branches/KDE/4.2/kdepim/korganizer/calendarview.cpp #970823:970824
@@ -326,13 +326,10 @@
 {
   KOrg::BaseView *curView = mViewManager->currentView();
   if ( curView ) {
-    // Only the agenda view has a selectionStart (at this time)
-    KOAgendaView *aView = mViewManager->agendaView();
-    if ( curView == aView && aView->selectionStart().isValid() ) {
-      if ( aView->selectionStart().isValid() ) {
-        return aView->selectionStart().date();
-      }
+    if ( curView->selectionStart().isValid() ) {
+      return curView->selectionStart().date();
     }
+
     // Try the view's selectedDates()
     if ( !curView->selectedDates().isEmpty() ) {
       if ( curView->selectedDates().first().isValid() ) {
@@ -347,7 +344,6 @@
   } else {  
     return mDateNavigator->selectedDates().first();
   }
-
 }
 
 QDate CalendarView::startDate()
--- branches/KDE/4.2/kdepim/korganizer/interfaces/korganizer/baseview.h \
#970823:970824 @@ -89,6 +89,19 @@
     */
     virtual DateList selectedDates() = 0;
 
+    /**
+      Returns the start of the selection, or an invalid QDateTime if there is no \
selection +      or the view doesn't support selecting cells.
+     */
+    virtual QDateTime selectionStart() { return QDateTime(); };
+		
+    /**
+      Returns the end of the selection, or an invalid QDateTime if there is no \
selection +      or the view doesn't support selecting cells.
+     */
+    virtual QDateTime selectionEnd() { return QDateTime(); };
+
+
     virtual CalPrinterBase::PrintType printType();
 
     /**
--- branches/KDE/4.2/kdepim/korganizer/views/agendaview/koagendaview.h #970823:970824
@@ -106,7 +106,7 @@
     /** returns the currently selected events */
     virtual Incidence::List selectedIncidences();
 
-    /** returns the currently selected events */
+    /** returns the currently selected incidence's dates */
     virtual DateList selectedDates();
 
     /** return the default start/end date/time for new events   */
@@ -118,9 +118,11 @@
     CalPrinter::PrintType printType();
 
     /** start-datetime of selection */
-    QDateTime selectionStart() { return mTimeSpanBegin; }
+    virtual QDateTime selectionStart() { return mTimeSpanBegin; }
+
     /** end-datetime of selection */
-    QDateTime selectionEnd() { return mTimeSpanEnd; }
+    virtual QDateTime selectionEnd() { return mTimeSpanEnd; }
+
     /** returns true if selection is for whole day */
     bool selectedIsAllDay() { return mTimeSpanInAllDay; }
     /** make selected start/end invalid */
--- branches/KDE/4.2/kdepim/korganizer/views/monthview/monthview.cpp #970823:970824
@@ -140,6 +140,21 @@
   return list;
 }
 
+QDateTime MonthView::selectionStart()
+{
+  if ( mScene->selectedCell() ) {
+    return QDateTime( mScene->selectedCell()->date() );
+  } else {
+    return QDateTime();
+  }
+}
+
+QDateTime MonthView::selectionEnd()
+{
+  // Only one cell can be selected (for now)
+  return selectionStart();
+}
+
 bool MonthView::eventDurationHint( QDateTime &startDt, QDateTime &endDt, bool \
&allDay )  {
   if ( mScene->selectedCell() ) {
--- branches/KDE/4.2/kdepim/korganizer/views/monthview/monthview.h #970823:970824
@@ -53,6 +53,10 @@
     /** Returns dates of the currently selected events */
     virtual DateList selectedDates();
 
+    virtual QDateTime selectionStart();
+
+    virtual QDateTime selectionEnd();
+
     virtual bool eventDurationHint( QDateTime &startDt, QDateTime &endDt, bool \
&allDay );  
     QDate startDate() const { return mStartDate; }


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

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