Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.3
apper
0018-Add-a-feature-to-tell-the-user-to-refresh-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0018-Add-a-feature-to-tell-the-user-to-refresh-his-cache-.patch of Package apper
From 7a633895144838dca5b9850308dffd030ff24946 Mon Sep 17 00:00:00 2001 From: Daniel Nicoletti <dantti12@gmail.com> Date: Fri, 18 Jan 2013 00:58:04 -0200 Subject: [PATCH 18/20] Add a feature to tell the user to refresh his cache after a repo change --- ApperKCM/ApperKCM.cpp | 17 ++++++++++++++--- ApperKCM/Settings/Settings.cpp | 9 +++++++++ ApperKCM/Settings/Settings.h | 1 + ApperKCM/Settings/Settings.ui | 19 +++++++++++++++++-- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/ApperKCM/ApperKCM.cpp b/ApperKCM/ApperKCM.cpp index 6189149..74f7fd8 100644 --- a/ApperKCM/ApperKCM.cpp +++ b/ApperKCM/ApperKCM.cpp @@ -488,6 +488,8 @@ void ApperKCM::setPage(const QString &page) m_settingsPage = new Settings(m_roles, this); connect(m_settingsPage, SIGNAL(changed(bool)), this, SLOT(checkChanged())); + connect(m_settingsPage, SIGNAL(refreshCache()), + SLOT(refreshCache())); ui->stackedWidget->addWidget(m_settingsPage); connect(ui->generalSettingsPB, SIGNAL(toggled(bool)), @@ -748,6 +750,8 @@ void ApperKCM::refreshCache() { emit changed(false); + QWidget *currentWidget = ui->stackedWidget->currentWidget(); + PkTransactionWidget *transactionW = new PkTransactionWidget(this); connect(transactionW, SIGNAL(titleChangedProgress(QString)), this, SIGNAL(caption(QString))); QPointer<PkTransaction> transaction = new PkTransaction(transactionW); @@ -776,9 +780,16 @@ void ApperKCM::refreshCache() m_forceRefreshCache = transaction->exitStatus() == PkTransaction::Failed; } - // Go back to the updates page - m_updaterPage->getUpdates(); - setPage("updates"); + if (m_updaterPage) { + m_updaterPage->getUpdates(); + } + + if (currentWidget == m_settingsPage) { + setPage("settings"); + } else { + setPage("updates"); + } + QTimer::singleShot(0, this, SLOT(checkChanged())); } diff --git a/ApperKCM/Settings/Settings.cpp b/ApperKCM/Settings/Settings.cpp index d526494..7745611 100644 --- a/ApperKCM/Settings/Settings.cpp +++ b/ApperKCM/Settings/Settings.cpp @@ -50,6 +50,13 @@ Settings::Settings(Transaction::Roles roles, QWidget *parent) : { ui->setupUi(this); + QAction *action = new QAction(i18n("Refresh Cache"), this); + connect(action, SIGNAL(triggered()), SIGNAL(refreshCache())); + connect(action, SIGNAL(triggered()), ui->messageWidget, SLOT(animatedHide())); + ui->messageWidget->addAction(action); + ui->messageWidget->setText(i18n("A repository was changed, it's highly recommended to refresh the cache")); + ui->messageWidget->hide(); + if (!(m_roles & Transaction::RoleRefreshCache)) { ui->intervalL->setEnabled(false); ui->intervalCB->setEnabled(false); @@ -62,6 +69,8 @@ Settings::Settings(Transaction::Roles roles, QWidget *parent) : m_originModel = new OriginModel(this); connect(m_originModel, SIGNAL(refreshRepoList()), SLOT(refreshRepoModel())); + connect(m_originModel, SIGNAL(refreshRepoList()), + ui->messageWidget, SLOT(animatedShow())); QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this); proxy->setDynamicSortFilter(true); proxy->setSourceModel(m_originModel); diff --git a/ApperKCM/Settings/Settings.h b/ApperKCM/Settings/Settings.h index f73d91d..29d48ae 100644 --- a/ApperKCM/Settings/Settings.h +++ b/ApperKCM/Settings/Settings.h @@ -51,6 +51,7 @@ public slots: signals: void changed(bool state); + void refreshCache(); private slots: void refreshRepoModel(); diff --git a/ApperKCM/Settings/Settings.ui b/ApperKCM/Settings/Settings.ui index 9ba5837..b4bfd80 100644 --- a/ApperKCM/Settings/Settings.ui +++ b/ApperKCM/Settings/Settings.ui @@ -15,18 +15,21 @@ </property> <layout class="QGridLayout" name="gridLayout_2"> <property name="verticalSpacing"> - <number>1</number> + <number>0</number> </property> <property name="margin"> <number>0</number> </property> - <item row="0" column="0"> + <item row="1" column="0"> <widget class="QStackedWidget" name="stackedWidget"> <property name="currentIndex"> <number>0</number> </property> <widget class="QWidget" name="page"> <layout class="QGridLayout" name="gridLayout_3"> + <property name="margin"> + <number>0</number> + </property> <item row="0" column="0"> <widget class="QWidget" name="widget" native="true"> <layout class="QHBoxLayout" name="horizontalLayout"> @@ -199,6 +202,9 @@ </widget> <widget class="QWidget" name="page_2"> <layout class="QGridLayout" name="gridLayout"> + <property name="margin"> + <number>0</number> + </property> <item row="0" column="0" colspan="3"> <widget class="QTreeView" name="originTV"> <property name="editTriggers"> @@ -252,6 +258,9 @@ </widget> </widget> </item> + <item row="0" column="0"> + <widget class="KMessageWidget" name="messageWidget" native="true"/> + </item> </layout> </widget> <customwidgets> @@ -260,6 +269,12 @@ <extends>QComboBox</extends> <header>kcombobox.h</header> </customwidget> + <customwidget> + <class>KMessageWidget</class> + <extends>QWidget</extends> + <header>KMessageWidget</header> + <container>1</container> + </customwidget> </customwidgets> <resources/> <connections/> -- 1.8.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor