Port away from KUrl, pretify headers

frameworks
Rohan Garg 12 years ago
parent d5b9a2e078
commit bd36521c36
  1. 48
      shell/shell.cpp
  2. 15
      shell/shellutils.cpp
  3. 6
      shell/shellutils.h

@ -20,35 +20,29 @@
#include "shell.h" #include "shell.h"
// qt/kde includes // qt/kde includes
#include <qdesktopwidget.h> #include <QDesktopWidget>
#include <qtimer.h> #include <QTimer>
#include <QtDBus/qdbusconnection.h> #include <QDBusConnection>
#include <kaction.h> #include <QMenuBar>
#include <kapplication.h> #include <QApplication>
#include <kcmdlineargs.h>
#include <kfiledialog.h> #include <KFileDialog>
#include <kpluginloader.h> #include <KPluginLoader>
#include <kmessagebox.h> #include <KMessageBox>
#include <kmimetype.h> #include <KMimeType>
#include <kstandardaction.h> #include <KStandardAction>
#include <ktoolbar.h> #include <KToolBar>
#include <kdebug.h> #include <KRecentFilesAction>
#include <klocale.h> #include <KServiceTypeTrader>
#include <kmenubar.h> #include <KToggleFullScreenAction>
#include <kio/netaccess.h> #include <KActionCollection>
#include <krecentfilesaction.h> #include <KWindowSystem>
#include <kservicetypetrader.h> #include <KTabWidget>
#include <ktoggleaction.h> #include <KXMLGUIFactory>
#include <ktogglefullscreenaction.h>
#include <kactioncollection.h>
#include <kwindowsystem.h>
#include <ktabwidget.h>
#include <kxmlguifactory.h>
#include <QDragMoveEvent> #include <QDragMoveEvent>
#include <QTabBar> #include <QTabBar>
#include <kicon.h> #include <KGlobal>
#include <kglobal.h> #include <KConfigGroup>
#include <kconfiggroup.h>
#include <KUrlMimeData> #include <KUrlMimeData>
#ifdef KActivities_FOUND #ifdef KActivities_FOUND

@ -10,9 +10,10 @@
#include "shellutils.h" #include "shellutils.h"
// qt/kde includes // qt/kde includes
#include <qfile.h> #include <QUrl>
#include <qregexp.h> #include <QFile>
#include <kcmdlineargs.h> #include <QRegExp>
#include <KCmdLineArgs>
namespace ShellUtils namespace ShellUtils
{ {
@ -32,7 +33,7 @@ FileExistFunc qfileExistFunc()
return detail::qfileExistFunc; return detail::qfileExistFunc;
} }
KUrl urlFromArg( const QString& _arg, FileExistFunc exist_func, const QString& pageArg ) QUrl urlFromArg( const QString& _arg, FileExistFunc exist_func, const QString& pageArg )
{ {
/* /*
Rationale for the small "cut-and-paste" work being done below: Rationale for the small "cut-and-paste" work being done below:
@ -46,7 +47,7 @@ KUrl urlFromArg( const QString& _arg, FileExistFunc exist_func, const QString& p
{ {
arg = QString::fromUtf8( QByteArray::fromPercentEncoding( arg.toUtf8() ) ); arg = QString::fromUtf8( QByteArray::fromPercentEncoding( arg.toUtf8() ) );
} }
KUrl url = KCmdLineArgs::makeURL( arg.toUtf8() ); QUrl url = KCmdLineArgs::makeURL( arg.toUtf8() );
int sharpPos = -1; int sharpPos = -1;
if ( !url.isLocalFile() || !exist_func( url.toLocalFile() ) ) if ( !url.isLocalFile() || !exist_func( url.toLocalFile() ) )
{ {
@ -55,11 +56,11 @@ KUrl urlFromArg( const QString& _arg, FileExistFunc exist_func, const QString& p
if ( sharpPos != -1 ) if ( sharpPos != -1 )
{ {
url = KCmdLineArgs::makeURL( arg.left( sharpPos ).toUtf8() ); url = KCmdLineArgs::makeURL( arg.left( sharpPos ).toUtf8() );
url.setHTMLRef( arg.mid( sharpPos + 1 ) ); url.setFragment( arg.mid( sharpPos + 1 ) );
} }
else if ( !pageArg.isEmpty() ) else if ( !pageArg.isEmpty() )
{ {
url.setHTMLRef( pageArg ); url.setFragment( pageArg );
} }
return url; return url;
} }

@ -10,9 +10,9 @@
#ifndef OKULAR_SHELLUTILS_H #ifndef OKULAR_SHELLUTILS_H
#define OKULAR_SHELLUTILS_H #define OKULAR_SHELLUTILS_H
#include <qstring.h> #include <QString>
#include <kurl.h> class QUrl;
namespace ShellUtils namespace ShellUtils
{ {
@ -20,7 +20,7 @@ namespace ShellUtils
typedef bool (*FileExistFunc)( const QString& fileName ); typedef bool (*FileExistFunc)( const QString& fileName );
FileExistFunc qfileExistFunc(); FileExistFunc qfileExistFunc();
KUrl urlFromArg( const QString& _arg, FileExistFunc exist_func, const QString& pageArg = QString() ); QUrl urlFromArg( const QString& _arg, FileExistFunc exist_func, const QString& pageArg = QString() );
} }

Loading…
Cancel
Save