LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File apper-c33ab740-file-install-crash.diff of Package apper.102 (Project openSUSE:12.1:Update)

commit c33ab740d91524d9db57fe26e6c568fa99537883
Author: Daniel Nicoletti <dantti85-pk@yahoo.com.br>
Date:   Thu Oct 20 12:12:45 2011 -0200

    Ensure we don't save config files on ~ it crashes on Requirements

diff --git a/ApperKCM/BrowseView.cpp b/ApperKCM/BrowseView.cpp
index d3e410c..c36052d 100644
--- a/ApperKCM/BrowseView.cpp
+++ b/ApperKCM/BrowseView.cpp
@@ -87,28 +87,26 @@ void BrowseView::init(Transaction::Roles roles)
     KConfigGroup viewGroup(&config, "BrowseView");
 
     // Version
+    packageView->header()->setSectionHidden(PackageModel::VersionCol, true);
     m_showPackageVersion = new QAction(i18n("Show Versions"), this);
     m_showPackageVersion->setCheckable(true);
-    m_showPackageVersion->setChecked(viewGroup.readEntry("ShowApplicationVersions", true));
-    showVersions(m_showPackageVersion->isChecked());
-    connect(m_showPackageVersion, SIGNAL(toggled(bool)),
-            this, SLOT(showVersions(bool)));
+    connect(m_showPackageVersion, SIGNAL(toggled(bool)), this, SLOT(showVersions(bool)));
+    m_showPackageVersion->setChecked(viewGroup.readEntry("ShowApplicationVersions", true));    
 
     // Arch
+    packageView->header()->setSectionHidden(PackageModel::ArchCol, true);
     m_showPackageArch = new QAction(i18n("Show Architectures"), this);
     m_showPackageArch->setCheckable(true);
+    connect(m_showPackageArch, SIGNAL(toggled(bool)), this, SLOT(showArchs(bool)));
     m_showPackageArch->setChecked(viewGroup.readEntry("ShowApplicationArchitectures", false));
-    showArchs(m_showPackageArch->isChecked());
-    connect(m_showPackageArch, SIGNAL(toggled(bool)),
-            this, SLOT(showArchs(bool)));
 
     // Sizes
+    packageView->header()->setSectionHidden(PackageModel::SizeCol, true);
     m_showPackageSizes = new QAction(i18n("Show Sizes"), this);
     m_showPackageSizes->setCheckable(true);
+    connect(m_showPackageSizes, SIGNAL(toggled(bool)), this, SLOT(showSizes(bool)));
     m_showPackageSizes->setChecked(viewGroup.readEntry("ShowPackageSizes", false));
-    showSizes(m_showPackageSizes->isChecked());
-    connect(m_showPackageSizes, SIGNAL(toggled(bool)),
-            this, SLOT(showSizes(bool)));
+
 
     // Ensure the index is visible when the packageDetails appears
     connect(packageDetails, SIGNAL(ensureVisible(QModelIndex)),
@@ -117,11 +115,6 @@ void BrowseView::init(Transaction::Roles roles)
 
 BrowseView::~BrowseView()
 {
-    KConfig config("apper");
-    KConfigGroup viewGroup(&config, "BrowseView");
-    viewGroup.writeEntry("ShowApplicationVersions", m_showPackageVersion->isChecked());
-    viewGroup.writeEntry("ShowApplicationArchitectures", m_showPackageArch->isChecked());
-    viewGroup.writeEntry("ShowPackageSizes", m_showPackageSizes->isChecked());
 }
 
 bool BrowseView::showPageHeader() const
@@ -136,18 +129,27 @@ PackageModel* BrowseView::model() const
 
 void BrowseView::showVersions(bool enabled)
 {
+    KConfig config("apper");
+    KConfigGroup viewGroup(&config, "BrowseView");
+    viewGroup.writeEntry("ShowApplicationVersions", enabled);
     packageView->header()->setSectionHidden(PackageModel::VersionCol, !enabled);
     packageDetails->hidePackageVersion(enabled);
 }
 
 void BrowseView::showArchs(bool enabled)
 {
+    KConfig config("apper");
+    KConfigGroup viewGroup(&config, "BrowseView");
+    viewGroup.writeEntry("ShowApplicationArchitectures", enabled);
     packageView->header()->setSectionHidden(PackageModel::ArchCol, !enabled);
     packageDetails->hidePackageArch(enabled);
 }
 
 void BrowseView::showSizes(bool enabled)
 {
+    KConfig config("apper");
+    KConfigGroup viewGroup(&config, "BrowseView");
+    viewGroup.writeEntry("ShowPackageSizes", enabled);
     packageView->header()->setSectionHidden(PackageModel::SizeCol, !enabled);
     packageDetails->hidePackageArch(enabled);
     if (enabled) {
diff --git a/ApperKCM/Updater/Updater.cpp b/ApperKCM/Updater/Updater.cpp
index d7505a6..72cea8e 100644
--- a/ApperKCM/Updater/Updater.cpp
+++ b/ApperKCM/Updater/Updater.cpp
@@ -104,37 +104,29 @@ Updater::Updater(Transaction::Roles roles, QWidget *parent) :
     KConfigGroup viewGroup(&config, "UpdateView");
 
     // versions
+    packageView->header()->setSectionHidden(PackageModel::VersionCol, true);
     m_showPackageVersion = new QAction(i18n("Show Versions"), this);
     m_showPackageVersion->setCheckable(true);
+    connect(m_showPackageVersion, SIGNAL(toggled(bool)), this, SLOT(showVersions(bool)));
     m_showPackageVersion->setChecked(viewGroup.readEntry("ShowVersions", true));
-    showVersions(m_showPackageVersion->isChecked());
-    connect(m_showPackageVersion, SIGNAL(toggled(bool)),
-            this, SLOT(showVersions(bool)));
 
     // Arch
+    packageView->header()->setSectionHidden(PackageModel::ArchCol, true);
     m_showPackageArch = new QAction(i18n("Show Architectures"), this);
     m_showPackageArch->setCheckable(true);
-    m_showPackageArch->setChecked(viewGroup.readEntry("ShowArchs", false));
-    showArchs(m_showPackageArch->isChecked());
-    connect(m_showPackageArch, SIGNAL(toggled(bool)),
-            this, SLOT(showArchs(bool)));
+    connect(m_showPackageArch, SIGNAL(toggled(bool)), this, SLOT(showArchs(bool)));
+    m_showPackageArch->setChecked(viewGroup.readEntry("ShowArchs", false));    
 
     // Sizes
+    packageView->header()->setSectionHidden(PackageModel::SizeCol, true);
     m_showPackageSize = new QAction(i18n("Show Sizes"), this);
     m_showPackageSize->setCheckable(true);
+    connect(m_showPackageSize, SIGNAL(toggled(bool)), this, SLOT(showSizes(bool)));
     m_showPackageSize->setChecked(viewGroup.readEntry("ShowSizes", true));
-    showSizes(m_showPackageSize->isChecked());
-    connect(m_showPackageSize, SIGNAL(toggled(bool)),
-            this, SLOT(showSizes(bool)));
 }
 
 Updater::~Updater()
 {
-    KConfig config("apper");
-    KConfigGroup viewGroup(&config, "UpdateView");
-    viewGroup.writeEntry("ShowVersions", m_showPackageVersion->isChecked());
-    viewGroup.writeEntry("ShowArchs", m_showPackageArch->isChecked());
-    viewGroup.writeEntry("ShowSizes", m_showPackageSize->isChecked());
 }
 
 void Updater::setSelected(bool selected)
@@ -144,16 +136,25 @@ void Updater::setSelected(bool selected)
 
 void Updater::showVersions(bool enabled)
 {
+    KConfig config("apper");
+    KConfigGroup viewGroup(&config, "UpdateView");
+    viewGroup.writeEntry("ShowVersions", enabled);
     packageView->header()->setSectionHidden(PackageModel::VersionCol, !enabled);
 }
 
 void Updater::showArchs(bool enabled)
 {
+    KConfig config("apper");
+    KConfigGroup viewGroup(&config, "UpdateView");
+    viewGroup.writeEntry("ShowArchs", enabled);
     packageView->header()->setSectionHidden(PackageModel::ArchCol, !enabled);
 }
 
 void Updater::showSizes(bool enabled)
 {
+    KConfig config("apper");
+    KConfigGroup viewGroup(&config, "UpdateView");
+    viewGroup.writeEntry("ShowSizes", enabled);
     packageView->header()->setSectionHidden(PackageModel::SizeCol, !enabled);
 }
 
diff --git a/libapper/ApplicationLauncher.cpp b/libapper/ApplicationLauncher.cpp
index 540306e..26022d4 100644
--- a/libapper/ApplicationLauncher.cpp
+++ b/libapper/ApplicationLauncher.cpp
@@ -43,11 +43,6 @@ ApplicationLauncher::ApplicationLauncher(QWidget *parent) :
 
 ApplicationLauncher::~ApplicationLauncher()
 {
-    if (ui->showCB->isChecked()) {
-        KConfig config("apper");
-        KConfigGroup transactionGroup(&config, "Transaction");
-        transactionGroup.writeEntry("ShowApplicationLauncher", false);
-    }
     delete ui;
 }
 
@@ -122,4 +117,11 @@ void ApplicationLauncher::itemClicked(const QModelIndex &index)
     KToolInvocation::startServiceByDesktopPath(index.data(Qt::UserRole).toString());
 }
 
+void ApplicationLauncher::on_showCB_toggled(bool checked)
+{
+    KConfig config("apper");
+    KConfigGroup transactionGroup(&config, "Transaction");
+    transactionGroup.writeEntry("ShowApplicationLauncher", !checked);
+}
+
 #include "ApplicationLauncher.moc"
diff --git a/libapper/ApplicationLauncher.h b/libapper/ApplicationLauncher.h
index 530ec13..8a2a6a0 100644
--- a/libapper/ApplicationLauncher.h
+++ b/libapper/ApplicationLauncher.h
@@ -50,6 +50,7 @@ public slots:
 
 private slots:
     void itemClicked(const QModelIndex &index);
+    void on_showCB_toggled(bool checked);
 
 private:
     bool m_embed;
diff --git a/libapper/ApplicationsDelegate.cpp b/libapper/ApplicationsDelegate.cpp
index b3a732c..05e3907 100644
--- a/libapper/ApplicationsDelegate.cpp
+++ b/libapper/ApplicationsDelegate.cpp
@@ -117,10 +117,7 @@ void ApplicationsDelegate::paint(QPainter *painter,
         int left = opt.rect.left();
         int width = opt.rect.width();
 
-        Package::Info info;
-        info = static_cast<Package::Info>(index.data(PackageModel::InfoRole).toUInt());
         QString pkgSummary = index.data(PackageModel::SummaryRole).toString();
-
         if (!pkgSummary.isEmpty()) {
             if (leftToRight) {
                 pkgSummary.prepend("- ");
diff --git a/libapper/Requirements.cpp b/libapper/Requirements.cpp
index 5039d64..bf20de0 100644
--- a/libapper/Requirements.cpp
+++ b/libapper/Requirements.cpp
@@ -144,15 +144,6 @@ Requirements::Requirements(SimulateModel *model, QWidget *parent) :
 
 Requirements::~Requirements()
 {
-    // save size
-    KConfig config("apper");
-    KConfigGroup requirementsDialog(&config, "requirementsDialog");
-    saveDialogSize(requirementsDialog);
-
-    if (!m_hideAutoConfirm) {
-        requirementsDialog.writeEntry("autoConfirm", ui->confirmCB->isChecked());
-    }
-    config.sync();
     delete ui;
 }
 
@@ -172,6 +163,19 @@ bool Requirements::shouldShow() const
     return (m_shouldShow && !ui->confirmCB->isChecked());
 }
 
+void Requirements::on_confirmCB_Toggled(bool checked)
+{
+    // save size
+    KConfig config("apper");
+    KConfigGroup requirementsDialog(&config, "requirementsDialog");
+    saveDialogSize(requirementsDialog);
+
+    if (!m_hideAutoConfirm) {
+        requirementsDialog.writeEntry("autoConfirm", checked);
+    }
+    config.sync();
+}
+
 void Requirements::actionClicked(int type)
 {
     SimulateModel *model = static_cast<SimulateModel*>(ui->packageView->model());
diff --git a/libapper/Requirements.h b/libapper/Requirements.h
index 6cffcc1..42bb721 100644
--- a/libapper/Requirements.h
+++ b/libapper/Requirements.h
@@ -43,6 +43,7 @@ public slots:
     bool shouldShow() const;
 
 private slots:
+    void on_confirmCB_Toggled(bool checked);
     void actionClicked(int type);
 
 private: