Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/plugins/views/onlinejoboutbox/konlinejoboutboxview.cpp
- This file was moved from kmymoney/views/konlinejoboutbox.cpp.
Context not available. | |||||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
---|---|---|---|---|---|
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #include "konlinejoboutbox.h" | 19 | #include "konlinejoboutboxview.h" | ||
20 | 20 | | |||
21 | #include <memory> | 21 | #include <memory> | ||
22 | 22 | | |||
23 | #include "ui_konlinejoboutbox.h" | 23 | #include "ui_konlinejoboutboxview.h" | ||
24 | #include "kmymoneyviewbase_p.h" | 24 | #include "kmymoneyviewbase_p.h" | ||
25 | #include "konlinetransferform.h" | 25 | #include "konlinetransferform.h" | ||
26 | #include "kmymoneyplugin.h" | 26 | #include "kmymoneyplugin.h" | ||
Context not available. | |||||
51 | 51 | | |||
52 | #include <QDebug> | 52 | #include <QDebug> | ||
53 | 53 | | |||
54 | class KOnlineJobOutboxPrivate : public KMyMoneyViewBasePrivate | 54 | class KOnlineJobOutboxViewPrivate : public KMyMoneyViewBasePrivate | ||
55 | { | 55 | { | ||
56 | Q_DECLARE_PUBLIC(KOnlineJobOutbox) | 56 | Q_DECLARE_PUBLIC(KOnlineJobOutboxView) | ||
57 | 57 | | |||
58 | public: | 58 | public: | ||
59 | explicit KOnlineJobOutboxPrivate(KOnlineJobOutbox *qq) : | 59 | explicit KOnlineJobOutboxViewPrivate(KOnlineJobOutboxView *qq) : | ||
60 | KMyMoneyViewBasePrivate(), | 60 | KMyMoneyViewBasePrivate(), | ||
61 | q_ptr(qq), | 61 | q_ptr(qq), | ||
62 | ui(new Ui::KOnlineJobOutbox), | 62 | ui(new Ui::KOnlineJobOutboxView), | ||
63 | m_needLoad(true), | 63 | m_needLoad(true), | ||
64 | m_onlinePlugins(nullptr) | 64 | m_onlinePlugins(nullptr), | ||
65 | m_onlineJobModel(nullptr) | ||||
65 | { | 66 | { | ||
66 | } | 67 | } | ||
67 | 68 | | |||
68 | ~KOnlineJobOutboxPrivate() | 69 | ~KOnlineJobOutboxViewPrivate() | ||
69 | { | 70 | { | ||
70 | if (!m_needLoad) { | 71 | if (!m_needLoad) { | ||
71 | // Save column state | 72 | // Save column state | ||
72 | KConfigGroup configGroup = KSharedConfig::openConfig()->group("KOnlineJobOutbox"); | 73 | KConfigGroup configGroup = KSharedConfig::openConfig()->group("KOnlineJobOutboxView"); | ||
73 | configGroup.writeEntry("HeaderState", ui->m_onlineJobView->header()->saveState()); | 74 | configGroup.writeEntry("HeaderState", ui->m_onlineJobView->header()->saveState()); | ||
74 | } | 75 | } | ||
75 | } | 76 | } | ||
76 | 77 | | |||
77 | void init() | 78 | void init() | ||
78 | { | 79 | { | ||
79 | Q_Q(KOnlineJobOutbox); | 80 | Q_Q(KOnlineJobOutboxView); | ||
80 | m_needLoad = false; | 81 | m_needLoad = false; | ||
81 | ui->setupUi(q); | 82 | ui->setupUi(q); | ||
82 | 83 | | |||
83 | // Restore column state | 84 | // Restore column state | ||
84 | KConfigGroup configGroup = KSharedConfig::openConfig()->group("KOnlineJobOutbox"); | 85 | KConfigGroup configGroup = KSharedConfig::openConfig()->group("KOnlineJobOutboxView"); | ||
85 | QByteArray columns; | 86 | QByteArray columns; | ||
86 | columns = configGroup.readEntry("HeaderState", columns); | 87 | columns = configGroup.readEntry("HeaderState", columns); | ||
87 | ui->m_onlineJobView->header()->restoreState(columns); | 88 | ui->m_onlineJobView->header()->restoreState(columns); | ||
88 | 89 | | |||
89 | ui->m_onlineJobView->setModel(Models::instance()->onlineJobsModel()); | 90 | ui->m_onlineJobView->setModel(this->onlineJobsModel()); | ||
90 | q->connect(ui->m_buttonSend, &QAbstractButton::clicked, q, &KOnlineJobOutbox::slotSendJobs); | 91 | q->connect(ui->m_buttonSend, &QAbstractButton::clicked, q, &KOnlineJobOutboxView::slotSendJobs); | ||
91 | q->connect(ui->m_buttonRemove, &QAbstractButton::clicked, q, &KOnlineJobOutbox::slotRemoveJob); | 92 | q->connect(ui->m_buttonRemove, &QAbstractButton::clicked, q, &KOnlineJobOutboxView::slotRemoveJob); | ||
92 | q->connect(ui->m_buttonEdit, &QAbstractButton::clicked, q, static_cast<void (KOnlineJobOutbox::*)()>(&KOnlineJobOutbox::slotEditJob)); | 93 | q->connect(ui->m_buttonEdit, &QAbstractButton::clicked, q, static_cast<void (KOnlineJobOutboxView::*)()>(&KOnlineJobOutboxView::slotEditJob)); | ||
93 | q->connect(ui->m_onlineJobView, &QAbstractItemView::doubleClicked, q, static_cast<void (KOnlineJobOutbox::*)(const QModelIndex &)>(&KOnlineJobOutbox::slotEditJob)); | 94 | q->connect(ui->m_onlineJobView, &QAbstractItemView::doubleClicked, q, static_cast<void (KOnlineJobOutboxView::*)(const QModelIndex &)>(&KOnlineJobOutboxView::slotEditJob)); | ||
94 | q->connect(ui->m_onlineJobView->selectionModel(), &QItemSelectionModel::selectionChanged, q, &KOnlineJobOutbox::updateButtonState); | 95 | q->connect(ui->m_onlineJobView->selectionModel(), &QItemSelectionModel::selectionChanged, q, &KOnlineJobOutboxView::updateButtonState); | ||
95 | 96 | | |||
96 | // Set new credit transfer button | 97 | // Set new credit transfer button | ||
97 | q->connect(pActions[eMenu::Action::AccountCreditTransfer], &QAction::changed, q, &KOnlineJobOutbox::updateNewCreditTransferButton); | 98 | q->connect(pActions[eMenu::Action::AccountCreditTransfer], &QAction::changed, q, &KOnlineJobOutboxView::updateNewCreditTransferButton); | ||
98 | q->connect(ui->m_buttonNewCreditTransfer, &QAbstractButton::clicked, q, &KOnlineJobOutbox::slotNewCreditTransfer); | 99 | q->connect(ui->m_buttonNewCreditTransfer, &QAbstractButton::clicked, q, &KOnlineJobOutboxView::slotNewCreditTransfer); | ||
99 | q->updateNewCreditTransferButton(); | 100 | q->updateNewCreditTransferButton(); | ||
100 | } | 101 | } | ||
101 | 102 | | |||
103 | onlineJobModel* onlineJobsModel() | ||||
104 | { | ||||
105 | Q_Q(KOnlineJobOutboxView); | ||||
106 | if (!m_onlineJobModel) { | ||||
107 | m_onlineJobModel = new onlineJobModel(q); | ||||
108 | #ifdef KMM_MODELTEST | ||||
109 | /// @todo using the ModelTest feature on the onlineJobModel crashes. Need to fix. | ||||
110 | // new ModelTest(m_onlineJobModel, Models::instance()); | ||||
111 | #endif | ||||
112 | } | ||||
113 | return m_onlineJobModel; | ||||
114 | } | ||||
115 | | ||||
102 | 116 | | |||
103 | void editJob(const QString jobId) | 117 | void editJob(const QString jobId) | ||
104 | { | 118 | { | ||
Context not available. | |||||
120 | 134 | | |||
121 | void editJob(const onlineJobTyped<creditTransfer> job) | 135 | void editJob(const onlineJobTyped<creditTransfer> job) | ||
122 | { | 136 | { | ||
123 | Q_Q(KOnlineJobOutbox); | 137 | Q_Q(KOnlineJobOutboxView); | ||
124 | auto transferForm = new kOnlineTransferForm(q); | 138 | auto transferForm = new kOnlineTransferForm(q); | ||
125 | transferForm->setOnlineJob(job); | 139 | transferForm->setOnlineJob(job); | ||
126 | q->connect(transferForm, &QDialog::rejected, transferForm, &QObject::deleteLater); | 140 | q->connect(transferForm, &QDialog::rejected, transferForm, &QObject::deleteLater); | ||
127 | q->connect(transferForm, &kOnlineTransferForm::acceptedForSave, q, &KOnlineJobOutbox::slotOnlineJobSave); | 141 | q->connect(transferForm, &kOnlineTransferForm::acceptedForSave, q, &KOnlineJobOutboxView::slotOnlineJobSave); | ||
128 | q->connect(transferForm, &kOnlineTransferForm::acceptedForSend, q, static_cast<void (KOnlineJobOutbox::*)(onlineJob)>(&KOnlineJobOutbox::slotOnlineJobSend)); | 142 | q->connect(transferForm, &kOnlineTransferForm::acceptedForSend, q, static_cast<void (KOnlineJobOutboxView::*)(onlineJob)>(&KOnlineJobOutboxView::slotOnlineJobSend)); | ||
129 | q->connect(transferForm, &QDialog::accepted, transferForm, &QObject::deleteLater); | 143 | q->connect(transferForm, &QDialog::accepted, transferForm, &QObject::deleteLater); | ||
130 | transferForm->show(); | 144 | transferForm->show(); | ||
131 | } | 145 | } | ||
132 | 146 | | |||
133 | KOnlineJobOutbox *q_ptr; | 147 | KOnlineJobOutboxView *q_ptr; | ||
134 | std::unique_ptr<Ui::KOnlineJobOutbox> ui; | 148 | std::unique_ptr<Ui::KOnlineJobOutboxView> ui; | ||
135 | 149 | | |||
136 | /** | 150 | /** | ||
137 | * This member holds the load state of page | 151 | * This member holds the load state of page | ||
138 | */ | 152 | */ | ||
139 | bool m_needLoad; | 153 | bool m_needLoad; | ||
140 | QMap<QString, KMyMoneyPlugin::OnlinePlugin*>* m_onlinePlugins; | 154 | QMap<QString, KMyMoneyPlugin::OnlinePlugin*>* m_onlinePlugins; | ||
155 | onlineJobModel *m_onlineJobModel; | ||||
141 | MyMoneyAccount m_currentAccount; | 156 | MyMoneyAccount m_currentAccount; | ||
142 | }; | 157 | }; | ||
143 | 158 | | |||
144 | KOnlineJobOutbox::KOnlineJobOutbox(QWidget *parent) : | 159 | KOnlineJobOutboxView::KOnlineJobOutboxView(QWidget *parent) : | ||
145 | KMyMoneyViewBase(*new KOnlineJobOutboxPrivate(this), parent) | 160 | KMyMoneyViewBase(*new KOnlineJobOutboxViewPrivate(this), parent) | ||
146 | { | 161 | { | ||
147 | connect(pActions[eMenu::Action::LogOnlineJob], &QAction::triggered, this, static_cast<void (KOnlineJobOutbox::*)()>(&KOnlineJobOutbox::slotOnlineJobLog)); | 162 | connect(pActions[eMenu::Action::LogOnlineJob], &QAction::triggered, this, static_cast<void (KOnlineJobOutboxView::*)()>(&KOnlineJobOutboxView::slotOnlineJobLog)); | ||
148 | connect(pActions[eMenu::Action::AccountCreditTransfer], &QAction::triggered, this, &KOnlineJobOutbox::slotNewCreditTransfer); | 163 | connect(pActions[eMenu::Action::AccountCreditTransfer], &QAction::triggered, this, &KOnlineJobOutboxView::slotNewCreditTransfer); | ||
149 | } | 164 | } | ||
150 | 165 | | |||
151 | KOnlineJobOutbox::~KOnlineJobOutbox() | 166 | KOnlineJobOutboxView::~KOnlineJobOutboxView() | ||
152 | { | 167 | { | ||
153 | } | 168 | } | ||
154 | 169 | | |||
155 | void KOnlineJobOutbox::updateButtonState() const | 170 | void KOnlineJobOutboxView::updateButtonState() const | ||
156 | { | 171 | { | ||
157 | Q_D(const KOnlineJobOutbox); | 172 | Q_D(const KOnlineJobOutboxView); | ||
158 | const QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedRows(); | 173 | const QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedRows(); | ||
159 | const int selectedItems = indexes.count(); | 174 | const int selectedItems = indexes.count(); | ||
160 | 175 | | |||
Context not available. | |||||
201 | d->ui->m_buttonRemove->setEnabled(onlinejob_delete->isEnabled()); | 216 | d->ui->m_buttonRemove->setEnabled(onlinejob_delete->isEnabled()); | ||
202 | } | 217 | } | ||
203 | 218 | | |||
204 | void KOnlineJobOutbox::updateNewCreditTransferButton() | 219 | void KOnlineJobOutboxView::updateNewCreditTransferButton() | ||
205 | { | 220 | { | ||
206 | Q_D(KOnlineJobOutbox); | 221 | Q_D(KOnlineJobOutboxView); | ||
207 | auto action = pActions[eMenu::Action::AccountCreditTransfer]; | 222 | auto action = pActions[eMenu::Action::AccountCreditTransfer]; | ||
208 | Q_CHECK_PTR(action); | 223 | Q_CHECK_PTR(action); | ||
209 | d->ui->m_buttonNewCreditTransfer->setEnabled(action->isEnabled()); | 224 | d->ui->m_buttonNewCreditTransfer->setEnabled(action->isEnabled()); | ||
210 | } | 225 | } | ||
211 | 226 | | |||
212 | void KOnlineJobOutbox::slotRemoveJob() | 227 | void KOnlineJobOutboxView::slotRemoveJob() | ||
213 | { | 228 | { | ||
214 | Q_D(KOnlineJobOutbox); | 229 | Q_D(KOnlineJobOutboxView); | ||
215 | QAbstractItemModel* model = d->ui->m_onlineJobView->model(); | 230 | QAbstractItemModel* model = d->ui->m_onlineJobView->model(); | ||
216 | QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedRows(); | 231 | QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedRows(); | ||
217 | 232 | | |||
Context not available. | |||||
221 | } | 236 | } | ||
222 | } | 237 | } | ||
223 | 238 | | |||
224 | QStringList KOnlineJobOutbox::selectedOnlineJobs() const | 239 | QStringList KOnlineJobOutboxView::selectedOnlineJobs() const | ||
225 | { | 240 | { | ||
226 | Q_D(const KOnlineJobOutbox); | 241 | Q_D(const KOnlineJobOutboxView); | ||
227 | QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedRows(); | 242 | QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedRows(); | ||
228 | 243 | | |||
229 | if (indexes.isEmpty()) | 244 | if (indexes.isEmpty()) | ||
Context not available. | |||||
239 | return list; | 254 | return list; | ||
240 | } | 255 | } | ||
241 | 256 | | |||
242 | void KOnlineJobOutbox::setOnlinePlugins(QMap<QString, KMyMoneyPlugin::OnlinePlugin*>& plugins) | 257 | void KOnlineJobOutboxView::slotSelectByObject(const MyMoneyObject& obj, eView::Intent intent) | ||
243 | { | | |||
244 | Q_D(KOnlineJobOutbox); | | |||
245 | d->m_onlinePlugins = &plugins; | | |||
246 | } | | |||
247 | | ||||
248 | void KOnlineJobOutbox::slotSelectByObject(const MyMoneyObject& obj, eView::Intent intent) | | |||
249 | { | 258 | { | ||
250 | switch(intent) { | 259 | switch(intent) { | ||
251 | case eView::Intent::UpdateActions: | 260 | case eView::Intent::UpdateActions: | ||
Context not available. | |||||
257 | } | 266 | } | ||
258 | } | 267 | } | ||
259 | 268 | | |||
260 | void KOnlineJobOutbox::slotSendJobs() | 269 | void KOnlineJobOutboxView::slotSelectByVariant(const QVariantList& variant, eView::Intent intent) | ||
261 | { | 270 | { | ||
262 | Q_D(KOnlineJobOutbox); | 271 | Q_D(KOnlineJobOutboxView); | ||
272 | switch(intent) { | ||||
273 | case eView::Intent::SetOnlinePlugins: | ||||
274 | if (variant.count() == 1) | ||||
275 | d->m_onlinePlugins = static_cast<QMap<QString, KMyMoneyPlugin::OnlinePlugin*>*>(variant.first().value<void*>()); | ||||
276 | break; | ||||
277 | default: | ||||
278 | break; | ||||
279 | } | ||||
280 | } | ||||
281 | | ||||
282 | void KOnlineJobOutboxView::slotSendJobs() | ||||
283 | { | ||||
284 | Q_D(KOnlineJobOutboxView); | ||||
263 | if (d->ui->m_onlineJobView->selectionModel()->hasSelection()) | 285 | if (d->ui->m_onlineJobView->selectionModel()->hasSelection()) | ||
264 | slotSendSelectedJobs(); | 286 | slotSendSelectedJobs(); | ||
265 | else | 287 | else | ||
266 | slotSendAllSendableJobs(); | 288 | slotSendAllSendableJobs(); | ||
267 | } | 289 | } | ||
268 | 290 | | |||
269 | void KOnlineJobOutbox::slotSendAllSendableJobs() | 291 | void KOnlineJobOutboxView::slotSendAllSendableJobs() | ||
270 | { | 292 | { | ||
271 | QList<onlineJob> validJobs; | 293 | QList<onlineJob> validJobs; | ||
272 | foreach (const onlineJob& job, MyMoneyFile::instance()->onlineJobList()) { | 294 | foreach (const onlineJob& job, MyMoneyFile::instance()->onlineJobList()) { | ||
Context not available. | |||||
279 | // emit sendJobs(validJobs); | 301 | // emit sendJobs(validJobs); | ||
280 | } | 302 | } | ||
281 | 303 | | |||
282 | void KOnlineJobOutbox::slotSendSelectedJobs() | 304 | void KOnlineJobOutboxView::slotSendSelectedJobs() | ||
283 | { | 305 | { | ||
284 | Q_D(KOnlineJobOutbox); | 306 | Q_D(KOnlineJobOutboxView); | ||
285 | QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedRows(); | 307 | QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedRows(); | ||
286 | if (indexes.isEmpty()) | 308 | if (indexes.isEmpty()) | ||
287 | return; | 309 | return; | ||
Context not available. | |||||
310 | // emit sendJobs(validJobs); | 332 | // emit sendJobs(validJobs); | ||
311 | } | 333 | } | ||
312 | 334 | | |||
313 | void KOnlineJobOutbox::slotEditJob() | 335 | void KOnlineJobOutboxView::slotEditJob() | ||
314 | { | 336 | { | ||
315 | Q_D(KOnlineJobOutbox); | 337 | Q_D(KOnlineJobOutboxView); | ||
316 | QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedIndexes(); | 338 | QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedIndexes(); | ||
317 | if (!indexes.isEmpty()) { | 339 | if (!indexes.isEmpty()) { | ||
318 | QString jobId = d->ui->m_onlineJobView->model()->data(indexes.first(), onlineJobModel::OnlineJobId).toString(); | 340 | QString jobId = d->ui->m_onlineJobView->model()->data(indexes.first(), onlineJobModel::OnlineJobId).toString(); | ||
Context not available. | |||||
322 | } | 344 | } | ||
323 | } | 345 | } | ||
324 | 346 | | |||
325 | void KOnlineJobOutbox::slotEditJob(const QModelIndex &index) | 347 | void KOnlineJobOutboxView::slotEditJob(const QModelIndex &index) | ||
326 | { | 348 | { | ||
327 | Q_D(KOnlineJobOutbox); | 349 | Q_D(KOnlineJobOutboxView); | ||
328 | auto jobId = d->ui->m_onlineJobView->model()->data(index, onlineJobModel::OnlineJobId).toString(); | 350 | auto jobId = d->ui->m_onlineJobView->model()->data(index, onlineJobModel::OnlineJobId).toString(); | ||
329 | d->editJob(jobId); | 351 | d->editJob(jobId); | ||
330 | // emit editJob(jobId); | 352 | // emit editJob(jobId); | ||
331 | } | 353 | } | ||
332 | 354 | | |||
333 | void KOnlineJobOutbox::contextMenuEvent(QContextMenuEvent*) | 355 | void KOnlineJobOutboxView::contextMenuEvent(QContextMenuEvent*) | ||
334 | { | 356 | { | ||
335 | Q_D(KOnlineJobOutbox); | 357 | Q_D(KOnlineJobOutboxView); | ||
336 | QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedIndexes(); | 358 | QModelIndexList indexes = d->ui->m_onlineJobView->selectionModel()->selectedIndexes(); | ||
337 | if (!indexes.isEmpty()) { | 359 | if (!indexes.isEmpty()) { | ||
338 | // onlineJob job = d->ui->m_onlineJobView->model()->data(indexes.first(), onlineJobModel::OnlineJobRole).value<onlineJob>(); | 360 | // onlineJob job = d->ui->m_onlineJobView->model()->data(indexes.first(), onlineJobModel::OnlineJobRole).value<onlineJob>(); | ||
Context not available. | |||||
343 | /** | 365 | /** | ||
344 | * Do not know why this is needed, but all other views in KMyMoney have it. | 366 | * Do not know why this is needed, but all other views in KMyMoney have it. | ||
345 | */ | 367 | */ | ||
346 | void KOnlineJobOutbox::showEvent(QShowEvent* event) | 368 | void KOnlineJobOutboxView::showEvent(QShowEvent* event) | ||
347 | { | 369 | { | ||
348 | Q_D(KOnlineJobOutbox); | 370 | Q_D(KOnlineJobOutboxView); | ||
349 | if (d->m_needLoad) | 371 | if (d->m_needLoad) | ||
350 | d->init(); | 372 | d->init(); | ||
351 | 373 | | |||
Context not available. | |||||
354 | QWidget::showEvent(event); | 376 | QWidget::showEvent(event); | ||
355 | } | 377 | } | ||
356 | 378 | | |||
357 | void KOnlineJobOutbox::executeCustomAction(eView::Action action) | 379 | void KOnlineJobOutboxView::executeCustomAction(eView::Action action) | ||
358 | { | 380 | { | ||
381 | Q_D(KOnlineJobOutboxView); | ||||
359 | switch(action) { | 382 | switch(action) { | ||
360 | case eView::Action::SetDefaultFocus: | 383 | case eView::Action::SetDefaultFocus: | ||
361 | { | 384 | { | ||
362 | Q_D(KOnlineJobOutbox); | 385 | Q_D(KOnlineJobOutboxView); | ||
363 | QTimer::singleShot(0, d->ui->m_onlineJobView, SLOT(setFocus())); | 386 | QTimer::singleShot(0, d->ui->m_onlineJobView, SLOT(setFocus())); | ||
364 | } | 387 | } | ||
365 | break; | 388 | break; | ||
366 | 389 | | |||
390 | case eView::Action::InitializeAfterFileOpen: | ||||
391 | d->onlineJobsModel()->load(); | ||||
392 | break; | ||||
393 | | ||||
394 | case eView::Action::CleanupBeforeFileClose: | ||||
395 | d->onlineJobsModel()->unload(); | ||||
396 | break; | ||||
397 | | ||||
367 | default: | 398 | default: | ||
368 | break; | 399 | break; | ||
369 | } | 400 | } | ||
370 | } | 401 | } | ||
371 | 402 | | |||
372 | void KOnlineJobOutbox::updateActions(const MyMoneyObject& obj) | 403 | void KOnlineJobOutboxView::updateActions(const MyMoneyObject& obj) | ||
373 | { | 404 | { | ||
374 | Q_D(KOnlineJobOutbox); | 405 | Q_D(KOnlineJobOutboxView); | ||
375 | if (typeid(obj) != typeid(MyMoneyAccount) && | 406 | if (typeid(obj) != typeid(MyMoneyAccount) && | ||
376 | (obj.id().isEmpty() && d->m_currentAccount.id().isEmpty())) // do not disable actions that were already disabled))) | 407 | (obj.id().isEmpty() && d->m_currentAccount.id().isEmpty())) // do not disable actions that were already disabled))) | ||
377 | return; | 408 | return; | ||
Context not available. | |||||
380 | d->m_currentAccount = acc; | 411 | d->m_currentAccount = acc; | ||
381 | } | 412 | } | ||
382 | 413 | | |||
383 | void KOnlineJobOutbox::slotOnlineJobSave(onlineJob job) | 414 | void KOnlineJobOutboxView::slotOnlineJobSave(onlineJob job) | ||
384 | { | 415 | { | ||
385 | MyMoneyFileTransaction fileTransaction; | 416 | MyMoneyFileTransaction fileTransaction; | ||
386 | if (job.id().isEmpty()) | 417 | if (job.id().isEmpty()) | ||
Context not available. | |||||
391 | } | 422 | } | ||
392 | 423 | | |||
393 | /** @todo when onlineJob queue is used, continue here */ | 424 | /** @todo when onlineJob queue is used, continue here */ | ||
394 | void KOnlineJobOutbox::slotOnlineJobSend(onlineJob job) | 425 | void KOnlineJobOutboxView::slotOnlineJobSend(onlineJob job) | ||
395 | { | 426 | { | ||
396 | MyMoneyFileTransaction fileTransaction; | 427 | MyMoneyFileTransaction fileTransaction; | ||
397 | if (job.id().isEmpty()) | 428 | if (job.id().isEmpty()) | ||
Context not available. | |||||
405 | slotOnlineJobSend(jobList); | 436 | slotOnlineJobSend(jobList); | ||
406 | } | 437 | } | ||
407 | 438 | | |||
408 | void KOnlineJobOutbox::slotOnlineJobSend(QList<onlineJob> jobs) | 439 | void KOnlineJobOutboxView::slotOnlineJobSend(QList<onlineJob> jobs) | ||
409 | { | 440 | { | ||
410 | Q_D(KOnlineJobOutbox); | 441 | Q_D(KOnlineJobOutboxView); | ||
411 | MyMoneyFile *const kmmFile = MyMoneyFile::instance(); | 442 | MyMoneyFile *const kmmFile = MyMoneyFile::instance(); | ||
412 | QMultiMap<QString, onlineJob> jobsByPlugin; | 443 | QMultiMap<QString, onlineJob> jobsByPlugin; | ||
413 | 444 | | |||
Context not available. | |||||
467 | } | 498 | } | ||
468 | } | 499 | } | ||
469 | 500 | | |||
470 | void KOnlineJobOutbox::slotOnlineJobLog() | 501 | void KOnlineJobOutboxView::slotOnlineJobLog() | ||
471 | { | 502 | { | ||
472 | QStringList jobIds = this->selectedOnlineJobs(); | 503 | QStringList jobIds = this->selectedOnlineJobs(); | ||
473 | slotOnlineJobLog(jobIds); | 504 | slotOnlineJobLog(jobIds); | ||
474 | } | 505 | } | ||
475 | 506 | | |||
476 | void KOnlineJobOutbox::slotOnlineJobLog(const QStringList& onlineJobIds) | 507 | void KOnlineJobOutboxView::slotOnlineJobLog(const QStringList& onlineJobIds) | ||
477 | { | 508 | { | ||
478 | onlineJobMessagesView *const dialog = new onlineJobMessagesView(); | 509 | onlineJobMessagesView *const dialog = new onlineJobMessagesView(); | ||
479 | onlineJobMessagesModel *const model = new onlineJobMessagesModel(dialog); | 510 | onlineJobMessagesModel *const model = new onlineJobMessagesModel(dialog); | ||
Context not available. | |||||
484 | // Note: Objects are not deleted here, Qt's parent-child system has to do that. | 515 | // Note: Objects are not deleted here, Qt's parent-child system has to do that. | ||
485 | } | 516 | } | ||
486 | 517 | | |||
487 | void KOnlineJobOutbox::slotNewCreditTransfer() | 518 | void KOnlineJobOutboxView::slotNewCreditTransfer() | ||
488 | { | 519 | { | ||
489 | Q_D(KOnlineJobOutbox); | 520 | Q_D(KOnlineJobOutboxView); | ||
490 | auto *transferForm = new kOnlineTransferForm(this); | 521 | auto *transferForm = new kOnlineTransferForm(this); | ||
491 | if (!d->m_currentAccount.id().isEmpty()) { | 522 | if (!d->m_currentAccount.id().isEmpty()) { | ||
492 | transferForm->setCurrentAccount(d->m_currentAccount.id()); | 523 | transferForm->setCurrentAccount(d->m_currentAccount.id()); | ||
493 | } | 524 | } | ||
494 | connect(transferForm, &QDialog::rejected, transferForm, &QObject::deleteLater); | 525 | connect(transferForm, &QDialog::rejected, transferForm, &QObject::deleteLater); | ||
495 | connect(transferForm, &kOnlineTransferForm::acceptedForSave, this, &KOnlineJobOutbox::slotOnlineJobSave); | 526 | connect(transferForm, &kOnlineTransferForm::acceptedForSave, this, &KOnlineJobOutboxView::slotOnlineJobSave); | ||
496 | connect(transferForm, &kOnlineTransferForm::acceptedForSend, this, static_cast<void (KOnlineJobOutbox::*)(onlineJob)>(&KOnlineJobOutbox::slotOnlineJobSend)); | 527 | connect(transferForm, &kOnlineTransferForm::acceptedForSend, this, static_cast<void (KOnlineJobOutboxView::*)(onlineJob)>(&KOnlineJobOutboxView::slotOnlineJobSend)); | ||
497 | connect(transferForm, &QDialog::accepted, transferForm, &QObject::deleteLater); | 528 | connect(transferForm, &QDialog::accepted, transferForm, &QObject::deleteLater); | ||
498 | transferForm->show(); | 529 | transferForm->show(); | ||
499 | } | 530 | } | ||
Context not available. |