Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/views/ktagsview.cpp
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Line(s) | |||||
77 | { | 77 | { | ||
78 | } | 78 | } | ||
79 | 79 | | |||
80 | // *** KTagsView Implementation *** | 80 | // *** KTagsView Implementation *** | ||
81 | 81 | | |||
82 | KTagsView::KTagsView(QWidget *parent) : | 82 | KTagsView::KTagsView(QWidget *parent) : | ||
83 | QWidget(parent), | 83 | QWidget(parent), | ||
84 | m_needReload(false), | 84 | m_needReload(false), | ||
85 | m_needLoad(true), | ||||
85 | m_inSelection(false), | 86 | m_inSelection(false), | ||
86 | m_allowEditing(true), | 87 | m_allowEditing(true), | ||
87 | m_tagFilterType(0) | 88 | m_tagFilterType(0) | ||
88 | { | 89 | { | ||
90 | } | ||||
91 | | ||||
92 | KTagsView::~KTagsView() | ||||
93 | { | ||||
94 | if (!m_needLoad) { | ||||
95 | // remember the splitter settings for startup | ||||
96 | KConfigGroup grp = KSharedConfig::openConfig()->group("Last Use Settings"); | ||||
97 | grp.writeEntry("KTagsViewSplitterSize", m_splitter->saveState()); | ||||
98 | grp.sync(); | ||||
99 | } | ||||
100 | } | ||||
101 | | ||||
102 | void KTagsView::init() | ||||
103 | { | ||||
104 | m_needLoad = false; | ||||
89 | setupUi(this); | 105 | setupUi(this); | ||
90 | 106 | | |||
91 | m_filterProxyModel = new AccountNamesFilterProxyModel(this); | 107 | m_filterProxyModel = new AccountNamesFilterProxyModel(this); | ||
92 | m_filterProxyModel->addAccountGroup(MyMoneyAccount::Asset); | 108 | m_filterProxyModel->addAccountGroup(MyMoneyAccount::Asset); | ||
93 | m_filterProxyModel->addAccountGroup(MyMoneyAccount::Liability); | 109 | m_filterProxyModel->addAccountGroup(MyMoneyAccount::Liability); | ||
94 | m_filterProxyModel->addAccountGroup(MyMoneyAccount::Income); | 110 | m_filterProxyModel->addAccountGroup(MyMoneyAccount::Income); | ||
95 | m_filterProxyModel->addAccountGroup(MyMoneyAccount::Expense); | 111 | m_filterProxyModel->addAccountGroup(MyMoneyAccount::Expense); | ||
96 | m_filterProxyModel->setSourceModel(Models::instance()->accountsModel()); | 112 | m_filterProxyModel->setSourceModel(Models::instance()->accountsModel()); | ||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | |||||
183 | // At start we haven't any tag selected | 199 | // At start we haven't any tag selected | ||
184 | m_tabWidget->setEnabled(false); // disable tab widget | 200 | m_tabWidget->setEnabled(false); // disable tab widget | ||
185 | m_deleteButton->setEnabled(false); // disable delete and rename button | 201 | m_deleteButton->setEnabled(false); // disable delete and rename button | ||
186 | m_renameButton->setEnabled(false); | 202 | m_renameButton->setEnabled(false); | ||
187 | m_tag = MyMoneyTag(); // make sure we don't access an undefined tag | 203 | m_tag = MyMoneyTag(); // make sure we don't access an undefined tag | ||
188 | clearItemData(); | 204 | clearItemData(); | ||
189 | } | 205 | } | ||
190 | 206 | | |||
191 | KTagsView::~KTagsView() | | |||
192 | { | | |||
193 | // remember the splitter settings for startup | | |||
194 | KConfigGroup grp = KSharedConfig::openConfig()->group("Last Use Settings"); | | |||
195 | grp.writeEntry("KTagsViewSplitterSize", m_splitter->saveState()); | | |||
196 | grp.sync(); | | |||
197 | } | | |||
198 | | ||||
199 | void KTagsView::slotStartRename(QListWidgetItem* item) | 207 | void KTagsView::slotStartRename(QListWidgetItem* item) | ||
200 | { | 208 | { | ||
201 | m_allowEditing = true; | 209 | m_allowEditing = true; | ||
202 | m_tagsList->editItem(item); | 210 | m_tagsList->editItem(item); | ||
203 | } | 211 | } | ||
204 | 212 | | |||
205 | void KTagsView::slotRenameButtonCliked() | 213 | void KTagsView::slotRenameButtonCliked() | ||
206 | { | 214 | { | ||
▲ Show 20 Lines • Show All 278 Lines • ▼ Show 20 Line(s) | 492 | } catch (const MyMoneyException &e) { | |||
485 | KMessageBox::detailedSorry(0, i18n("Unable to modify tag"), | 493 | KMessageBox::detailedSorry(0, i18n("Unable to modify tag"), | ||
486 | i18n("%1 thrown in %2:%3", e.what(), e.file(), e.line())); | 494 | i18n("%1 thrown in %2:%3", e.what(), e.file(), e.line())); | ||
487 | } | 495 | } | ||
488 | } | 496 | } | ||
489 | } | 497 | } | ||
490 | 498 | | |||
491 | void KTagsView::showEvent(QShowEvent* event) | 499 | void KTagsView::showEvent(QShowEvent* event) | ||
492 | { | 500 | { | ||
501 | if (m_needLoad) | ||||
502 | init(); | ||||
503 | | ||||
493 | emit aboutToShow(); | 504 | emit aboutToShow(); | ||
494 | 505 | | |||
495 | if (m_needReload) { | 506 | if (m_needReload) { | ||
496 | loadTags(); | 507 | loadTags(); | ||
497 | m_needReload = false; | 508 | m_needReload = false; | ||
498 | } | 509 | } | ||
499 | 510 | | |||
500 | // don't forget base class implementation | 511 | // don't forget base class implementation | ||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |