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