[kde-doc-english] [ark] /: Add config option to set default open action

Ragnar Thomsen rthomsen6 at gmail.com
Mon Oct 19 19:15:06 UTC 2015


Git commit 35a101bdf9d6c5b548ba251be9c81583a03491ca by Ragnar Thomsen.
Committed on 19/10/2015 at 19:14.
Pushed by rthomsen into branch 'master'.

Add config option to set default open action

A checkbox is added in the Preview Settings dialog, which allows to
choose between Preview and Open Action when activating an archive entry,
e.g. by clicking or selecting and pressing Return.

The Preview action is assigned the default keyboard shortcut CTRL+P.

Differential Revision: D411

GUI:

M  +8    -0    kerfuffle/ark.kcfg
M  +78   -22   kerfuffle/previewsettings.ui
M  +2    -2    part/part.cpp

http://commits.kde.org/ark/35a101bdf9d6c5b548ba251be9c81583a03491ca

diff --git a/kerfuffle/ark.kcfg b/kerfuffle/ark.kcfg
index 8da488b..27d2fa9 100644
--- a/kerfuffle/ark.kcfg
+++ b/kerfuffle/ark.kcfg
@@ -29,6 +29,14 @@
 		</entry>
 	</group>
 	<group name="Preview">
+		<entry name="defaultOpenAction" type="Enum">
+			<label>Default action when opening archive entries.</label>
+			<choices>
+				<choice name="Preview"/>
+				<choice name="Open"/>
+			</choices>
+			<default>Preview</default>
+		</entry>
 		<entry name="limitPreviewFileSize" type="Bool">
 			<label>Whether to limit the preview according to file size.</label>
 			<default>true</default>
diff --git a/kerfuffle/previewsettings.ui b/kerfuffle/previewsettings.ui
index 7e1e440..d135f32 100644
--- a/kerfuffle/previewsettings.ui
+++ b/kerfuffle/previewsettings.ui
@@ -15,15 +15,40 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <widget class="QWidget" name="sizeLimitWidget" native="true">
-     <layout class="QHBoxLayout" name="horizontalLayout">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>When clicking a file in an archive or pressing the Return key:</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="kcfg_defaultOpenAction">
+     <property name="title">
+      <string/>
+     </property>
+     <property name="flat">
+      <bool>true</bool>
+     </property>
+     <property name="checkable">
+      <bool>false</bool>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_3">
+      <property name="leftMargin">
+       <number>0</number>
+      </property>
+      <property name="topMargin">
+       <number>0</number>
+      </property>
+      <property name="rightMargin">
+       <number>0</number>
+      </property>
+      <property name="bottomMargin">
+       <number>0</number>
+      </property>
       <item>
-       <widget class="QCheckBox" name="kcfg_limitPreviewFileSize">
-        <property name="enabled">
-         <bool>true</bool>
-        </property>
+       <widget class="QRadioButton" name="Preview">
         <property name="text">
-         <string>Disable preview for files larger than:</string>
+         <string>Pre&view the file with internal previewer</string>
         </property>
         <property name="checked">
          <bool>true</bool>
@@ -31,21 +56,9 @@
        </widget>
       </item>
       <item>
-       <widget class="QSpinBox" name="kcfg_previewFileSizeLimit">
-        <property name="suffix">
-         <string> megabytes</string>
-        </property>
-        <property name="minimum">
-         <number>10</number>
-        </property>
-        <property name="maximum">
-         <number>10000</number>
-        </property>
-        <property name="singleStep">
-         <number>10</number>
-        </property>
-        <property name="value">
-         <number>200</number>
+       <widget class="QRadioButton" name="Open">
+        <property name="text">
+         <string>Ope&n the file with associated application</string>
         </property>
        </widget>
       </item>
@@ -53,6 +66,49 @@
     </widget>
    </item>
    <item>
+    <widget class="Line" name="line">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QCheckBox" name="kcfg_limitPreviewFileSize">
+       <property name="enabled">
+        <bool>true</bool>
+       </property>
+       <property name="text">
+        <string>Disable preview for files larger than:</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QSpinBox" name="kcfg_previewFileSizeLimit">
+       <property name="suffix">
+        <string> megabytes</string>
+       </property>
+       <property name="minimum">
+        <number>10</number>
+       </property>
+       <property name="maximum">
+        <number>10000</number>
+       </property>
+       <property name="singleStep">
+        <number>10</number>
+       </property>
+       <property name="value">
+        <number>200</number>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
     <spacer name="verticalSpacer">
      <property name="orientation">
       <enum>Qt::Vertical</enum>
diff --git a/part/part.cpp b/part/part.cpp
index 6fb7271..344efc5 100644
--- a/part/part.cpp
+++ b/part/part.cpp
@@ -225,7 +225,7 @@ void Part::slotActivated(QModelIndex)
     // so do nothing if CTRL or SHIFT key is pressed.
     if (QGuiApplication::keyboardModifiers() != Qt::ShiftModifier &&
         QGuiApplication::keyboardModifiers() != Qt::ControlModifier) {
-        slotOpenEntry(Preview);
+        ArkSettings::defaultOpenAction() == ArkSettings::EnumDefaultOpenAction::Preview ? slotOpenEntry(Preview) : slotOpenEntry(OpenFile);
     }
 }
 
@@ -262,7 +262,7 @@ void Part::setupActions()
     m_previewAction->setText(i18nc("to preview a file inside an archive", "Pre&view"));
     m_previewAction->setIcon(QIcon::fromTheme(QStringLiteral("document-preview-archive")));
     m_previewAction->setStatusTip(i18n("Click to preview the selected file"));
-    actionCollection()->setDefaultShortcut(m_previewAction, Qt::Key_Space);
+    actionCollection()->setDefaultShortcut(m_previewAction, Qt::CTRL + Qt::Key_P);
     connect(m_previewAction, SIGNAL(triggered(bool)), m_signalMapper, SLOT(map()));
     m_signalMapper->setMapping(m_previewAction, Preview);
 


More information about the kde-doc-english mailing list