[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/nokia-pim-suite/trunk/contact
From: Audrey Speronel <audenel () gmail ! com>
Date: 2009-01-23 20:05:51
Message-ID: 1232741151.714548.4842.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 915801 by asperonel:
Correction of a problem with the display of the configWindow.
Modication of the code so that the application windows are displayed inside the \
QStackedWidget. Comment the needless inclusions.
M +9 -6 Contacts.cpp
M +3 -3 Contacts.h
M +25 -14 configwindow.cpp
M +6 -7 configwindow.h
M +9 -6 kabcitemeditor.cpp
M +1 -2 main.cpp
M +5 -12 stackedmanager.cpp
M +2 -2 stackedmanager.h
M +27 -20 vc_contacts.cpp
M +3 -2 vc_contacts.h
--- branches/work/nokia-pim-suite/trunk/contact/Contacts.cpp #915800:915801
@@ -21,18 +21,21 @@
#include "Contacts.h"
#include <kdebug.h>
-#include <QString>
+//#include <QString>
+//#include <QList>
+
+//#include <kabc/addressee.h>
+#include <akonadi/collection.h>
#include <akonadi/item.h>
-#include <QList>
-#include <kabc/addressee.h>
#include <akonadi/itemdeletejob.h>
-#include <akonadi/itemfetchjob.h>
-#include <configurationC.h>
+//#include <akonadi/itemfetchjob.h>
+#include <configurationC.h>
+
using namespace Akonadi;
-int Contacts::numCollection=10;
+int Contacts::numCollection=3;
/**
*FIXME Create a resource when the numCollection is not good
--- branches/work/nokia-pim-suite/trunk/contact/Contacts.h #915800:915801
@@ -22,8 +22,8 @@
#define CONTACTS_H
#include "addresseemodel.h"
+
#include <kjob.h>
-#include <akonadi/collection.h>
using namespace Akonadi;
@@ -37,10 +37,10 @@
void makeListing();
int deleteContact(int idItem);
- public slots:
+ public slots:
void slot_changeIdResource(int idResource);
void slotItemDeleted(KJob* job);
-
+
};
#endif
--- branches/work/nokia-pim-suite/trunk/contact/configwindow.cpp #915800:915801
@@ -20,26 +20,33 @@
#include "configwindow.h"
#include "stackedmanager.h"
+#include "vc_contacts.h"
-#include <QFileDialog>
#include <kabc/vcardconverter.h>
#include <kabc/vcardformat.h>
#include <akonadi/transactionsequence.h>
-#include <akonadi/job.h>
+//#include <akonadi/job.h>
#include <akonadi/itemcreatejob.h>
#include <akonadi/collectionfetchjob.h>
#include <akonadi/control.h>
#include <akonadi/collectionmodel.h>
#include <akonadi/collectionfilterproxymodel.h>
//#include <akonadi/collectionidrole.h>
-#include <vc_contacts.h>
+
#include <kdebug.h>
+#include <kconfigskeleton.h>
+
+#include <QFileDialog>
#include <QMessageBox>
-#include <QVariant>
+//#include <QVariant>
#include <QPushButton>
+//#include <QRadioButton>
+#include <QGridLayout>
+#include <QLabel>
+
//Xml Data Saving
-#include <configurationC.h>
+#include <configurationC.h>
bool applyConfigChangeResource=false;
@@ -78,12 +85,12 @@
{
// check up every akonadi collection
Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob( \
Akonadi::Collection::root(), Akonadi::CollectionFetchJob::Recursive \
);
- kDebug() << "Collection listing";
+ kDebug() << "Collections listing";
connect( job, SIGNAL( result( KJob* ) ), this, SLOT( slot_CollectionsListed( \
KJob* ) ) ); //Model of all collections
Akonadi::CollectionModel *model = new Akonadi::CollectionModel( this );
- //The proxy is here to choose the resource we want to be shown
+ //The proxy is here to choose the resource we want to be shown
Akonadi::CollectionFilterProxyModel *proxy = new \
Akonadi::CollectionFilterProxyModel();
proxy->addMimeTypeFilter( "text/directory" ); //Only the resources with this \
mimetype are shown proxy->setSourceModel( model );
@@ -103,6 +110,9 @@
connect (this, SIGNAL(okClicked()), this, SLOT (slot_ok()));
//Click on apply button
connect (this, SIGNAL(applyClicked()), this, SLOT (slot_applyModifications()));
+
+ //reset the default flags of the window so that it can be displayed in the \
QStackedWidget + //setWindowFlags(Qt::Widget);
}
/**
@@ -118,14 +128,14 @@
slot_changeResource();
}
kDebug() << "End change Resource";
-}
+}
/**
*Slot called when the user chooses to change the resource number
*/
void ConfigWindow::slot_changeResource()
{
- QItemSelectionModel * modelS = listResources->selectionModel ();
+ QItemSelectionModel * modelS = listResources->selectionModel ();
QModelIndexList indexL = modelS->selectedIndexes (); //Take selected resources
if(indexL.size()>0)
{
@@ -137,9 +147,10 @@
}
/**
-*This function saves Resource Number in the xml file
+*This function saves Resource Number in the xml file
*/
-void ConfigWindow::saveResourceNum(int numResource) {
+void ConfigWindow::saveResourceNum(int numResource)
+{
Contacts::numCollection=numResource;
Configuration_xml* cxml= Configuration_xml::self();
Configuration_xml::setNumResource( numResource ); //Enter the number of the \
resource @@ -274,7 +285,7 @@
*/
bool ConfigWindow::exportContacts(QString fileName)
{
- QFile* saveFile= new QFile(fileName);
+ QFile* saveFile= new QFile(fileName);
saveFile->open (QIODevice::ReadWrite);
QModelIndexList indexL;
int nbElems = contacts-> rowCount();
@@ -289,7 +300,7 @@
{
//Save all the contacts in the file
for(int i=0;i<indexL.size();i++)
- {
+ {
//Transform an item in addressee
Akonadi::Item item= contacts->itemForIndex(indexL.at(i));
KABC::Addressee addr = item.payload<KABC::Addressee> ();
@@ -389,7 +400,7 @@
{
kDebug() << "import contacts ok";
qm.setText (i18n("Import Successful"));
-
+
}
else
{
--- branches/work/nokia-pim-suite/trunk/contact/configwindow.h #915800:915801
@@ -21,14 +21,13 @@
#ifndef CONFIGWINDOW_H
#define CONFIGWINDOW_H
+#include "Contacts.h"
+
#include <kconfigdialog.h>
#include <QWidget>
-#include <kconfigskeleton.h>
#include <QString>
#include <kjob.h>
#include <QTableView>
-#include <QRadioButton>
-#include "Contacts.h"
#include <QModelIndex>
class ConfigWindow : public KConfigDialog
@@ -45,9 +44,9 @@
QPushButton *importPushButton;
//Resource panel
- QWidget * resourcesPage;
+ QWidget * resourcesPage;
QTableView* listResources;
-
+
public :
ConfigWindow(QWidget *parent, const QString &name);
bool exportContacts(QString fileName); //function called to export all contacts
@@ -59,7 +58,7 @@
void signal_changeWindow(int from_page, int to_page, int parameter=0); //Signal \
to change window in manager
void signal_changeIdResource(int newCollectionId); //Signal to change the \
akonadi collection in the model Contacts
void signal_addNewCategories(QList<QString> newCategories); //Signal to add \
categories when the user import contacts
- void signal_refreshCategoriesComboBox(); //Ask the main window to refresh its \
Categories comboBox + void signal_refreshCategoriesComboBox(); //Ask the main \
window to refresh its Categories comboBox void signal_listingComplete(); //Ask the \
category list to be remake
public slots:
@@ -81,4 +80,4 @@
};
-#endif
\ No newline at end of file
+#endif
--- branches/work/nokia-pim-suite/trunk/contact/kabcitemeditor.cpp #915800:915801
@@ -22,9 +22,9 @@
#include "Contacts.h"
#include "stackedmanager.h"
-#include <QtGui/QGridLayout>
-#include <QtGui/QLabel>
-#include <QtGui/QLineEdit>
+//#include <QtGui/QGridLayout>
+//#include <QtGui/QLabel>
+//#include <QtGui/QLineEdit>
#include <QtGui/QMessageBox>
#include <kabc/addressee.h>
@@ -35,11 +35,13 @@
#include <akonadi/itemmodifyjob.h>
#include <akonadi/monitor.h>
#include <akonadi/session.h>
-#include <QPushButton>
+
#include <KLocale>
#include <kdebug.h>
-#include <QMessageBox>
+#include <QPushButton>
+//#include <QMessageBox>
+
using namespace Akonadi;
class KABCItemEditor::Private
@@ -281,6 +283,7 @@
//ask to close the window in the stackedManager
connect( d->gui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), \
this, SLOT(slot_exitWindow()) ); + connect( \
d->gui.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL( clicked() ), this, \
SLOT(slot_exitWindow()) ); }
@@ -304,7 +307,7 @@
QMessageBox *errDialog = new QMessageBox(QMessageBox::NoIcon,i18n("Error"), \
i18n("You have to set a name or a givenName"),QMessageBox::Ok, this); \
errDialog->exec(); }
-
+
}
/**
--- branches/work/nokia-pim-suite/trunk/contact/main.cpp #915800:915801
@@ -27,11 +27,10 @@
int main(int argc, char** argv){
- KAboutData* kad= new KAboutData("contact", "contact",ki18n("Contact"),"version \
1.0"); + KAboutData* kad= new KAboutData("contacts", \
"contacts",ki18n("Contacts"),"version 1.0"); KCmdLineArgs::init(argc, argv, kad);
KApplication app;
//Manager manager;
- //The "new" is necessary to use the Qt::WA_DeleteOnClose on the stackedManager
new StackedManager();
return app.exec();
--- branches/work/nokia-pim-suite/trunk/contact/stackedmanager.cpp #915800:915801
@@ -42,15 +42,11 @@
/* Initiation of all the application windows */
initWindows();
- //Set the default interface at the application start
- open_window(StackedManager::mainWindow);
-
//Set size 500x300 like the main window
setMaximumSize(500, 300);
setMinimumSize(500, 300);
- //Permit to quit the application when the stackedWidget is closed
- setAttribute(Qt::WA_DeleteOnClose, true);
+ show();
}
/**
@@ -68,9 +64,10 @@
{
kDebug() << "initialise the stacked windows";
- insertWidget(mainWindow, new VC_Contacts(contacts, this));
+ VC_Contacts * contactsMain = new VC_Contacts(contacts, this);
+ insertWidget(mainWindow, contactsMain);
- ConfigWindow * configWindow = new ConfigWindow(this, "configWindow");
+ ConfigWindow * configWindow = new ConfigWindow(contactsMain, "configWindow");
insertWidget(configContactWindow, configWindow);
connect(configWindow, SIGNAL(signal_changeIdResource(int)), contacts, \
SLOT(slot_changeIdResource(int))); }
@@ -87,26 +84,21 @@
case mainWindow : /*to main window*/
kDebug() << "get mainWindow in stack";
setCurrentIndex(mainWindow);
- // cache la fenĂȘtre du stack
- setVisible(false);
break;
case addContactWindow : /*to addContact window*/
kDebug() << "create addContactWindow";
insertWidget(addContactWindow, new \
Akonadi::KABCItemEditor(Akonadi::KABCItemEditor::CreateMode, this)); \
setCurrentIndex(addContactWindow);
- setVisible(true);
break;
case editContactWindow : /* to editContact window */
kDebug() << "create editContactWindow";
insertWidget(editContactWindow, new \
Akonadi::KABCItemEditor(Akonadi::KABCItemEditor::EditMode, this)); \
setCurrentIndex(editContactWindow);
((Akonadi::KABCItemEditor *) \
widget(editContactWindow))->loadContact(parameter);
- setVisible(true);
break;
case configContactWindow : /* to config window */
kDebug() << "get configContactWindow in stack";
setCurrentIndex(configContactWindow);
- //setVisible(false);
break;
}
}
@@ -137,5 +129,6 @@
*/
Contacts* StackedManager::getContacts()
{
+ kDebug() << "get the model";
return contacts;
}
--- branches/work/nokia-pim-suite/trunk/contact/stackedmanager.h #915800:915801
@@ -34,10 +34,10 @@
public:
enum Window
{
+ configContactWindow,
mainWindow,
addContactWindow,
- editContactWindow,
- configContactWindow
+ editContactWindow
};
/*Data*/
--- branches/work/nokia-pim-suite/trunk/contact/vc_contacts.cpp #915800:915801
@@ -22,24 +22,25 @@
#include "stackedmanager.h"
#include <kdebug.h>
+
#include <QMessageBox>
-#include <QVariant>
+//#include <QVariant>
#include <QString>
+//#include <QFileDialog>
+//#include <KApplication>
+//#include <KAction>
+//#include <KLocale>
+//#include <KActionCollection>
+//#include <KStandardAction>
+
+#include <akonadi/collection.h>
#include <akonadi/itemmodel.h>
-#include <QFileDialog>
-#include <KApplication>
-#include <KAction>
-#include <KLocale>
-#include <KActionCollection>
-#include <KStandardAction>
-
-#include <kabc/addressee.h>
-
-#include <kabc/addressbook.h>
-#include <kabc/resourcecached.h>
#include <akonadi/item.h>
#include <akonadi/itemcreatejob.h>
#include <akonadi/itemfetchjob.h>
+#include <kabc/addressee.h>
+//#include <kabc/addressbook.h>
+//#include <kabc/resourcecached.h>
int VC_Contacts::NAME_COLUMN = 0; //Number of the name contact column
@@ -48,7 +49,7 @@
* @param parent : parent of the QWiget
* @param p_contacts : contacts model used
*/
-VC_Contacts::VC_Contacts(Contacts * p_contacts, QWidget *parent): \
KXmlGuiWindow(parent) +VC_Contacts::VC_Contacts(Contacts * p_contacts, QWidget \
*parent): QMainWindow(parent) {
//graphical
ui.setupUi(this);
@@ -75,6 +76,9 @@
//change category
connect(ui.sortComboBox, SIGNAL(activated(int)), this, SLOT(slot_category(int)));
+ //reset the default flags of the window so that it can be displayed in the \
QStackedWidget + setWindowFlags(Qt::Widget);
+
kDebug() << "End constructor VC_Contacts";
}
@@ -86,7 +90,7 @@
connect(ui.importAction, SIGNAL(triggered(bool)), this, \
SLOT(slot_configContact())); connect(ui.exportAction, SIGNAL(triggered(bool)), this, \
SLOT(slot_configContact()));
- connect(ui.quitAction, SIGNAL(triggered(bool)), this, SLOT(close()));
+ connect(ui.quitAction, SIGNAL(triggered(bool)), parent(), SLOT(close()));
// actions connection to implementation
connect(ui.newAction, SIGNAL(triggered(bool)), this, SLOT(slot_newContact()));
@@ -99,7 +103,7 @@
}
/**
-* Slot called when the categories lst has to be refreshed
+* Slot called when the categories list has to be refreshed
*/
void VC_Contacts::slot_startRefreshCategories()
{
@@ -117,10 +121,12 @@
if(job->error())
{
kDebug() << " error ";
- }else{
+ }
+ else
+ {
kDebug() << "listing contacts to take categories ok";
}
- makeCategories(); //Search the categories in the contacts list
+ makeCategories(); //Search the categories in the contacts list
}
/**
@@ -131,6 +137,7 @@
updateCategories();
slot_refreshCategoriesList();
}
+
/**
*This slot search all the different categories of the contacts and make up a list
*/
@@ -138,15 +145,15 @@
{
//Clean the map
categories->clear();
-
+
kDebug () << "row count" << contacts->rowCount();
- QModelIndex indexM;
+ QModelIndex indexM;
Akonadi::Item item;
KABC::Addressee addr;
Akonadi::Item::List items = job->items();
categories->insert(0, i18n("All"));
- foreach(const Akonadi::Item &item, items )
+ foreach(const Akonadi::Item &item, items )
{
if(item.hasPayload<KABC::Addressee>())
{
--- branches/work/nokia-pim-suite/trunk/contact/vc_contacts.h #915800:915801
@@ -23,10 +23,11 @@
#include "ui_view_contacts.h"
#include "Contacts.h"
-#include <KXmlGuiWindow>
+
+#include <QMainWindow>
#include <akonadi/itemfetchjob.h>
-class VC_Contacts: public KXmlGuiWindow
+class VC_Contacts: public QMainWindow
{
Q_OBJECT
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic