Commit 6554d87e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add support for "Serverside Subscription..."

parent 5df6c73f
......@@ -50,6 +50,8 @@
#include <AkonadiWidgets/ETMViewStateSaver>
#include <Akonadi/Calendar/StandardCalendarActionManager>
#include <AkonadiCore/CollectionIdentificationAttribute>
#include <manageserversidesubscription/manageserversidesubscriptionjob.h>
#include "pimcommon/util/pimutil.h"
#include <KActionCollection>
#include <KCheckableProxyModel>
......@@ -696,6 +698,10 @@ AkonadiCollectionView::AkonadiCollectionView(CalendarView *view, bool hasContext
mEnableAction->setText(i18n("Add to list permanently"));
mEnableAction->setIcon(KIconLoader::global()->loadIcon(QStringLiteral("bookmarks"), KIconLoader::Small));
mServerSideSubscription = new QAction(QIcon::fromTheme(QStringLiteral("folder-bookmarks")), i18n("Serverside Subscription..."), this);
xmlclient->actionCollection()->addAction(QStringLiteral("serverside_subscription"), mServerSideSubscription);
connect(mServerSideSubscription, &QAction::triggered, this, &AkonadiCollectionView::slotServerSideSubscription);
}
}
......@@ -714,6 +720,20 @@ void AkonadiCollectionView::onSearchIsActive(bool active)
}
}
void AkonadiCollectionView::slotServerSideSubscription()
{
const QModelIndex index = mCollectionView->selectionModel()->currentIndex(); //selectedRows()
Q_ASSERT(index.isValid());
const Akonadi::Collection collection = CalendarSupport::collectionFromIndex(index);
if (!collection.isValid()) {
return;
}
PimCommon::ManageServerSideSubscriptionJob *job = new PimCommon::ManageServerSideSubscriptionJob(this);
job->setCurrentCollection(collection);
job->setParentWidget(this);
job->start();
}
void AkonadiCollectionView::setDefaultCalendar()
{
QModelIndex index = mCollectionView->selectionModel()->currentIndex(); //selectedRows()
......@@ -827,11 +847,14 @@ void AkonadiCollectionView::updateMenu()
} else {
mEnableAction->setEnabled(true);
}
bool isOnline;
mServerSideSubscription->setEnabled(PimCommon::Util::isImapFolder(collection, isOnline));
}
if (disableStuff) {
mDisableColor->setEnabled(false);
mDefaultCalendar->setEnabled(false);
mAssignColor->setEnabled(false);
mServerSideSubscription->setEnabled(false);
}
}
......
......@@ -109,8 +109,8 @@ private Q_SLOTS:
void disableColor();
void setDefaultCalendar();
void onSearchIsActive(bool);
void onAction(const QModelIndex &index, int action);
void onAction(const QModelIndex &index, int action);
void slotServerSideSubscription();
private:
Akonadi::EntityTreeModel *entityTreeModel() const;
......@@ -123,6 +123,7 @@ private:
QAction *mDisableColor;
QAction *mDefaultCalendar;
QAction *mEnableAction;
QAction *mServerSideSubscription;
bool mNotSendAddRemoveSignal;
bool mWasDefaultCalendar;
bool mHasContextMenu;
......
<!DOCTYPE kpartgui>
<kpartgui name="korganizer" version="425" translationDomain="korganizer">
<kpartgui name="korganizer" version="427" translationDomain="korganizer">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Merge/>
......@@ -198,6 +198,8 @@
<Separator/>
<Action name="akonadi_collection_properties"/>
<Action name="akonadi_resource_properties"/>
<Separator/>
<Action name="serverside_subscription"/>
</Menu>
</kpartgui>
<!DOCTYPE kpartgui>
<kpartgui name="korganizer" version="426" translationDomain="korganizer">
<kpartgui name="korganizer" version="427" translationDomain="korganizer">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Menu name="import"><text>&amp;Import</text>
......@@ -185,6 +185,8 @@
<Separator/>
<Action name="akonadi_collection_properties"/>
<Action name="akonadi_resource_properties"/>
<Separator/>
<Action name="serverside_subscription"/>
</Menu>
</kpartgui>
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