Changeset View
Changeset View
Standalone View
Standalone View
src/akonadi/akonadiconfigdialog.cpp
Show All 22 Lines | |||||
23 | 23 | | |||
24 | #include "akonadiconfigdialog.h" | 24 | #include "akonadiconfigdialog.h" | ||
25 | 25 | | |||
26 | #include <QAction> | 26 | #include <QAction> | ||
27 | #include <QDialogButtonBox> | 27 | #include <QDialogButtonBox> | ||
28 | #include <QLabel> | 28 | #include <QLabel> | ||
29 | #include <QLayout> | 29 | #include <QLayout> | ||
30 | #include <QMessageBox> | 30 | #include <QMessageBox> | ||
31 | #include <QPointer> | ||||
31 | #include <QToolBar> | 32 | #include <QToolBar> | ||
32 | 33 | | |||
33 | #include <AkonadiCore/AgentFilterProxyModel> | 34 | #include <AkonadiCore/AgentFilterProxyModel> | ||
34 | #include <AkonadiCore/AgentInstance> | 35 | #include <AkonadiCore/AgentInstance> | ||
35 | #include <AkonadiWidgets/AgentInstanceWidget> | 36 | #include <AkonadiWidgets/AgentInstanceWidget> | ||
36 | #include <AkonadiCore/AgentInstanceCreateJob> | 37 | #include <AkonadiCore/AgentInstanceCreateJob> | ||
37 | #include <AkonadiCore/AgentManager> | 38 | #include <AkonadiCore/AgentManager> | ||
38 | #include <AkonadiWidgets/AgentTypeDialog> | 39 | #include <AkonadiWidgets/AgentTypeDialog> | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 45 | { | |||
92 | 93 | | |||
93 | layout->addWidget(buttons); | 94 | layout->addWidget(buttons); | ||
94 | 95 | | |||
95 | setLayout(layout); | 96 | setLayout(layout); | ||
96 | } | 97 | } | ||
97 | 98 | | |||
98 | void ConfigDialog::onAddTriggered() | 99 | void ConfigDialog::onAddTriggered() | ||
99 | { | 100 | { | ||
100 | Akonadi::AgentTypeDialog dlg(this); | 101 | auto dlg = QPointer<AgentTypeDialog>(new AgentTypeDialog(this)); | ||
101 | dlg.agentFilterProxyModel()->addMimeTypeFilter(QStringLiteral("application/x-vnd.akonadi.calendar.todo")); | 102 | dlg->agentFilterProxyModel()->addMimeTypeFilter(QStringLiteral("application/x-vnd.akonadi.calendar.todo")); | ||
102 | if (dlg.exec()) { | 103 | if (dlg->exec()) { | ||
103 | const auto agentType = dlg.agentType(); | 104 | if (!dlg) | ||
105 | return; | ||||
106 | | ||||
107 | const auto agentType = dlg->agentType(); | ||||
104 | 108 | | |||
105 | if (agentType.isValid()) { | 109 | if (agentType.isValid()) { | ||
106 | auto job = new Akonadi::AgentInstanceCreateJob(agentType, this); | 110 | auto job = new Akonadi::AgentInstanceCreateJob(agentType, this); | ||
107 | job->configure(this); | 111 | job->configure(this); | ||
108 | job->start(); | 112 | job->start(); | ||
109 | } | 113 | } | ||
110 | } | 114 | } | ||
115 | delete dlg; | ||||
111 | } | 116 | } | ||
112 | 117 | | |||
113 | void ConfigDialog::onRemoveTriggered() | 118 | void ConfigDialog::onRemoveTriggered() | ||
114 | { | 119 | { | ||
115 | auto list = m_agentInstanceWidget->selectedAgentInstances(); | 120 | auto list = m_agentInstanceWidget->selectedAgentInstances(); | ||
116 | if (!list.isEmpty()) { | 121 | if (!list.isEmpty()) { | ||
117 | auto answer = QMessageBox::question(this, | 122 | auto answer = QMessageBox::question(this, | ||
118 | tr("Multiple Agent Deletion"), | 123 | tr("Multiple Agent Deletion"), | ||
Show All 18 Lines |