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

List:       kde-commits
Subject:    branches/work/akonadi-ports/kdepim/korganizer
From:       Bertjan Broeksema <b.broeksema () home ! nl>
Date:       2009-11-13 15:30:01
Message-ID: 1258126201.624873.32750.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1048588 by bbroeksema:

Make selecting the right collection work for the following cases:
* Press enter in a (Multi)CalendarView
* Start entering text in a (Multi)CalendarView

Does not work yet for:
* Selecting "New Event" from RMB menu
* Selecting "New Event" from the tool bar
* Evertyhing that is not an event (i.e. todos, journals)


 M  +23 -7     calendarview.cpp  
 M  +9 -4      calendarview.h  
 M  +6 -5      interfaces/korganizer/baseview.h  
 M  +19 -2     koeventview.cpp  
 M  +9 -8      koviewmanager.cpp  
 M  +5 -0      views/agendaview/koagendaview.cpp  
 M  +1 -0      views/agendaview/koagendaview.h  
 M  +10 -8     views/multiagendaview/multiagendaview.cpp  
 M  +1 -1      views/timelineview/kotimelineview.cpp  


--- branches/work/akonadi-ports/kdepim/korganizer/calendarview.cpp #1048587:1048588
@@ -973,23 +973,36 @@
 
 void CalendarView::newEvent()
 {
-  newEvent( QDateTime(), QDateTime() );
+  newEvent( Akonadi::Collection::List(), QDateTime(), QDateTime() );
 }
 
-void CalendarView::newEvent( const QDate &dt )
+void CalendarView::newEvent( const QDateTime &startDt )
 {
+  newEvent( Akonadi::Collection::List(), startDt, QDateTime() );
+}
+
+void CalendarView::newEvent( const Akonadi::Collection::List &selectedCollections )
+{
+  newEvent( selectedCollections, QDateTime(), QDateTime() );
+}
+
+void CalendarView::newEvent(  const Akonadi::Collection::List &selectedCollections, \
const QDate &dt ) +{
   QDateTime startDt( dt, KOPrefs::instance()->mStartTime.time() );
-  return newEvent( QDateTime( dt ), QDateTime() );
+  return newEvent( selectedCollections, QDateTime( dt ), QDateTime() );
 }
 
-void CalendarView::newEvent( const QDateTime &startDt )
+void CalendarView::newEvent(  const Akonadi::Collection::List &selectedCollections, \
const QDateTime &startDt )  {
-  return newEvent( startDt, QDateTime() );
+  return newEvent( selectedCollections, startDt, QDateTime() );
 }
 
-void CalendarView::newEvent( const QDateTime &startDt, const QDateTime &endDt, bool \
allDay ) +void CalendarView::newEvent(  const Akonadi::Collection::List \
&selectedCollections, +                              const QDateTime &startDt, const \
QDateTime &endDt, bool allDay )  {
   KOEventEditor *eventEditor = newEventEditor( startDt, endDt, allDay );
+  if ( !selectedCollections.isEmpty() )
+    eventEditor->selectCollection( selectedCollections.first() );
   eventEditor->show();
 }
 
@@ -1104,7 +1117,9 @@
 void CalendarView::newFloatingEvent()
 {
   QDate date = activeDate();
-  newEvent( QDateTime( date, QTime( 12, 0, 0 ) ),
+  // TODO_BERTJAN: Find out from where this is called and see if we can get a \
reasonable default collection +  newEvent( Akonadi::Collection::List(),
+            QDateTime( date, QTime( 12, 0, 0 ) ),
             QDateTime( date, QTime( 12, 0, 0 ) ), true );
 }
 
@@ -2363,6 +2378,7 @@
 
 void CalendarView::connectIncidenceEditor( KOIncidenceEditor *editor )
 {
+  // TODO_BERTJAN: Remove, should be set already at this point.
   if ( currentView()->collectionSelection()->hasSelection() )
     editor->selectCollection( \
currentView()->collectionSelection()->selectedCollections().first() );  
--- branches/work/akonadi-ports/kdepim/korganizer/calendarview.h #1048587:1048588
@@ -287,15 +287,20 @@
 
     void connectIncidenceEditor( KOIncidenceEditor * );
 
+    /** create new event without having a hint for the calendar. */
+    void newEvent();
+    void newEvent( const QDateTime & );
+
     /** create new event without having a date hint. Takes current date as
      default hint. */
-    void newEvent();
+    void newEvent( const Akonadi::Collection::List &selectedCollections );
 
     /** create an editeventwin with supplied date/time, and if bool is true,
      * make the event take all day. */
-    void newEvent( const QDate &startDt );
-    void newEvent( const QDateTime &startDt );
-    void newEvent( const QDateTime &startDt, const QDateTime &EndDt, bool \
allDay=false ); +    void newEvent( const Akonadi::Collection::List \
&selectedCollections, const QDate &startDt ); +    void newEvent( const \
Akonadi::Collection::List &selectedCollections, const QDateTime &startDt ); +    void \
newEvent( const Akonadi::Collection::List &selectedCollections, +                   \
const QDateTime &startDt, const QDateTime &EndDt, bool allDay=false );  
     /**
       Create new Event from given summary, description, attachment list and
--- branches/work/akonadi-ports/kdepim/korganizer/interfaces/korganizer/baseview.h \
#1048587:1048588 @@ -32,6 +32,7 @@
 #include <kdebug.h>
 #include <kmessagebox.h>
 
+#include <Akonadi/Collection>
 #include <Akonadi/Item>
 
 #include <QtCore/QPair>
@@ -314,26 +315,26 @@
     void endMultiModify();
 
     /**
-     * instructs the receiver to create a new event.  Doesn't make
+     * instructs the receiver to create a new event in given collection. Doesn't \
                make
      * sense to connect to more than one receiver.
      */
-    void newEventSignal();
+    void newEventSignal( const Akonadi::Collection::List & );
     /**
      * instructs the receiver to create a new event with the specified beginning
      * time. Doesn't make sense to connect to more than one receiver.
      */
-    void newEventSignal( const QDate & );
+    void newEventSignal( const Akonadi::Collection::List &, const QDate & );
     /**
      * instructs the receiver to create a new event with the specified beginning
      * time. Doesn't make sense to connect to more than one receiver.
      */
-    void newEventSignal( const QDateTime & );
+    void newEventSignal( const Akonadi::Collection::List &, const QDateTime & );
     /**
      * instructs the receiver to create a new event, with the specified
      * beginning end ending times.  Doesn't make sense to connect to more
      * than one receiver.
      */
-    void newEventSignal( const QDateTime &, const QDateTime & );
+    void newEventSignal( const Akonadi::Collection::List &, const QDateTime &, const \
QDateTime & );  
     void newTodoSignal( const QDate & );
     void newSubTodoSignal( const Akonadi::Item & );
--- branches/work/akonadi-ports/kdepim/korganizer/koeventview.cpp #1048587:1048588
@@ -25,12 +25,14 @@
 
 #include "koeventview.h"
 #include "kocore.h"
+#include "views/agendaview/koagendaview.h" // TODO AKONADI_PORT
 #include "koprefs.h"
 #include "koeventpopupmenu.h"
 #include "komessagebox.h"
 
 #include <Akonadi/Item>
 
+#include <akonadi/kcal/collectionselection.h>
 #include <akonadi/kcal/utils.h>
 
 #include <QApplication>
@@ -221,7 +223,15 @@
       mReturnPressed = true;
     } else if ( ke->type() == QEvent::KeyRelease ) {
       if ( mReturnPressed ) {
-        emit newEventSignal();
+        // TODO(AKONADI_PORT) Remove this hack when the calendarview is ported to \
CalendarSearch +        if ( KOAgendaView *view = dynamic_cast<KOAgendaView*>( this ) \
) { +          if ( view->collection() >= 0 )
+            emit newEventSignal( Akonadi::Collection::List() << Collection( \
view->collection() ) ); +          else
+            emit newEventSignal( collectionSelection()->selectedCollections() );
+        } else
+          emit newEventSignal( collectionSelection()->selectedCollections() );
+
         mReturnPressed = false;
         return true;
       } else {
@@ -266,7 +276,14 @@
                        static_cast<ushort>( ke->count() ) ) );
       if ( !mTypeAhead ) {
         mTypeAhead = true;
-        emit newEventSignal();
+        // TODO(AKONADI_PORT) Remove this hack when the calendarview is ported to \
CalendarSearch +        if ( KOAgendaView *view = dynamic_cast<KOAgendaView*>( this ) \
) { +          if ( view->collection() >= 0 )
+            emit newEventSignal( Akonadi::Collection::List() << Collection( \
view->collection() ) ); +          else
+            emit newEventSignal( collectionSelection()->selectedCollections() );
+        } else
+          emit newEventSignal( collectionSelection()->selectedCollections() );
       }
       return true;
     }
--- branches/work/akonadi-ports/kdepim/korganizer/koviewmanager.cpp #1048587:1048588
@@ -268,14 +268,15 @@
            mMainView, SLOT(dissociateOccurrences(Akonadi::Item,QDate)) );
 
   // signals to create new incidences
-  connect( view, SIGNAL(newEventSignal()),
-           mMainView, SLOT(newEvent()) );
-  connect( view, SIGNAL(newEventSignal(QDateTime)),
-           mMainView, SLOT(newEvent(QDateTime)) );
-  connect( view, SIGNAL(newEventSignal(QDateTime, QDateTime)),
-           mMainView, SLOT(newEvent(QDateTime,QDateTime)) );
-  connect( view, SIGNAL(newEventSignal(QDate)),
-           mMainView, SLOT(newEvent(QDate)) );
+  connect( view, SIGNAL(newEventSignal(Akonadi::Collection::List)),
+           mMainView, SLOT(newEvent(Akonadi::Collection::List)) );
+  connect( view, SIGNAL(newEventSignal(Akonadi::Collection::List,QDateTime)),
+           mMainView, SLOT(newEvent(Akonadi::Collection::List,QDateTime)) );
+  connect( view, SIGNAL(newEventSignal(Akonadi::Collection::List,QDateTime, \
QDateTime)), +           mMainView, \
SLOT(newEvent(Akonadi::Collection::List,QDateTime,QDateTime)) ); +  connect( view, \
SIGNAL(newEventSignal(Akonadi::Collection::List,QDate)), +           mMainView, \
SLOT(newEvent(Akonadi::Collection::List,QDate)) ); +
   connect( view, SIGNAL(newTodoSignal(QDate)),
            mMainView, SLOT(newTodo(QDate)) );
   connect( view, SIGNAL(newSubTodoSignal(Akonadi::Item)),
--- branches/work/akonadi-ports/kdepim/korganizer/views/agendaview/koagendaview.cpp \
#1048587:1048588 @@ -1664,6 +1664,11 @@
   mCollectionId = coll;
 }
 
+Akonadi::Collection::Id KOAgendaView::collection() const
+{
+  return mCollectionId;
+}
+
 bool KOAgendaView::filterByCollectionSelection( const Item &incidence )
 {
   if ( customCollectionSelection() ) {
--- branches/work/akonadi-ports/kdepim/korganizer/views/agendaview/koagendaview.h \
#1048587:1048588 @@ -146,6 +146,7 @@
     /** Show only incidences from the given collection selection. */
 //    void setCollectionSelection( CollectionSelection* selection );
     void setCollection( Akonadi::Collection::Id id );
+    Akonadi::Collection::Id collection() const;
 
     KOAgenda *agenda() const { return mAgenda; }
     QSplitter *splitter() const { return mSplitterAgenda; }
--- branches/work/akonadi-ports/kdepim/korganizer/views/multiagendaview/multiagendaview.cpp \
#1048587:1048588 @@ -204,8 +204,8 @@
 void MultiAgendaView::setupViews()
 {
   foreach ( KOAgendaView *agenda, mAgendaViews ) {
-    connect( agenda, SIGNAL(newEventSignal()),
-             SIGNAL(newEventSignal()) );
+    connect( agenda, SIGNAL(newEventSignal(Akonadi::Collection::List)),
+             SIGNAL(newEventSignal(Akonadi::Collection::List)) );
     connect( agenda, SIGNAL(editIncidenceSignal(Akonadi::Item)),
              SIGNAL(editIncidenceSignal(Akonadi::Item)) );
     connect( agenda, SIGNAL(showIncidenceSignal(Akonadi::Item)),
@@ -230,12 +230,14 @@
              SIGNAL(toggleAlarmSignal(Akonadi::Item)) );
     connect( agenda, SIGNAL(dissociateOccurrencesSignal(Akonadi::Item, const \
                QDate&)),
              SIGNAL(dissociateOccurrencesSignal(Akonadi::Item, const QDate&)) );
-    connect( agenda, SIGNAL(newEventSignal(const QDate&)),
-             SIGNAL(newEventSignal(const QDate&)) );
-    connect( agenda, SIGNAL(newEventSignal(const QDateTime&)),
-             SIGNAL(newEventSignal(const QDateTime&)) );
-    connect( agenda, SIGNAL(newEventSignal(const QDateTime&, const QDateTime&)),
-             SIGNAL(newEventSignal(const QDateTime&, const QDateTime&)) );
+
+    connect( agenda, SIGNAL(newEventSignal(Akonadi::Collection::List,const QDate&)),
+             SIGNAL(newEventSignal(Akonadi::Collection::List,const QDate&)) );
+    connect( agenda, SIGNAL(newEventSignal(Akonadi::Collection::List,const \
QDateTime&)), +             SIGNAL(newEventSignal(Akonadi::Collection::List,const \
QDateTime&)) ); +    connect( agenda, \
SIGNAL(newEventSignal(Akonadi::Collection::List,const QDateTime&, const QDateTime&)), \
+             SIGNAL(newEventSignal(Akonadi::Collection::List,const QDateTime&, const \
QDateTime&)) ); +
     connect( agenda, SIGNAL(newTodoSignal(const QDate&)),
              SIGNAL(newTodoSignal(const QDate&)) );
 
--- branches/work/akonadi-ports/kdepim/korganizer/views/timelineview/kotimelineview.cpp \
#1048587:1048588 @@ -225,7 +225,7 @@
 void KOTimelineView::newEventWithHint( const QDateTime &dt )
 {
   mHintDate = dt;
-  emit newEventSignal( dt );
+  emit newEventSignal( collectionSelection()->selectedCollections(), dt );
 }
 
 TimelineItem *KOTimelineView::calendarItemForIncidence( const Item &incidence )


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

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