Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Filelight
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Utilities
Filelight
Commits
12e90a0f
Commit
12e90a0f
authored
Jul 10, 2014
by
Martin Tobias Holmedahl Sandsmark
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port the app itself.
parent
64c90af0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
163 additions
and
154 deletions
+163
-154
src/app/historyAction.cpp
src/app/historyAction.cpp
+26
-18
src/app/historyAction.h
src/app/historyAction.h
+13
-13
src/app/main.cpp
src/app/main.cpp
+35
-33
src/app/mainWindow.cpp
src/app/mainWindow.cpp
+71
-68
src/app/mainWindow.h
src/app/mainWindow.h
+2
-2
src/define.h
src/define.h
+1
-1
src/part/CMakeLists.txt
src/part/CMakeLists.txt
+8
-12
src/part/part.h
src/part/part.h
+7
-7
No files found.
src/app/historyAction.cpp
View file @
12e90a0f
...
...
@@ -21,22 +21,32 @@
#include "historyAction.h"
#include <KAction>
#include <KActionCollection>
#include <KConfig>
#include <KConfigGroup>
#include <KLocale>
#include <KStandardShortcut>
inline
HistoryAction
::
HistoryAction
(
const
KIcon
&
icon
,
const
QString
&
text
,
KActionCollection
*
ac
)
:
KAction
(
icon
,
text
,
ac
)
#include <QIcon>
#include <QAction>
inline
HistoryAction
::
HistoryAction
(
const
QIcon
&
icon
,
const
QString
&
text
,
KActionCollection
*
ac
)
:
QAction
(
icon
,
text
,
ac
)
,
m_text
(
text
)
{
// .ui files make this false, but we can't rely on UI file as it isn't compiled in :(
setEnabled
(
false
);
}
void
HistoryAction
::
push
(
const
QString
&
path
)
void
HistoryAction
::
setHelpText
(
const
QUrl
&
url
)
{
QString
text
=
url
.
path
();
setStatusTip
(
text
);
setToolTip
(
text
);
setWhatsThis
(
text
);
}
void
HistoryAction
::
push
(
const
QUrl
&
path
)
{
if
(
path
.
isEmpty
())
return
;
...
...
@@ -47,9 +57,9 @@ void HistoryAction::push(const QString &path)
setEnabled
(
true
);
}
Q
String
HistoryAction
::
pop
()
Q
Url
HistoryAction
::
pop
()
{
const
Q
String
s
=
m_list
.
takeLast
();
const
Q
Url
s
=
m_list
.
takeLast
();
if
(
!
m_list
.
isEmpty
())
setHelpText
(
m_list
.
last
());
...
...
@@ -61,8 +71,8 @@ QString HistoryAction::pop()
HistoryCollection
::
HistoryCollection
(
KActionCollection
*
ac
,
QObject
*
parent
)
:
QObject
(
parent
)
,
m_b
(
new
HistoryAction
(
KIcon
(
QLatin1String
(
"go-previous"
)),
i18nc
(
"Go to the last path viewed"
,
"Back
"
),
ac
))
,
m_f
(
new
HistoryAction
(
KIcon
(
QLatin1String
(
"go-next"
)),
i18nc
(
"Go to forward in the history of paths viewed"
,
"Forwar
d"
),
ac
))
,
m_b
(
new
HistoryAction
(
QIcon
(
QLatin1String
(
"go-previous"
)),
tr
(
"Back"
,
"Go to the last path viewed
"
),
ac
))
,
m_f
(
new
HistoryAction
(
QIcon
(
QLatin1String
(
"go-next"
)),
tr
(
"Forward"
,
"Go to forward in the history of paths viewe
d"
),
ac
))
,
m_receiver
(
0
)
{
ac
->
addAction
(
QLatin1String
(
"go_back"
),
m_b
);
...
...
@@ -71,7 +81,7 @@ HistoryCollection::HistoryCollection(KActionCollection *ac, QObject *parent)
connect
(
m_f
,
SIGNAL
(
triggered
(
bool
)),
SLOT
(
pop
()));
}
void
HistoryCollection
::
push
(
const
KUrl
&
url
)
//slot
void
HistoryCollection
::
push
(
const
QUrl
&
url
)
//slot
{
if
(
!
url
.
isEmpty
())
{
...
...
@@ -81,16 +91,14 @@ void HistoryCollection::push(const KUrl &url) //slot
m_receiver
=
m_b
;
}
m_receiver
->
push
(
url
.
path
(
KUrl
::
AddTrailingSlash
));
m_receiver
->
push
(
url
.
path
());
}
m_receiver
=
0
;
}
void
HistoryCollection
::
pop
()
//slot
{
KUrl
url
;
const
QString
path
=
((
HistoryAction
*
)
sender
())
->
pop
();
//FIXME here we remove the constness
url
.
setPath
(
path
);
QUrl
url
=
((
HistoryAction
*
)
sender
())
->
pop
();
m_receiver
=
(
sender
()
==
m_b
)
?
m_f
:
m_b
;
...
...
@@ -99,14 +107,14 @@ void HistoryCollection::pop() //slot
void
HistoryCollection
::
save
(
KConfigGroup
&
configgroup
)
{
configgroup
.
writePathEntry
(
"backHistory"
,
m_b
->
m_list
);
configgroup
.
writePathEntry
(
"forwardHistory"
,
m_f
->
m_list
);
configgroup
.
writePathEntry
(
"backHistory"
,
QUrl
::
toStringList
(
m_b
->
m_list
)
);
configgroup
.
writePathEntry
(
"forwardHistory"
,
QUrl
::
toStringList
(
m_f
->
m_list
)
);
}
void
HistoryCollection
::
restore
(
const
KConfigGroup
&
configgroup
)
{
m_b
->
m_list
=
configgroup
.
readPathEntry
(
"backHistory"
,
QStringList
(
));
m_f
->
m_list
=
configgroup
.
readPathEntry
(
"forwardHistory"
,
QStringList
(
));
m_b
->
m_list
=
QUrl
::
fromStringList
(
configgroup
.
readPathEntry
(
"backHistory"
,
QStringList
()
));
m_f
->
m_list
=
QUrl
::
fromStringList
(
configgroup
.
readPathEntry
(
"forwardHistory"
,
QStringList
()
));
//TODO texts are not updated - no matter
}
...
...
src/app/historyAction.h
View file @
12e90a0f
/***********************************************************************
* Copyright 2003-2004 Max Howell <max.howell@methylblue.com>
* Copyright 2008-20
09
Martin Sandsmark <martin.sandsmark@kde.org>
* Copyright 2008-20
14
Martin Sandsmark <martin.sandsmark@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
...
...
@@ -22,38 +22,38 @@
#ifndef HISTORYACTION_H
#define HISTORYACTION_H
#include <
K
Action>
#include <
Q
Action>
#include <QStringList>
#include <
K
Url>
#include <
Q
Url>
class
KConfigGroup
;
class
KActionCollection
;
class
HistoryAction
:
K
Action
class
HistoryAction
:
Q
Action
{
HistoryAction
(
const
K
Icon
&
icon
,
const
QString
&
text
,
KActionCollection
*
ac
);
HistoryAction
(
const
Q
Icon
&
icon
,
const
QString
&
text
,
KActionCollection
*
ac
);
friend
class
HistoryCollection
;
public:
virtual
void
setEnabled
(
bool
b
=
true
)
{
K
Action
::
setEnabled
(
b
&&
!
m_list
.
isEmpty
());
Q
Action
::
setEnabled
(
b
&&
!
m_list
.
isEmpty
());
}
void
clear
()
{
m_list
.
clear
();
setEnabled
(
false
);
K
Action
::
setText
(
m_text
);
Q
Action
::
setText
(
m_text
);
}
private:
void
set
Text
(
);
void
set
HelpText
(
const
QUrl
&
url
);
void
push
(
const
Q
String
&
path
);
Q
String
pop
();
void
push
(
const
Q
Url
&
url
);
Q
Url
pop
();
const
QString
m_text
;
Q
StringList
m_list
;
Q
List
<
QUrl
>
m_list
;
};
...
...
@@ -68,13 +68,13 @@ public:
void
restore
(
const
KConfigGroup
&
configgroup
);
public
slots
:
void
push
(
const
KUrl
&
);
void
push
(
const
QUrl
&
url
);
void
stop
()
{
m_receiver
=
0
;
}
signals:
void
activated
(
const
K
Url
&
);
void
activated
(
const
Q
Url
&
);
private
slots
:
void
pop
();
...
...
src/app/main.cpp
View file @
12e90a0f
/***********************************************************************
* Copyright 2003-2004 Max Howell <max.howell@methylblue.com>
* Copyright 2008-20
09
Martin Sandsmark <martin.sandsmark@kde.org>
* Copyright 2008-20
14
Martin Sandsmark <martin.sandsmark@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
...
...
@@ -23,52 +23,54 @@
#include "mainWindow.h"
#include <KAboutData>
#include <KApplication>
#include <KCmdLineArgs>
#include <KLocale>
#include <KUrl>
#include <QApplication>
#include <QCommandLineParser>
#include <QUrl>
static
KAboutData
about
(
APP_NAME
,
0
,
ki18n
(
APP_PRETTYNAME
),
APP_VERSION
,
ki18n
(
"Graphical disk-usage information"
)
,
KAboutData
::
License_GPL
,
ki18n
(
"(C) 2006 Max Howell
\n
\
(C) 2008-2013 Martin Sandsmark"
),
KLocalizedString
(),
"http://utils.kde.org/projects/filelight"
);
QLatin1String
(
APP_NAME
)
,
QObject
::
tr
(
APP_PRETTYNAME
)
,
QLatin1String
(
APP_VERSION
),
QObject
::
tr
(
"Graphical disk-usage information"
)
,
KAboutLicense
::
GPL
,
QObject
::
tr
(
"(C) 2006 Max Howell
\n
\
(C) 2008-2014 Martin Sandsmark"
),
QString
(
),
QLatin1String
(
"http://utils.kde.org/projects/filelight"
)
);
int
main
(
int
argc
,
char
*
argv
[])
{
using
Filelight
::
MainWindow
;
about
.
addAuthor
(
ki18n
(
"Martin Sandsmark"
),
ki18n
(
"Maintainer"
),
"martin.sandsmark@kde.org"
,
"http://iskrembilen.com/"
);
about
.
addAuthor
(
ki18n
(
"Max Howell"
),
ki18n
(
"Original author"
),
"max.howell@methylblue.com"
,
"http://www.methylblue.com/"
);
about
.
addCredit
(
ki18n
(
"Lukas Appelhans"
),
ki18n
(
"Help and support"
));
about
.
addCredit
(
ki18n
(
"Steffen Gerlach"
),
ki18n
(
"Inspiration"
),
0
,
"http://www.steffengerlach.de/"
);
about
.
addCredit
(
ki18n
(
"Mike Diehl"
),
ki18n
(
"Original documentation"
),
0
,
0
);
about
.
addCredit
(
ki18n
(
"Sune Vuorela"
),
ki18n
(
"Icon"
),
0
,
0
);
about
.
addCredit
(
ki18n
(
"Nuno Pinheiro"
),
ki18n
(
"Icon"
),
0
,
0
);
about
.
addAuthor
(
QObject
::
tr
(
"Martin Sandsmark"
),
QObject
::
tr
(
"Maintainer"
),
QLatin1String
(
"martin.sandsmark@kde.org"
),
QLatin1String
(
"http://iskrembilen.com/"
)
);
about
.
addAuthor
(
QObject
::
tr
(
"Max Howell"
),
QObject
::
tr
(
"Original author"
),
QLatin1String
(
"max.howell@methylblue.com"
),
QLatin1String
(
"http://www.methylblue.com/"
)
);
about
.
addCredit
(
QObject
::
tr
(
"Lukas Appelhans"
),
QObject
::
tr
(
"Help and support"
));
about
.
addCredit
(
QObject
::
tr
(
"Steffen Gerlach"
),
QObject
::
tr
(
"Inspiration"
),
QString
(),
QLatin1String
(
"http://www.steffengerlach.de/"
)
);
about
.
addCredit
(
QObject
::
tr
(
"Mike Diehl"
),
QObject
::
tr
(
"Original documentation"
)
);
about
.
addCredit
(
QObject
::
tr
(
"Sune Vuorela"
),
QObject
::
tr
(
"Icon"
)
);
about
.
addCredit
(
QObject
::
tr
(
"Nuno Pinheiro"
),
QObject
::
tr
(
"Icon"
)
);
KCmdLineArgs
::
init
(
argc
,
argv
,
&
about
);
QApplication
app
(
argc
,
argv
);
app
.
setApplicationName
(
QLatin1String
(
APP_NAME
));
app
.
setApplicationDisplayName
(
QObject
::
tr
(
APP_PRETTYNAME
));
app
.
setApplicationVersion
(
QLatin1String
(
APP_VERSION
));
app
.
setOrganizationDomain
(
QLatin1String
(
"kde.org"
));
app
.
setOrganizationName
(
QLatin1String
(
"KDE"
));
KCmdLineOptions
options
;
KLocale
*
tmpLocale
=
new
KLocale
(
QLatin1String
(
APP_NAME
));
options
.
add
(
ki18nc
(
"Path in the file system to scan"
,
"+[path]"
).
toString
(
tmpLocale
).
toLocal8Bit
(),
ki18n
(
"Scan 'path'"
));
delete
tmpLocale
;
KCmdLineArgs
::
addCmdLineOptions
(
options
);
KApplication
app
;
QCommandLineParser
options
;
options
.
setApplicationDescription
(
QObject
::
tr
(
"Graphical disk-usage information"
));
options
.
addHelpOption
();
options
.
addVersionOption
();
options
.
addPositionalArgument
(
QLatin1String
(
"url"
),
QObject
::
tr
(
"Path or URL to scan"
),
QObject
::
tr
(
"[url]"
));
options
.
process
(
app
);
if
(
!
app
.
isSessionRestored
())
{
MainWindow
*
mw
=
new
MainWindow
();
KCmdLineArgs
*
const
args
=
KCmdLineArgs
::
parsedArgs
();
if
(
args
->
count
()
>
0
)
mw
->
scan
(
args
->
url
(
0
));
args
->
clear
();
QStringList
args
=
options
.
positionalArguments
();
if
(
args
.
count
()
>
0
)
mw
->
scan
(
args
.
at
(
0
));
mw
->
show
();
}
...
...
src/app/mainWindow.cpp
View file @
12e90a0f
...
...
@@ -24,32 +24,32 @@
#include "historyAction.h"
#include <cstdlib> //std::exit()
#include <
K
Application> //setupActions()
#include <
Q
Application> //setupActions()
#include <KComboBox> //locationbar
#include <KHistoryComboBox>
#include <KRecentFilesAction>
#include <QFileDialog>
#include <KConfig>
#include <KDirSelectDialog> //slotScanFolder
#include <KEditToolBar> //for editToolbar dialog
#include <QLineEdit>
#include <KStandardShortcut>
#include <KFileDialog>
#include <KLibLoader>
#include <KLocale>
#include <KPluginFactory>
#include <KPluginLoader>
#include <KMessageBox>
#include <KShell>
#include <
K
StatusBar>
#include <
Q
StatusBar>
#include <KToolBar>
#include <
K
Url>
#include <
Q
Url>
#include <KUrlCompletion> //locationbar
#include <QObject>
#include <QToolTip>
#include <
KGlobal
>
#include <
QPluginLoader
>
#include <KConfigGroup>
#include <KShortcutsDialog>
#include <KSharedConfig>
#include <KStandardAction>
#include <KActionCollection>
#include <KIO/Global> // upUrl
namespace
Filelight
{
...
...
@@ -59,7 +59,7 @@ MainWindow::MainWindow() : KParts::MainWindow(), m_part(0)
KPluginFactory
*
factory
=
KPluginLoader
(
QLatin1String
(
"filelightpart"
)).
factory
();
if
(
!
factory
)
{
KMessageBox
::
error
(
this
,
i18n
(
"Unable to load the Filelight Part.
\n
Please make sure Filelight was correctly installed."
));
KMessageBox
::
error
(
this
,
tr
(
"Unable to load the Filelight Part.
\n
Please make sure Filelight was correctly installed."
));
std
::
exit
(
1
);
return
;
}
...
...
@@ -81,17 +81,17 @@ MainWindow::MainWindow() : KParts::MainWindow(), m_part(0)
connect
(
m_part
,
SIGNAL
(
canceled
(
QString
)),
m_histories
,
SLOT
(
stop
()));
connect
(
BrowserExtension
::
childObject
(
m_part
),
SIGNAL
(
openUrlNotify
()),
SLOT
(
urlAboutToChange
()));
const
KConfigGroup
config
=
K
Global
::
c
onfig
()
->
group
(
"general"
);
const
KConfigGroup
config
=
K
SharedConfig
::
openC
onfig
()
->
group
(
"general"
);
m_combo
->
setHistoryItems
(
config
.
readPathEntry
(
"comboHistory"
,
QStringList
()));
}
else
{
KMessageBox
::
error
(
this
,
i18n
(
"Unable to create part widget
."
));
KMessageBox
::
error
(
this
,
tr
(
"Unable to create Filelight part widget.
\n
Please ensure that Filelight is correctly installed
."
));
std
::
exit
(
1
);
}
setAutoSaveSettings
(
QLatin1String
(
"window"
));
}
inline
void
MainWindow
::
setupActions
()
//singleton function
void
MainWindow
::
setupActions
()
//singleton function
{
KActionCollection
*
const
ac
=
actionCollection
();
...
...
@@ -107,55 +107,55 @@ inline void MainWindow::setupActions() //singleton function
KStandardAction
::
configureToolbars
(
this
,
SLOT
(
configToolbars
()),
ac
);
KStandardAction
::
keyBindings
(
this
,
SLOT
(
configKeys
()),
ac
);
K
Action
*
action
;
Q
Action
*
action
;
action
=
ac
->
addAction
(
QLatin1String
(
"scan_home"
),
this
,
SLOT
(
slotScanHomeFolder
()));
action
->
setText
(
i18n
(
"Scan &Home Folder"
));
action
->
setIcon
(
KIcon
(
QLatin1String
(
"user-home"
)));
action
=
ac
->
addAction
(
QLatin1String
(
"scan_home"
),
this
,
SLOT
(
slotScanHomeFolder
()));
action
->
setText
(
tr
(
"Scan &Home Folder"
));
action
->
setIcon
(
QIcon
(
QLatin1String
(
"user-home"
)));
action
->
setShortcut
(
QKeySequence
(
Qt
::
CTRL
+
Qt
::
Key_Home
));
action
=
ac
->
addAction
(
QLatin1String
(
"scan_root"
),
this
,
SLOT
(
slotScanRootFolder
()));
action
->
setText
(
i18n
(
"Scan &Root Folder"
));
action
->
setIcon
(
KIcon
(
QLatin1String
(
"folder-red"
)));
action
=
ac
->
addAction
(
QLatin1String
(
"scan_root"
),
this
,
SLOT
(
slotScanRootFolder
()));
action
->
setText
(
tr
(
"Scan &Root Folder"
));
action
->
setIcon
(
QIcon
(
QLatin1String
(
"folder-red"
)));
action
=
ac
->
addAction
(
QLatin1String
(
"scan_rescan"
),
m_part
,
SLOT
(
rescan
()));
action
->
setText
(
i18n
(
"Rescan"
));
action
->
setIcon
(
KIcon
(
QLatin1String
(
"view-refresh"
)));
action
->
setShortcut
(
KStandardShortcut
::
reload
()
);
action
=
ac
->
addAction
(
QLatin1String
(
"scan_rescan"
),
m_part
,
SLOT
(
rescan
()));
action
->
setText
(
tr
(
"Rescan"
));
action
->
setIcon
(
QIcon
(
QLatin1String
(
"view-refresh"
)));
action
->
setShortcut
(
QKeySequence
::
Refresh
);
action
=
ac
->
addAction
(
QLatin1String
(
"scan_stop"
),
this
,
SLOT
(
slotAbortScan
()));
action
->
setText
(
i18n
(
"Stop"
));
action
->
setIcon
(
KIcon
(
QLatin1String
(
"process-stop"
)));
action
=
ac
->
addAction
(
QLatin1String
(
"scan_stop"
),
this
,
SLOT
(
slotAbortScan
()));
action
->
setText
(
tr
(
"Stop"
));
action
->
setIcon
(
QIcon
(
QLatin1String
(
"process-stop"
)));
action
->
setShortcut
(
Qt
::
Key_Escape
);
action
=
ac
->
addAction
(
QLatin1String
(
"go"
),
m_combo
,
SIGNAL
(
returnPressed
()));
action
->
setText
(
i18n
(
"Go"
));
action
->
setIcon
(
KIcon
(
QLatin1String
(
"go-jump-locationbar"
)));
action
=
ac
->
addAction
(
QLatin1String
(
"location_bar"
),
0
,
0
);
action
->
setText
(
i18n
(
"Location Bar"
));
action
->
setDefaultWidget
(
m_combo
);
action
=
ac
->
addAction
(
QLatin1String
(
"go"
),
m_combo
,
SIGNAL
(
returnPressed
()));
action
->
setText
(
tr
(
"Go"
));
action
->
setIcon
(
QIcon
(
QLatin1String
(
"go-jump-locationbar"
)));
action
=
ac
->
addAction
(
QLatin1String
(
"scan_folder"
),
this
,
SLOT
(
slotScanFolder
()));
action
->
setText
(
i18n
(
"Scan Folder"
));
action
->
setIcon
(
KIcon
(
QLatin1String
(
"folder"
)));
action
->
setText
(
tr
(
"Scan Folder"
));
action
->
setIcon
(
QIcon
(
QLatin1String
(
"folder"
)));
QWidgetAction
*
locationAction
=
ac
->
add
<
QWidgetAction
>
(
QLatin1String
(
"location_bar"
),
0
,
0
);
locationAction
->
setText
(
tr
(
"Location Bar"
));
locationAction
->
setDefaultWidget
(
m_combo
);
m_recentScans
=
new
KRecentFilesAction
(
i18n
(
"&Recent Scans"
),
ac
);
m_recentScans
=
new
KRecentFilesAction
(
tr
(
"&Recent Scans"
),
ac
);
m_recentScans
->
setMaxItems
(
8
);
m_histories
=
new
HistoryCollection
(
ac
,
this
);
m_recentScans
->
loadEntries
(
K
Global
::
c
onfig
()
->
group
(
"general"
));
m_recentScans
->
loadEntries
(
K
SharedConfig
::
openC
onfig
()
->
group
(
"general"
));
connect
(
m_recentScans
,
SIGNAL
(
urlSelected
(
KUrl
)),
SLOT
(
slotScanUrl
(
K
Url
)));
connect
(
m_recentScans
,
SIGNAL
(
urlSelected
(
QUrl
)),
SLOT
(
slotScanUrl
(
Q
Url
)));
connect
(
m_combo
,
SIGNAL
(
returnPressed
()),
SLOT
(
slotComboScan
()));
connect
(
m_histories
,
SIGNAL
(
activated
(
KUrl
)),
SLOT
(
slotScanUrl
(
K
Url
)));
connect
(
m_histories
,
SIGNAL
(
activated
(
QUrl
)),
SLOT
(
slotScanUrl
(
Q
Url
)));
}
void
MainWindow
::
closeEvent
(
QCloseEvent
*
event
)
{
KConfigGroup
config
=
K
Global
::
c
onfig
()
->
group
(
"general"
);
KConfigGroup
config
=
K
SharedConfig
::
openC
onfig
()
->
group
(
"general"
);
m_recentScans
->
saveEntries
(
config
);
config
.
writePathEntry
(
"comboHistory"
,
m_combo
->
historyItems
());
...
...
@@ -164,42 +164,42 @@ void MainWindow::closeEvent(QCloseEvent *event)
KParts
::
MainWindow
::
closeEvent
(
event
);
}
inline
void
MainWindow
::
configToolbars
()
//slot
void
MainWindow
::
configToolbars
()
//slot
{
KEditToolBar
dialog
(
factory
(),
this
);
if
(
dialog
.
exec
())
//krazy:exclude=crashy
{
createGUI
(
m_part
);
applyMainWindowSettings
(
K
Global
::
c
onfig
()
->
group
(
"window"
));
applyMainWindowSettings
(
K
SharedConfig
::
openC
onfig
()
->
group
(
"window"
));
}
}
inline
void
MainWindow
::
configKeys
()
//slot
void
MainWindow
::
configKeys
()
//slot
{
KShortcutsDialog
::
configure
(
actionCollection
(),
KShortcutsEditor
::
LetterShortcutsAllowed
,
this
,
true
);
}
inline
void
MainWindow
::
slotScanFolder
()
void
MainWindow
::
slotScanFolder
()
{
slotScanUrl
(
KFileDialog
::
getExistingDirectoryUrl
(
m_part
->
url
(),
this
,
i18n
(
"Select Folder to Scan"
)));
slotScanUrl
(
QFileDialog
::
getExistingDirectoryUrl
(
this
,
tr
(
"Select Folder to Scan"
),
m_part
->
url
(
)));
}
inline
void
MainWindow
::
slotScanHomeFolder
()
{
void
MainWindow
::
slotScanHomeFolder
()
{
slotScanPath
(
QDir
::
homePath
());
}
inline
void
MainWindow
::
slotScanRootFolder
()
{
void
MainWindow
::
slotScanRootFolder
()
{
slotScanPath
(
QDir
::
rootPath
());
}
inline
void
MainWindow
::
slotUp
()
{
slotScanUrl
(
m_part
->
url
().
upUrl
(
));
void
MainWindow
::
slotUp
()
{
slotScanUrl
(
KIO
::
upUrl
(
m_part
->
url
()
));
}
inline
void
MainWindow
::
slotComboScan
()
void
MainWindow
::
slotComboScan
()
{
QString
path
=
m_combo
->
lineEdit
()
->
text
();
KUrl
url
=
KUrl
(
path
);
QUrl
url
=
QUrl
::
fromUserInput
(
path
);
if
(
url
.
isRelative
())
path
=
QLatin1String
(
"~/"
)
+
path
;
// KUrlCompletion completes relative to ~, not CWD
...
...
@@ -210,14 +210,14 @@ inline void MainWindow::slotComboScan()
m_combo
->
addToHistory
(
path
);
}
inline
bool
MainWindow
::
slotScanPath
(
const
QString
&
path
)
bool
MainWindow
::
slotScanPath
(
const
QString
&
path
)
{
return
slotScanUrl
(
KUrl
(
path
));
return
slotScanUrl
(
QUrl
::
fromUserInput
(
path
));
}
bool
MainWindow
::
slotScanUrl
(
const
K
Url
&
url
)
bool
MainWindow
::
slotScanUrl
(
const
Q
Url
&
url
)
{
const
K
Url
oldUrl
=
m_part
->
url
();
const
Q
Url
oldUrl
=
m_part
->
url
();
if
(
m_part
->
openUrl
(
url
))
{
...
...
@@ -228,44 +228,47 @@ bool MainWindow::slotScanUrl(const KUrl &url)
return
false
;
}
inline
void
MainWindow
::
slotAbortScan
()
void
MainWindow
::
slotAbortScan
()
{
if
(
m_part
->
closeUrl
())
action
(
"scan_stop"
)
->
setEnabled
(
false
);
}
inline
void
MainWindow
::
scanStarted
()
void
MainWindow
::
scanStarted
()
{
stateChanged
(
QLatin1String
(
"scan_started"
));
m_combo
->
clearFocus
();
}
inline
void
MainWindow
::
scanFailed
()
void
MainWindow
::
scanFailed
()
{
stateChanged
(
QLatin1String
(
"scan_failed"
));
qobject_cast
<
KAction
*>
(
action
(
"go_up"
))
->
setHelpText
(
QString
());
action
(
"go_up"
)
->
setStatusTip
(
QString
());
action
(
"go_up"
)
->
setToolTip
(
QString
());
m_combo
->
lineEdit
()
->
clear
();
}
void
MainWindow
::
scanCompleted
()
{
KAction
*
goUp
=
qobject_cast
<
KAction
*>
(
action
(
"go_up"
));
const
KUrl
url
=
m_part
->
url
();
const
QUrl
url
=
m_part
->
url
();
stateChanged
(
QLatin1String
(
"scan_complete"
));
stateChanged
(
QLatin1String
(
"scan_complete"
));
m_combo
->
lineEdit
()
->
setText
(
m_part
->
prettyUrl
());
if
(
url
.
path
(
KUrl
::
LeaveTrailingSlash
)
==
QLatin1String
(
"/"
))
{
goUp
->
setEnabled
(
false
);
goUp
->
setHelpText
(
QString
());
if
(
url
.
toLocalFile
()
==
QLatin1String
(
"/"
))
{
action
(
"go_up"
)
->
setEnabled
(
false
);
action
(
"go_up"
)
->
setStatusTip
(
QString
());
action
(
"go_up"
)
->
setToolTip
(
QString
());
}
else
{
action
(
"go_up"
)
->
setStatusTip
(
KIO
::
upUrl
(
url
).
toString
());
action
(
"go_up"
)
->
setToolTip
(
KIO
::
upUrl
(
url
).
toString
());
}
else
goUp
->
setHelpText
(
url
.
upUrl
().
path
(
KUrl
::
LeaveTrailingSlash
));
m_recentScans
->
addUrl
(
url
);
//FIXME doesn't set the tick
}
inline
void
MainWindow
::
urlAboutToChange
()
void
MainWindow
::
urlAboutToChange
()
{
//called when part's URL is about to change internally
//the part will then create the Map and emit completed()
...
...
src/app/mainWindow.h
View file @
12e90a0f
...
...
@@ -42,7 +42,7 @@ class MainWindow : public KParts::MainWindow
public:
MainWindow
();
void
scan
(
const
K
Url
&
u
)
{
void
scan
(
const
Q
Url
&
u
)
{
slotScanUrl
(
u
);
}
...
...
@@ -52,7 +52,7 @@ private slots:
void
slotScanFolder
();
void
slotScanHomeFolder
();
void
slotScanRootFolder
();
bool
slotScanUrl
(
const
K
Url
&
);
bool
slotScanUrl
(
const
Q
Url
&
);
bool
slotScanPath
(
const
QString
&
);
void
slotAbortScan
();
...
...
src/define.h
View file @
12e90a0f
...
...
@@ -30,7 +30,7 @@
#undef PRETTYNAME
#define APP_NAME "filelight"
#define APP_VERSION "1.2
0
"
#define APP_VERSION "1.2
1
"
#define APP_PRETTYNAME "Filelight"
#endif
src/part/CMakeLists.txt
View file @
12e90a0f
...
...
@@ -18,9 +18,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#######################################################################
add_subdirectory
(
radialMap
)
set
(
filelight_PART_SRCS
radialMap/widget.cpp
radialMap/builder.cpp
radialMap/map.cpp
radialMap/widgetEvents.cpp
radialMap/labels.cpp
part.cpp
scan.cpp
progressBox.cpp
...
...
@@ -31,17 +34,10 @@ set(filelight_PART_SRCS
remoteLister.cpp
summaryWidget.cpp
)
kde4_add_ui_files
(
filelight_PART_SRCS dialog.ui
)
kde4_add_plugin
(
filelightpart
${
filelight_PART_SRCS
}
)
QT5_WRAP_UI
(
filelight_PART_SRCS dialog.ui
)
target_link_libraries
(
filelightpart radialmap
${
KDE4_KDECORE_LIBS
}
${
KDE4_KPARTS_LIBS
}
${
KDE4_KDEUI_LIBS
}
${
KDE4_KIO_LIBS
}
${
KDE4_KFILE_LIBS
}
${
KDE4_SOLID_LIBS
}
)
add_library
(
filelightpart MODULE
${
filelight_PART_SRCS
}
)
target_link_libraries
(
filelightpart radialmap KF5::Parts KF5::KIOCore KF5::Solid
)
install
(
TARGETS filelightpart DESTINATION
${
PLUGIN_INSTALL_DIR
}
)
src/part/part.h
View file @
12e90a0f
...
...
@@ -25,9 +25,9 @@
#include <KParts/BrowserExtension>
#include <KParts/StatusBarExtension>
#include <KParts/Part>
#include <
K
Url>