~ubuntu-branches/ubuntu/precise/kde-workspace/precise-security

« back to all changes in this revision

Viewing changes to debian/patches/Prevent_user_from_hiding_all_columns.patch

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Scott Kitterman, Jonathan Riddell
  • Date: 2012-09-07 18:06:44 UTC
  • mfrom: (0.1.1) (1.1.14)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: package-import@ubuntu.com-20120907180644-ye0r2bakv7nsd4tl
Tags: 4:4.8.5-0ubuntu0.1
[ Scott Kitterman ]
* New upstream bugfix release (LP: #1047417)
   - Drop patches previously cherrypicked from upstream:
      Remove_second_invisible_ProcessTable_widget.patch
      Fix_regression_that_you_couldnt_add_new_beams.patch
      Prevent_user_from_hiding_all_columns.patch
      observe_polkit_privileges_with_CanSuspend_CanResume.diff

[ Jonathan Riddell ]
* Add kde-workspace_4.8.5.orig-ksplash.tar.gz with ariya theme
  which was missed from tar by upsteram
* Add kubuntu_remove_horos_ksplash_theme.diff to remove horos theme

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From: John Tapsell <johnflux@gmail.com>
2
 
Date: Fri, 08 Jun 2012 13:31:34 +0000
3
 
Subject: Prevent the user from hiding all of the columns
4
 
X-Git-Url: http://quickgit.kde.org/?p=kde-workspace.git&amp;a=commitdiff&amp;h=3009ffd7c7f44214b72a72c8b92f37dd194193b1
5
 
---
6
 
Prevent the user from hiding all of the columns
7
 
 
8
 
BUIG: 299764
9
 
---
10
 
 
11
 
 
12
 
--- a/libs/ksysguard/processui/ksysguardprocesslist.cpp
13
 
+++ b/libs/ksysguard/processui/ksysguardprocesslist.cpp
14
 
@@ -427,7 +427,18 @@ void KSysGuardProcessList::showProcessCo
15
 
     QModelIndexList selectedIndexes = d->mUi->treeView->selectionModel()->selectedRows();
16
 
     int numProcesses = selectedIndexes.size();
17
 
 
18
 
-    if(numProcesses == 0) return;  //No processes selected, so no context menu
19
 
+    if(numProcesses == 0) {
20
 
+        //No processes selected, so no process context menu
21
 
+
22
 
+        //Check just incase we have no columns visible.  In which case show the column context menu
23
 
+        //so that users can unhide columns if there are no columns visible
24
 
+        for(int i = 0; i < d->mFilterModel.columnCount(); ++i) {
25
 
+            if(!d->mUi->treeView->header()->isSectionHidden(i))
26
 
+                return;
27
 
+        }
28
 
+        showColumnContextMenu(point);
29
 
+        return;
30
 
+    }
31
 
 
32
 
     QModelIndex realIndex = d->mFilterModel.mapToSource(selectedIndexes.at(0));
33
 
     KSysGuard::Process *process = reinterpret_cast<KSysGuard::Process *> (realIndex.internalPointer());
34
 
@@ -580,20 +591,31 @@ void KSysGuardProcessList::showColumnCon
35
 
     QMenu menu;
36
 
 
37
 
     QAction *action;
38
 
+
39
 
+    int num_headings = d->mFilterModel.columnCount();
40
 
+
41
 
     int index = d->mUi->treeView->header()->logicalIndexAt(point);
42
 
     if(index >= 0) {
43
 
-        //selected a column.  Give the option to hide it
44
 
-        action = new QAction(&menu);
45
 
-        action->setData(-index-1); //We set data to be negative (and minus 1) to hide a column, and positive to show a column
46
 
-        action->setText(i18n("Hide Column '%1'", d->mFilterModel.headerData(index, Qt::Horizontal, Qt::DisplayRole).toString()));
47
 
-        menu.addAction(action);
48
 
-        if(d->mUi->treeView->header()->sectionsHidden()) {
49
 
-            menu.addSeparator();
50
 
+        bool anyOtherVisibleColumns = false;
51
 
+        for(int i = 0; i < num_headings; ++i) {
52
 
+            if(i != index && !d->mUi->treeView->header()->isSectionHidden(i)) {
53
 
+                anyOtherVisibleColumns = true;
54
 
+                break;
55
 
+            }
56
 
+        }
57
 
+        if(anyOtherVisibleColumns) {
58
 
+            //selected a column.  Give the option to hide it
59
 
+            action = new QAction(&menu);
60
 
+            action->setData(-index-1); //We set data to be negative (and minus 1) to hide a column, and positive to show a column
61
 
+            action->setText(i18n("Hide Column '%1'", d->mFilterModel.headerData(index, Qt::Horizontal, Qt::DisplayRole).toString()));
62
 
+            menu.addAction(action);
63
 
+            if(d->mUi->treeView->header()->sectionsHidden()) {
64
 
+                menu.addSeparator();
65
 
+            }
66
 
         }
67
 
     }
68
 
 
69
 
     if(d->mUi->treeView->header()->sectionsHidden()) {
70
 
-        int num_headings = d->mFilterModel.columnCount();
71
 
         for(int i = 0; i < num_headings; ++i) {
72
 
             if(d->mUi->treeView->header()->isSectionHidden(i)) {
73
 
 #ifndef HAVE_XRES
74