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

List:       kde-commits
Subject:    Re: branches/work/nokia-pim-suite/trunk/calendar
From:       Alexis_Ménard <menard () kde ! org>
Date:       2009-02-04 12:04:54
Message-ID: 81941aea0902040404hf895ea8r41074d8cb6d9d3ca () mail ! gmail ! com
[Download RAW message or body]

On Wed, Feb 4, 2009 at 12:59 PM, Karim Dembele <dembele.karim@gmail.com>wrote:

> SVN commit 921042 by dembele:
>
> completing ressource switching
>
>
>  M  +1 -1      calendar.kcfg
>  M  +1 -0      models/eventlistmodel.cpp
>  M  +6 -3      models/eventmodel.cpp
>  M  +1 -1      models/eventmodel.h
>  M  +15 -1     views/calendarView.cpp
>  M  +4 -2      views/calendarView.h
>  M  +11 -2     views/configwindow.cpp
>
>
> --- branches/work/nokia-pim-suite/trunk/calendar/calendar.kcfg
> #921041:921042
> @@ -17,7 +17,7 @@
>
>     <entry type="Int" key="ressource_number" name="NumResource">
>       <whatsthis>The ressource number</whatsthis>
> -      <default>3</default>
> +      <default>-1</default>
>     </entry>
>
>     <entry type="String" key="user_name" name="UserName">
> --- branches/work/nokia-pim-suite/trunk/calendar/models/eventlistmodel.cpp
> #921041:921042
> @@ -36,6 +36,7 @@
>  EventListModel::EventListModel(QObject *parent) : EventModel(parent)
>  {
>   //collection setting
> +   kDebug() <<"DDDDDDDDDDDDDDDDDDDd" << CalPrefs::numResource();


Please remove this debug or put a more explicit name.


>
>   Akonadi::Collection collectionItems(CalPrefs::numResource());
>   setCollection( collectionItems );
>  }
> --- branches/work/nokia-pim-suite/trunk/calendar/models/eventmodel.cpp
> #921041:921042
> @@ -52,9 +52,7 @@
>   : KCalModel( parent ),
>     d( new Private() )
>  {
> -      //collection setting
> -  Akonadi::Collection collectionItems(CalPrefs::numResource());
> -  setCollection( collectionItems );
> +  setCollectionById (CalPrefs::numResource());
>  }
>
>
> @@ -68,6 +66,11 @@
>   return 8;
>  }
>
> +void EventModel::setCollectionById (int id_col){
> +  Akonadi::Collection collectionItems(id_col);
> +  setCollection( collectionItems );
> +}
> +
>  QVariant EventModel::data( const QModelIndex &index,  int role ) const
>  {
>   if ( role == ItemModel::IdRole )
> --- branches/work/nokia-pim-suite/trunk/calendar/models/eventmodel.h
> #921041:921042
> @@ -57,7 +57,7 @@
>     virtual int columnCount( const QModelIndex & parent = QModelIndex() )
> const;
>     virtual QVariant data( const QModelIndex & index, int role =
> Qt::DisplayRole ) const;
>     virtual QVariant headerData( int section, Qt::Orientation orientation,
> int role = Qt::DisplayRole ) const;
> -
> +    void setCollectionById (int);
>   private:
>     class Private;
>     Private* const d;
> --- branches/work/nokia-pim-suite/trunk/calendar/views/calendarView.cpp
> #921041:921042
> @@ -70,10 +70,13 @@
>   Akonadi::Control::start();
>   //setting up the graphical user interface
>   ui.setupUi(this);//ui must be inilized
> +
> +  CalPrefs::setNumResource(-1);
> +
>   //modelcreating
>   events = new NPSCal::EventListModel(this);
>
> -
> +  ressourceCheck();
>   //date seting
>   currentWeekDay = QDate::currentDate();
>   currentWeekStart =  currentWeekDay.addDays(-
> QDate::currentDate().dayOfWeek() +1);
> @@ -114,6 +117,17 @@
>   //TODO manage the day passed
>  }
>
> +void NPSCal::CalendarView::ressourceCheck(){
> +    if (CalPrefs::numResource() == -1){
> +      QMessageBox qm(this);
> +      qm.addButton(QMessageBox::Ok);
> +      qm.setText (i18n("Calendar has not resource. Please choose one in
> 'General' Panel. If you haven't got a resource, create a new one !"));
> +      qm.setWindowTitle (i18n("Calendar Ressource"));
> +      qm.exec();
> +      slotShowConfigDialog();
> +    }
> +}
> +
>  void NPSCal::CalendarView::slotCopyIncidence(Incidence *i){
>   incidenceForCut = false;
>    kDebug() << "Incidence copy or cutted" << i->summary () ;
> --- branches/work/nokia-pim-suite/trunk/calendar/views/calendarView.h
> #921041:921042
> @@ -83,6 +83,8 @@
>   void setupActions();
>   /**return the event model*/
>   void getEventModel();
> +  /**check if ressource is valid and force choosing one*/
> +  void ressourceCheck();
>
>   QDate currentWeekStart;
>   QDate currentWeekEnd;
> @@ -99,7 +101,7 @@
>
>   bool incidenceForCut;
>   QAction * pasteAction;
> -
> +


Please avoid this kind of diff + and - which are the same.
You can run svn diff before committing.


>
>  public:
>
>   CalendarView(QWidget * parent = 0);
> @@ -112,7 +114,7 @@
>   QDate getCurrentDay();
>   /**getter of selection popup*/
>   QMenu * getSelectionPopup();
> -
> +
>  public Q_SLOTS:
>   /**delete an event*/
>   void slotDeleteEvent(Incidence *);
> --- branches/work/nokia-pim-suite/trunk/calendar/views/configwindow.cpp
> #921041:921042
> @@ -25,6 +25,9 @@
>  #include "calprefs_base.h"
>  #include "../calendar/models/eventlistmodel.h"
>
> +#include <akonadi/collection.h>
> +
> +
>  #include <akonadi/transactionsequence.h>
>  #include <akonadi/itemcreatejob.h>
>
> @@ -43,10 +46,12 @@
>  #include <QTreeWidget>
>
>  using namespace NPSCal;
> +using namespace Akonadi;
>
>  NPSCal::ConfigWindow::ConfigWindow(NPSCal::EventListModel* pevents,
> QWidget *parent,  const QString &name)
>  :KConfigDialog(parent, "Calendar Settings", CalPrefs::self())
>  {
> +  events = pevents;
>
>   setWindowModality (Qt::ApplicationModal);
>
> @@ -70,7 +75,9 @@
>
>   //connects
>   connect( generalui.addResourcePushButton, SIGNAL( clicked() ), this,
> SLOT( slotCreateNewResource() ) );
> -
> +  connect( this, SIGNAL( applyClicked() ), this, SLOT( slotApply() ) );
> +  connect( this, SIGNAL( defaultClicked() ), this, SLOT( slotDefault() )
> );
> +  connect( this, SIGNAL( okClicked() ), this, SLOT( slotApply() ) );
>
>
>
> @@ -148,12 +155,14 @@
>  void NPSCal::ConfigWindow::slotApply(){
>   //Setting values
>   CalPrefs::setNumResource(generalui.resources->itemData
> (generalui.resources->currentIndex ()
> ,Akonadi::CollectionModel::CollectionIdRole).value<int>()); //The first one
> is selected
> -
>   CalPrefs::self()->writeConfig();
> +  events->setCollectionById(CalPrefs::numResource());
> +//   KConfigDialog::slotApply();
>  }
>  void NPSCal::ConfigWindow::slotDefault(){
>   CalPrefs::self()->setDefaults ();
>   CalPrefs::self()->writeConfig();
> +//   KConfigDialog::slotDefault();
>  }
>
>
>

[Attachment #3 (text/html)]

<br><br><div class="gmail_quote">On Wed, Feb 4, 2009 at 12:59 PM, Karim Dembele <span \
dir="ltr">&lt;<a href="mailto:dembele.karim@gmail.com">dembele.karim@gmail.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> SVN commit 921042 by \
dembele:<br> <br>
completing ressource switching<br>
<br>
<br>
&nbsp;M &nbsp;+1 -1 &nbsp; &nbsp; &nbsp;calendar.kcfg<br>
&nbsp;M &nbsp;+1 -0 &nbsp; &nbsp; &nbsp;models/eventlistmodel.cpp<br>
&nbsp;M &nbsp;+6 -3 &nbsp; &nbsp; &nbsp;models/eventmodel.cpp<br>
&nbsp;M &nbsp;+1 -1 &nbsp; &nbsp; &nbsp;models/eventmodel.h<br>
&nbsp;M &nbsp;+15 -1 &nbsp; &nbsp; views/calendarView.cpp<br>
&nbsp;M &nbsp;+4 -2 &nbsp; &nbsp; &nbsp;views/calendarView.h<br>
&nbsp;M &nbsp;+11 -2 &nbsp; &nbsp; views/configwindow.cpp<br>
<br>
<br>
--- branches/work/nokia-pim-suite/trunk/calendar/calendar.kcfg #921041:921042<br>
@@ -17,7 +17,7 @@<br>
<br>
 &nbsp; &nbsp; &lt;entry type=&quot;Int&quot; key=&quot;ressource_number&quot; \
name=&quot;NumResource&quot;&gt;<br>  &nbsp; &nbsp; &nbsp; &lt;whatsthis&gt;The \
                ressource number&lt;/whatsthis&gt;<br>
- &nbsp; &nbsp; &nbsp;&lt;default&gt;3&lt;/default&gt;<br>
+ &nbsp; &nbsp; &nbsp;&lt;default&gt;-1&lt;/default&gt;<br>
 &nbsp; &nbsp; &lt;/entry&gt;<br>
<br>
 &nbsp; &nbsp; &lt;entry type=&quot;String&quot; key=&quot;user_name&quot; \
                name=&quot;UserName&quot;&gt;<br>
--- branches/work/nokia-pim-suite/trunk/calendar/models/eventlistmodel.cpp \
#921041:921042<br> @@ -36,6 +36,7 @@<br>
&nbsp;EventListModel::EventListModel(QObject *parent) : EventModel(parent)<br>
&nbsp;{<br>
 &nbsp; //collection setting<br>
+ &nbsp; kDebug() &lt;&lt;&quot;DDDDDDDDDDDDDDDDDDDd&quot; &lt;&lt; \
CalPrefs::numResource();</blockquote><div><br>Please remove this debug or put a more \
explicit name.<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px \
solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <br>
 &nbsp; Akonadi::Collection collectionItems(CalPrefs::numResource());<br>
 &nbsp; setCollection( collectionItems );<br>
&nbsp;}<br>
--- branches/work/nokia-pim-suite/trunk/calendar/models/eventmodel.cpp \
#921041:921042<br> @@ -52,9 +52,7 @@<br>
 &nbsp; : KCalModel( parent ),<br>
 &nbsp; &nbsp; d( new Private() )<br>
&nbsp;{<br>
- &nbsp; &nbsp; &nbsp;//collection setting<br>
- &nbsp;Akonadi::Collection collectionItems(CalPrefs::numResource());<br>
- &nbsp;setCollection( collectionItems );<br>
+ &nbsp;setCollectionById (CalPrefs::numResource());<br>
&nbsp;}<br>
<br>
<br>
@@ -68,6 +66,11 @@<br>
 &nbsp; return 8;<br>
&nbsp;}<br>
<br>
+void EventModel::setCollectionById (int id_col){<br>
+ &nbsp;Akonadi::Collection collectionItems(id_col);<br>
+ &nbsp;setCollection( collectionItems );<br>
+}<br>
+<br>
&nbsp;QVariant EventModel::data( const QModelIndex &amp;index, &nbsp;int role ) \
const<br> &nbsp;{<br>
 &nbsp; if ( role == ItemModel::IdRole )<br>
--- branches/work/nokia-pim-suite/trunk/calendar/models/eventmodel.h \
#921041:921042<br> @@ -57,7 +57,7 @@<br>
 &nbsp; &nbsp; virtual int columnCount( const QModelIndex &amp; parent = \
QModelIndex() ) const;<br>  &nbsp; &nbsp; virtual QVariant data( const QModelIndex \
&amp; index, int role = Qt::DisplayRole ) const;<br>  &nbsp; &nbsp; virtual QVariant \
headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) \
                const;<br>
-<br>
+ &nbsp; &nbsp;void setCollectionById (int);<br>
 &nbsp; private:<br>
 &nbsp; &nbsp; class Private;<br>
 &nbsp; &nbsp; Private* const d;<br>
--- branches/work/nokia-pim-suite/trunk/calendar/views/calendarView.cpp \
#921041:921042<br> @@ -70,10 +70,13 @@<br>
 &nbsp; Akonadi::Control::start();<br>
 &nbsp; //setting up the graphical user interface<br>
 &nbsp; ui.setupUi(this);//ui must be inilized<br>
+<br>
+ &nbsp;CalPrefs::setNumResource(-1);<br>
+<br>
 &nbsp; //modelcreating<br>
 &nbsp; events = new NPSCal::EventListModel(this);<br>
<br>
-<br>
+ &nbsp;ressourceCheck();<br>
 &nbsp; //date seting<br>
 &nbsp; currentWeekDay = QDate::currentDate();<br>
 &nbsp; currentWeekStart = &nbsp;currentWeekDay.addDays(- \
QDate::currentDate().dayOfWeek() +1);<br> @@ -114,6 +117,17 @@<br>
 &nbsp; //TODO manage the day passed<br>
&nbsp;}<br>
<br>
+void NPSCal::CalendarView::ressourceCheck(){<br>
+ &nbsp; &nbsp;if (CalPrefs::numResource() == -1){<br>
+ &nbsp; &nbsp; &nbsp;QMessageBox qm(this);<br>
+ &nbsp; &nbsp; &nbsp;qm.addButton(QMessageBox::Ok);<br>
+ &nbsp; &nbsp; &nbsp;qm.setText (i18n(&quot;Calendar has not resource. Please choose \
one in &#39;General&#39; Panel. If you haven&#39;t got a resource, create a new one \
!&quot;));<br> + &nbsp; &nbsp; &nbsp;qm.setWindowTitle (i18n(&quot;Calendar \
Ressource&quot;));<br> + &nbsp; &nbsp; &nbsp;qm.exec();<br>
+ &nbsp; &nbsp; &nbsp;slotShowConfigDialog();<br>
+ &nbsp; &nbsp;}<br>
+}<br>
+<br>
&nbsp;void NPSCal::CalendarView::slotCopyIncidence(Incidence *i){<br>
 &nbsp; incidenceForCut = false;<br>
 &nbsp; &nbsp;kDebug() &lt;&lt; &quot;Incidence copy or cutted&quot; &lt;&lt; \
                i-&gt;summary () ;<br>
--- branches/work/nokia-pim-suite/trunk/calendar/views/calendarView.h \
#921041:921042<br> @@ -83,6 +83,8 @@<br>
 &nbsp; void setupActions();<br>
 &nbsp; /**return the event model*/<br>
 &nbsp; void getEventModel();<br>
+ &nbsp;/**check if ressource is valid and force choosing one*/<br>
+ &nbsp;void ressourceCheck();<br>
<br>
 &nbsp; QDate currentWeekStart;<br>
 &nbsp; QDate currentWeekEnd;<br>
@@ -99,7 +101,7 @@<br>
<br>
 &nbsp; bool incidenceForCut;<br>
 &nbsp; QAction * pasteAction;<br>
-<br>
+</blockquote><div><br>Please avoid this kind of diff + and - which are the \
same.<br>You can run svn diff before committing.<br>&nbsp;</div><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> <br>
&nbsp;public:<br>
<br>
 &nbsp; CalendarView(QWidget * parent = 0);<br>
@@ -112,7 +114,7 @@<br>
 &nbsp; QDate getCurrentDay();<br>
 &nbsp; /**getter of selection popup*/<br>
 &nbsp; QMenu * getSelectionPopup();<br>
-<br>
+<br>
&nbsp;public Q_SLOTS:<br>
 &nbsp; /**delete an event*/<br>
 &nbsp; void slotDeleteEvent(Incidence *);<br>
--- branches/work/nokia-pim-suite/trunk/calendar/views/configwindow.cpp \
#921041:921042<br> @@ -25,6 +25,9 @@<br>
&nbsp;#include &quot;calprefs_base.h&quot;<br>
&nbsp;#include &quot;../calendar/models/eventlistmodel.h&quot;<br>
<br>
+#include &lt;akonadi/collection.h&gt;<br>
+<br>
+<br>
&nbsp;#include &lt;akonadi/transactionsequence.h&gt;<br>
&nbsp;#include &lt;akonadi/itemcreatejob.h&gt;<br>
<br>
@@ -43,10 +46,12 @@<br>
&nbsp;#include &lt;QTreeWidget&gt;<br>
<br>
&nbsp;using namespace NPSCal;<br>
+using namespace Akonadi;<br>
<br>
&nbsp;NPSCal::ConfigWindow::ConfigWindow(NPSCal::EventListModel* pevents, QWidget \
*parent, &nbsp;const QString &amp;name)<br> &nbsp;:KConfigDialog(parent, \
&quot;Calendar Settings&quot;, CalPrefs::self())<br> &nbsp;{<br>
+ &nbsp;events = pevents;<br>
<br>
 &nbsp; setWindowModality (Qt::ApplicationModal);<br>
<br>
@@ -70,7 +75,9 @@<br>
<br>
 &nbsp; //connects<br>
 &nbsp; connect( generalui.addResourcePushButton, SIGNAL( clicked() ), this, SLOT( \
                slotCreateNewResource() ) );<br>
-<br>
+ &nbsp;connect( this, SIGNAL( applyClicked() ), this, SLOT( slotApply() ) );<br>
+ &nbsp;connect( this, SIGNAL( defaultClicked() ), this, SLOT( slotDefault() ) );<br>
+ &nbsp;connect( this, SIGNAL( okClicked() ), this, SLOT( slotApply() ) );<br>
<br>
<br>
<br>
@@ -148,12 +155,14 @@<br>
&nbsp;void NPSCal::ConfigWindow::slotApply(){<br>
 &nbsp; //Setting values<br>
 &nbsp; CalPrefs::setNumResource(generalui.resources-&gt;itemData \
(generalui.resources-&gt;currentIndex () \
,Akonadi::CollectionModel::CollectionIdRole).value&lt;int&gt;()); //The first one is \
                selected<br>
-<br>
 &nbsp; CalPrefs::self()-&gt;writeConfig();<br>
+ &nbsp;events-&gt;setCollectionById(CalPrefs::numResource());<br>
+// &nbsp; KConfigDialog::slotApply();<br>
&nbsp;}<br>
&nbsp;void NPSCal::ConfigWindow::slotDefault(){<br>
 &nbsp; CalPrefs::self()-&gt;setDefaults ();<br>
 &nbsp; CalPrefs::self()-&gt;writeConfig();<br>
+// &nbsp; KConfigDialog::slotDefault();<br>
&nbsp;}<br>
<br>
<br>
</blockquote></div><br>



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

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