[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kdepim/enterprise4/kdelibs-4.0.83/kio
From: Jaroslaw Staniek <js () iidea ! pl>
Date: 2008-07-10 17:42:09
Message-ID: 1215711729.185496.32108.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 830530 by staniek:
Native "Open With" dialog on Windows (by default).
This allows to use (and associate) given file extensions with any Windows application \
directly, as users expect.
- moved KRun::KRunPrivate declaration to krun_p.h
- added KRun::KRunPrivate::displayNativeOpenWithDialog() for Windows only
in krun_win.cpp
- added a note to KOpenWithDialog that using KRun::displayOpenWithDialog()
is recommended
Also reported in http://intevation.de/roundup/kolab/issue2766
(reviewed backported from trunk r830529)
M +1 -0 CMakeLists.txt
M +4 -1 kfile/kopenwithdialog.h
M +21 -55 kio/krun.cpp
M +128 -69 kio/krun_p.h
--- branches/kdepim/enterprise4/kdelibs-4.0.83/kio/CMakeLists.txt #830529:830530
@@ -131,6 +131,7 @@
if(WIN32)
set(kiocore_STAT_SRCS ${kiocore_STAT_SRCS}
kio/kdirwatch_win.cpp
+ kio/krun_win.cpp
)
endif(WIN32)
--- branches/kdepim/enterprise4/kdelibs-4.0.83/kio/kfile/kopenwithdialog.h \
#830529:830530 @@ -29,8 +29,11 @@
class KOpenWithDialogPrivate;
/**
- * "Open with" dialog box.
+ * "Open With" dialog box.
*
+ * @note To let the user choose an application and run it immediately,
+ * use simpler KRun::displayOpenWithDialog().
+ *
* @author David Faure <faure@kde.org>
*/
class KIO_EXPORT KOpenWithDialog : public KDialog
--- branches/kdepim/enterprise4/kdelibs-4.0.83/kio/kio/krun.cpp #830529:830530
@@ -31,7 +31,6 @@
#include <sys/stat.h>
#include <QtGui/QWidget>
-#include <QtCore/QPointer>
#include "kmimetypetrader.h"
#include "kmimetype.h"
@@ -71,61 +70,19 @@
#include <kwindowsystem.h>
#endif
-class KRun::KRunPrivate
+KRun::KRunPrivate::KRunPrivate(KRun *parent)
+ : q(parent),
+ m_showingDialog(false)
{
-public:
- KRunPrivate(KRun *parent)
- : q(parent),
- m_showingDialog(false)
- {
- }
+}
- void init (const KUrl& url, QWidget* window, mode_t mode,
- bool isLocalFile, bool showProgressInfo, const QByteArray& asn);
+void KRun::KRunPrivate::startTimer()
+{
+ m_timer.start(0);
+}
- // This helper method makes debugging easier: a single breakpoint for all
- // the code paths that start the timer - at least from KRun itself.
- // TODO: add public method startTimer() and deprecate timer() accessor,
- // starting is the only valid use of the timer in subclasses (BrowserRun, \
KHTMLRun and KonqRun)
- void startTimer() {
- m_timer.start(0);
- }
+// ---------------------------------------------------------------------------
- KRun *q;
- bool m_showingDialog;
- bool m_runExecutables;
-
- QString m_preferredService;
- QString m_externalBrowser;
- QString m_localPath;
- QString m_suggestedFileName;
- QPointer <QWidget> m_window;
- QByteArray m_asn;
- KUrl m_strURL;
- bool m_bFault;
- bool m_bAutoDelete;
- bool m_bProgressInfo;
- bool m_bFinished;
- KIO::Job * m_job;
- QTimer m_timer;
-
- /**
- * Used to indicate that the next action is to scan the file.
- * This action is invoked from slotTimeout.
- */
- bool m_bScanFile;
- bool m_bIsDirectory;
-
- /**
- * Used to indicate that the next action is to initialize.
- * This action is invoked from slotTimeout
- */
- bool m_bInit;
-
- bool m_bIsLocalFile;
- mode_t m_mode;
-};
-
bool KRun::isExecutableFile( const KUrl& url, const QString &mimetype )
{
if ( !url.isLocalFile() )
@@ -211,15 +168,24 @@
return KRun::run( *offer, lst, window, tempFile, suggestedFileName, asn );
}
-bool KRun::displayOpenWithDialog( const KUrl::List& lst, QWidget* window, bool \
tempFiles, const QString& suggestedFileName,
- const QByteArray& asn )
+bool KRun::displayOpenWithDialog( const KUrl::List& lst, QWidget* window, bool \
tempFiles, + const QString& suggestedFileName, \
const QByteArray& asn ) {
if (!KAuthorized::authorizeKAction("openwith"))
{
- KMessageBox::sorry(window, i18n("You are not authorized to select an \
application to open this file.")); + KMessageBox::sorry(window,
+ i18n("You are not authorized to select an application to open this \
file.")); return false;
}
+#ifdef Q_WS_WIN
+ KConfigGroup cfgGroup(KGlobal::config(), "KOpenWithDialog Settings");
+ if (cfgGroup.readEntry("Native", true))
+ {
+ return KRun::KRunPrivate::displayNativeOpenWithDialog( lst, window, tempFiles,
+ suggestedFileName, asn );
+ }
+#endif
KOpenWithDialog l( lst, i18n("Open with:"), QString(), window );
if ( l.exec() )
{
--- branches/kdepim/enterprise4/kdelibs-4.0.83/kio/kio/krun_p.h #830529:830530
@@ -1,69 +1,128 @@
-// -*- mode: c++; c-basic-offset: 2 -*-
-/* This file is part of the KDE project
- Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
- Copyright (C) 2006 David Faure <faure@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef KRUN_P_H
-#define KRUN_P_H
-
-#include <QtCore/QObject>
-#include "kprocess.h"
-#include "kstartupinfo.h"
-
-/**
- * @internal
- * This class watches a process launched by KRun.
- * It sends a notification when the process exits (for the taskbar)
- * and it will show an error message if necessary (e.g. "program not found").
- */
-class KProcessRunner : public QObject
-{
- Q_OBJECT
-
- public:
-
-#ifndef Q_WS_X11
- static int run(KProcess *, const QString & binName);
-#else
- static int run(KProcess *, const QString & binName, const KStartupInfoId& id);
-#endif
-
- virtual ~KProcessRunner();
-
- int pid() const;
-
- protected Q_SLOTS:
-
- void slotProcessExited(int, QProcess::ExitStatus);
-
- private:
-#ifndef Q_WS_X11
- KProcessRunner(KProcess *, const QString & binName);
-#else
- KProcessRunner(KProcess *, const QString & binName, const KStartupInfoId& id);
-#endif
-
- KProcess *process;
- QString binName;
- KStartupInfoId id;
-
- Q_DISABLE_COPY(KProcessRunner)
-};
-
-#endif // KRUN_P_H
+// -*- mode: c++; c-basic-offset: 2 -*-
+/* This file is part of the KDE project
+ Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
+ Copyright (C) 2006 David Faure <faure@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KRUN_P_H
+#define KRUN_P_H
+
+#include <QtCore/QObject>
+#include <QtCore/QPointer>
+
+#include "kprocess.h"
+#include "kstartupinfo.h"
+
+/**
+ * @internal
+ * This class watches a process launched by KRun.
+ * It sends a notification when the process exits (for the taskbar)
+ * and it will show an error message if necessary (e.g. "program not found").
+ */
+class KProcessRunner : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+#ifndef Q_WS_X11
+ static int run(KProcess *, const QString & binName);
+#else
+ static int run(KProcess *, const QString & binName, const KStartupInfoId& id);
+#endif
+
+ virtual ~KProcessRunner();
+
+ int pid() const;
+
+ protected Q_SLOTS:
+
+ void slotProcessExited(int, QProcess::ExitStatus);
+
+ private:
+#ifndef Q_WS_X11
+ KProcessRunner(KProcess *, const QString & binName);
+#else
+ KProcessRunner(KProcess *, const QString & binName, const KStartupInfoId& id);
+#endif
+
+ KProcess *process;
+ QString binName;
+ KStartupInfoId id;
+
+ Q_DISABLE_COPY(KProcessRunner)
+};
+
+/**
+ * @internal
+ */
+class KRun::KRunPrivate
+{
+public:
+ KRunPrivate(KRun *parent);
+
+ void init (const KUrl& url, QWidget* window, mode_t mode,
+ bool isLocalFile, bool showProgressInfo, const QByteArray& asn);
+
+ // This helper method makes debugging easier: a single breakpoint for all
+ // the code paths that start the timer - at least from KRun itself.
+ // TODO: add public method startTimer() and deprecate timer() accessor,
+ // starting is the only valid use of the timer in subclasses (BrowserRun, \
KHTMLRun and KonqRun) + void startTimer();
+
+#ifdef Q_WS_WIN
+ static bool displayNativeOpenWithDialog( const KUrl::List& lst, QWidget* window, \
bool tempFiles, + const QString& \
suggestedFileName, const QByteArray& asn ); +#endif
+
+ KRun *q;
+ bool m_showingDialog;
+ bool m_runExecutables;
+
+ QString m_preferredService;
+ QString m_externalBrowser;
+ QString m_localPath;
+ QString m_suggestedFileName;
+ QPointer <QWidget> m_window;
+ QByteArray m_asn;
+ KUrl m_strURL;
+ bool m_bFault;
+ bool m_bAutoDelete;
+ bool m_bProgressInfo;
+ bool m_bFinished;
+ KIO::Job * m_job;
+ QTimer m_timer;
+
+ /**
+ * Used to indicate that the next action is to scan the file.
+ * This action is invoked from slotTimeout.
+ */
+ bool m_bScanFile;
+ bool m_bIsDirectory;
+
+ /**
+ * Used to indicate that the next action is to initialize.
+ * This action is invoked from slotTimeout
+ */
+ bool m_bInit;
+
+ bool m_bIsLocalFile;
+ mode_t m_mode;
+};
+
+#endif // KRUN_P_H
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic