Commit e79926c7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to implement manageshowcollectionpropertie

parent 0da5a6e3
......@@ -31,6 +31,7 @@
#include "kohelper.h"
#include "prefs/koprefs.h"
#include "koglobals.h"
#include "manageshowcollectionproperties.h"
#include "views/collectionview/reparentingmodel.h"
#include "views/collectionview/calendardelegate.h"
#include "views/collectionview/quickview.h"
......@@ -512,6 +513,8 @@ AkonadiCollectionView::AkonadiCollectionView(CalendarView *view, bool hasContext
mWasDefaultCalendar(false),
mHasContextMenu(hasContextMenu)
{
mManagerShowCollectionProperties = new ManageShowCollectionProperties(this);
QVBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->setMargin(0);
......
......@@ -33,6 +33,7 @@
#include "views/collectionview/controller.h"
class AkonadiCollectionView;
class ManageShowCollectionProperties;
namespace Akonadi
{
......@@ -130,6 +131,7 @@ private:
bool mHasContextMenu;
Controller *mController;
NewNodeExpander *mNewNodeExpander;
ManageShowCollectionProperties *mManagerShowCollectionProperties;
};
#endif
......@@ -18,9 +18,15 @@
*/
#include "manageshowcollectionproperties.h"
#include "akonadicollectionview.h"
#include "korganizer_debug.h"
#include <AkonadiWidgets/CollectionPropertiesDialog>
#include <AkonadiCore/CollectionAttributesSynchronizationJob>
#include <AkonadiCore/CollectionFetchJob>
ManageShowCollectionProperties::ManageShowCollectionProperties(QObject *parent)
: QObject(parent)
ManageShowCollectionProperties::ManageShowCollectionProperties(AkonadiCollectionView *collectionView, QObject *parent)
: QObject(parent),
mCollectionView(collectionView)
{
mPages = QStringList() << QStringLiteral("CalendarSupport::CollectionGeneralPage")
<< QStringLiteral("Akonadi::CachePolicyPage")
......@@ -34,8 +40,7 @@ ManageShowCollectionProperties::~ManageShowCollectionProperties()
void ManageShowCollectionProperties::showCollectionProperties()
{
#if 0
const Akonadi::Collection col = mMainWidget->currentAddressBook();
const Akonadi::Collection col = mCollectionView->currentCalendar();
const Akonadi::Collection::Id id = col.id();
QPointer<Akonadi::CollectionPropertiesDialog> dlg = mHashDialogBox.value(id);
if (dlg) {
......@@ -49,31 +54,26 @@ void ManageShowCollectionProperties::showCollectionProperties()
connect(sync, &KJob::result,
this, &ManageShowCollectionProperties::slotCollectionPropertiesContinued);
sync->start();
#endif
}
void ManageShowCollectionProperties::slotCollectionPropertiesContinued(KJob *job)
{
#if 0
QString pageToShow;
if (job) {
Akonadi::CollectionAttributesSynchronizationJob *sync
= qobject_cast<Akonadi::CollectionAttributesSynchronizationJob *>(job);
Q_ASSERT(sync);
if (sync->property("collectionId") != mMainWidget->currentAddressBook().id()) {
if (sync->property("collectionId") != mCollectionView->currentCalendar().id()) {
return;
}
}
Akonadi::CollectionFetchJob *fetch = new Akonadi::CollectionFetchJob(mMainWidget->currentAddressBook(),
Akonadi::CollectionFetchJob *fetch = new Akonadi::CollectionFetchJob(mCollectionView->currentCalendar(),
Akonadi::CollectionFetchJob::Base);
connect(fetch, &KJob::result,
this, &ManageShowCollectionProperties::slotCollectionPropertiesFinished);
#endif
}
void ManageShowCollectionProperties::slotCollectionPropertiesFinished(KJob *job)
{
#if 0
if (!job) {
return;
}
......@@ -81,17 +81,16 @@ void ManageShowCollectionProperties::slotCollectionPropertiesFinished(KJob *job)
Akonadi::CollectionFetchJob *fetch = qobject_cast<Akonadi::CollectionFetchJob *>(job);
Q_ASSERT(fetch);
if (fetch->collections().isEmpty()) {
qCWarning(KADDRESSBOOK_LOG) << "no collection";
qCWarning(KORGANIZER_LOG) << "no collection";
return;
}
const Akonadi::Collection collection = fetch->collections().first();
QPointer<Akonadi::CollectionPropertiesDialog> dlg = new Akonadi::CollectionPropertiesDialog(collection, mPages, mMainWidget);
dlg->setWindowTitle(i18nc("@title:window", "Properties of Address Book Folder %1", collection.name()));
QPointer<Akonadi::CollectionPropertiesDialog> dlg = new Akonadi::CollectionPropertiesDialog(collection, mPages, mCollectionView);
dlg->setWindowTitle(i18nc("@title:window", "Properties of Calendar Folder %1", collection.name()));
dlg->show();
mHashDialogBox.insert(collection.id(), dlg);
#endif
}
......@@ -23,18 +23,18 @@
#include <QObject>
#include <QPointer>
#include <MailCommon/FolderCollection>
#include <AkonadiCore/Collection>
namespace Akonadi
{
class CollectionPropertiesDialog;
}
class KJob;
class AkonadiCollectionView;
class ManageShowCollectionProperties : public QObject
{
Q_OBJECT
public:
explicit ManageShowCollectionProperties(QObject *parent = Q_NULLPTR);
explicit ManageShowCollectionProperties(AkonadiCollectionView *collectionView, QObject *parent = Q_NULLPTR);
~ManageShowCollectionProperties();
public Q_SLOTS:
......@@ -45,7 +45,7 @@ private:
void slotCollectionPropertiesFinished(KJob *job);
QHash<Akonadi::Collection::Id, QPointer<Akonadi::CollectionPropertiesDialog> > mHashDialogBox;
QStringList mPages;
//MainWidget *mMainWidget;
AkonadiCollectionView *mCollectionView;
};
#endif // MANAGESHOWCOLLECTIONPROPERTIES_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment