Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jan Paul Batrina
Ark
Commits
d7f690e0
Commit
d7f690e0
authored
Jun 15, 2009
by
Raphael Kubo da Costa
Browse files
Some code cleanup, use m_* for member variables.
svn path=/trunk/KDE/kdeutils/ark/; revision=982332
parent
f6009bd3
Changes
2
Hide whitespace changes
Inline
Side-by-side
kerfuffle/batchextract.cpp
View file @
d7f690e0
...
...
@@ -43,8 +43,7 @@
namespace
Kerfuffle
{
BatchExtract
::
BatchExtract
()
:
autoSubfolders
(
false
),
destinationFolder
(),
:
m_autoSubfolders
(
false
),
m_preservePaths
(
true
)
{
...
...
@@ -63,7 +62,7 @@ void BatchExtract::addExtraction(Kerfuffle::Archive* archive, bool preservePaths
QString
autoDestination
=
destinationFolder
;
if
(
autoSubfolders
)
{
if
(
m_
autoSubfolders
)
{
if
(
!
archive
->
isSingleFolderArchive
())
{
QDir
destinationDir
(
destinationFolder
);
QString
subfolderName
=
archive
->
subfolderName
();
...
...
@@ -93,7 +92,7 @@ void BatchExtract::addExtraction(Kerfuffle::Archive* archive, bool preservePaths
kDebug
(
1601
)
<<
QString
(
"Registering job from archive %1, to %2, preservePaths %3"
).
arg
(
archive
->
fileName
()).
arg
(
autoDestination
).
arg
(
preservePaths
);
addSubjob
(
job
);
fileNames
[
job
]
=
qMakePair
(
archive
->
fileName
(),
destinationFolder
);
m_
fileNames
[
job
]
=
qMakePair
(
archive
->
fileName
(),
destinationFolder
);
connect
(
job
,
SIGNAL
(
percent
(
KJob
*
,
unsigned
long
)),
this
,
SLOT
(
forwardProgress
(
KJob
*
,
unsigned
long
)));
...
...
@@ -106,26 +105,26 @@ void BatchExtract::slotUserQuery(Query *query)
void
BatchExtract
::
setAutoSubfolder
(
bool
value
)
{
autoSubfolders
=
value
;
m_
autoSubfolders
=
value
;
}
void
BatchExtract
::
start
()
{
kDebug
(
1601
);
if
(
!
subfolder
.
isEmpty
())
{
kDebug
(
1601
)
<<
"Creating subfolder"
<<
subfolder
;
QDir
dest
(
destinationFolder
);
dest
.
mkpath
(
subfolder
);
destinationFolder
+=
'/'
+
subfolder
;
if
(
!
m_
subfolder
.
isEmpty
())
{
kDebug
(
1601
)
<<
"Creating subfolder"
<<
m_
subfolder
;
QDir
dest
(
m_
destinationFolder
);
dest
.
mkpath
(
m_
subfolder
);
m_
destinationFolder
+=
'/'
+
m_
subfolder
;
}
foreach
(
Kerfuffle
::
Archive
*
archive
,
inputs
)
{
foreach
(
Kerfuffle
::
Archive
*
archive
,
m_
inputs
)
{
QString
finalDestination
;
if
(
destinationFolder
.
isEmpty
())
{
if
(
m_
destinationFolder
.
isEmpty
())
{
finalDestination
=
QDir
::
currentPath
();
}
else
{
finalDestination
=
destinationFolder
;
finalDestination
=
m_
destinationFolder
;
}
addExtraction
(
archive
,
m_preservePaths
,
finalDestination
);
...
...
@@ -135,12 +134,12 @@ void BatchExtract::start()
emit
description
(
this
,
i18n
(
"Extracting file..."
),
qMakePair
(
i18n
(
"Source archive"
),
fileNames
.
value
(
subjobs
().
at
(
0
)).
first
),
qMakePair
(
i18n
(
"Destination"
),
fileNames
.
value
(
subjobs
().
at
(
0
)).
second
)
qMakePair
(
i18n
(
"Source archive"
),
m_
fileNames
.
value
(
subjobs
().
at
(
0
)).
first
),
qMakePair
(
i18n
(
"Destination"
),
m_
fileNames
.
value
(
subjobs
().
at
(
0
)).
second
)
);
initialJobCount
=
subjobs
().
size
();
if
(
!
initialJobCount
)
return
;
m_
initialJobCount
=
subjobs
().
size
();
if
(
!
m_
initialJobCount
)
return
;
kDebug
(
1601
)
<<
"Starting first job"
;
...
...
@@ -176,8 +175,8 @@ void BatchExtract::slotResult(KJob *job)
kDebug
(
1601
)
<<
"Starting the next job"
;
emit
description
(
this
,
i18n
(
"Extracting file..."
),
qMakePair
(
i18n
(
"Source archive"
),
fileNames
.
value
(
subjobs
().
at
(
0
)).
first
),
qMakePair
(
i18n
(
"Destination"
),
fileNames
.
value
(
subjobs
().
at
(
0
)).
second
)
qMakePair
(
i18n
(
"Source archive"
),
m_
fileNames
.
value
(
subjobs
().
at
(
0
)).
first
),
qMakePair
(
i18n
(
"Destination"
),
m_
fileNames
.
value
(
subjobs
().
at
(
0
)).
second
)
);
subjobs
().
at
(
0
)
->
start
();
}
...
...
@@ -186,8 +185,8 @@ void BatchExtract::slotResult(KJob *job)
void
BatchExtract
::
forwardProgress
(
KJob
*
job
,
unsigned
long
percent
)
{
Q_UNUSED
(
job
);
int
jobPart
=
100
/
initialJobCount
;
setPercent
(
jobPart
*
(
initialJobCount
-
subjobs
().
size
())
+
percent
/
initialJobCount
);
int
jobPart
=
100
/
m_
initialJobCount
;
setPercent
(
jobPart
*
(
m_
initialJobCount
-
subjobs
().
size
())
+
percent
/
m_
initialJobCount
);
}
bool
BatchExtract
::
addInput
(
const
KUrl
&
url
)
...
...
@@ -196,14 +195,14 @@ bool BatchExtract::addInput(const KUrl& url)
Kerfuffle
::
Archive
*
archive
=
Kerfuffle
::
factory
(
url
.
path
());
if
(
archive
==
NULL
)
return
false
;
inputs
<<
archive
;
m_
inputs
<<
archive
;
return
true
;
}
void
BatchExtract
::
setDestinationFolder
(
QString
folder
)
{
if
(
!
folder
.
isEmpty
())
destinationFolder
=
folder
;
m_
destinationFolder
=
folder
;
}
void
BatchExtract
::
setPreservePaths
(
bool
value
)
...
...
@@ -212,7 +211,7 @@ void BatchExtract::setPreservePaths(bool value)
}
void
BatchExtract
::
setSubfolder
(
QString
subfolder
)
{
this
->
subfolder
=
subfolder
;
m_
subfolder
=
subfolder
;
}
bool
BatchExtract
::
showExtractDialog
()
...
...
@@ -220,25 +219,25 @@ bool BatchExtract::showExtractDialog()
kDebug
(
1601
);
QPointer
<
Kerfuffle
::
ExtractionDialog
>
dialog
=
new
Kerfuffle
::
ExtractionDialog
(
NULL
);
if
(
inputs
.
size
()
>
1
)
{
if
(
m_
inputs
.
size
()
>
1
)
{
dialog
->
batchModeOption
();
}
if
(
destinationFolder
.
isEmpty
())
if
(
m_
destinationFolder
.
isEmpty
())
dialog
->
setCurrentUrl
(
QDir
::
currentPath
());
else
dialog
->
setCurrentUrl
(
destinationFolder
);
dialog
->
setCurrentUrl
(
m_
destinationFolder
);
dialog
->
setAutoSubfolder
(
autoSubfolders
);
dialog
->
setAutoSubfolder
(
m_
autoSubfolders
);
dialog
->
setPreservePaths
(
m_preservePaths
);
if
(
subfolder
.
isEmpty
()
&&
inputs
.
size
()
==
1
)
{
if
(
inputs
.
at
(
0
)
->
isSingleFolderArchive
())
{
if
(
m_
subfolder
.
isEmpty
()
&&
m_
inputs
.
size
()
==
1
)
{
if
(
m_
inputs
.
at
(
0
)
->
isSingleFolderArchive
())
{
dialog
->
setSingleFolderArchive
(
true
);
}
dialog
->
setSubfolder
(
inputs
.
at
(
0
)
->
subfolderName
());
dialog
->
setSubfolder
(
m_
inputs
.
at
(
0
)
->
subfolderName
());
}
else
{
dialog
->
setSubfolder
(
subfolder
);
dialog
->
setSubfolder
(
m_
subfolder
);
}
bool
ret
=
dialog
->
exec
();
...
...
@@ -247,10 +246,10 @@ bool BatchExtract::showExtractDialog()
setDestinationFolder
(
dialog
->
destinationDirectory
().
path
());
if
(
dialog
->
extractToSubfolder
())
{
subfolder
=
dialog
->
subfolder
();
m_
subfolder
=
dialog
->
subfolder
();
}
autoSubfolders
=
dialog
->
autoSubfolders
();
m_
autoSubfolders
=
dialog
->
autoSubfolders
();
m_preservePaths
=
dialog
->
preservePaths
();
return
true
;
...
...
kerfuffle/batchextract.h
View file @
d7f690e0
...
...
@@ -61,14 +61,14 @@ private slots:
void
slotUserQuery
(
Query
*
query
);
private:
int
initialJobCount
;
QMap
<
KJob
*
,
QPair
<
QString
,
QString
>
>
fileNames
;
bool
autoSubfolders
;
int
m_
initialJobCount
;
QMap
<
KJob
*
,
QPair
<
QString
,
QString
>
>
m_
fileNames
;
bool
m_
autoSubfolders
;
QList
<
Archive
*>
inputs
;
KJobTrackerInterface
*
tracker
;
QString
destinationFolder
;
QString
subfolder
;
QList
<
Archive
*>
m_
inputs
;
//
KJobTrackerInterface *
m_
tracker;
QString
m_
destinationFolder
;
QString
m_
subfolder
;
bool
m_preservePaths
;
};
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment