Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Network
KGet
Commits
d31fd65f
Commit
d31fd65f
authored
Jan 24, 2021
by
Laurent Montel
😁
Browse files
Modernize code use auto
parent
ff8149b3
Changes
64
Hide whitespace changes
Inline
Side-by-side
conf/autopastemodel.cpp
View file @
d31fd65f
...
...
@@ -42,16 +42,16 @@ QWidget *AutoPasteDelegate::createEditor(QWidget *parent, const QStyleOptionView
switch
(
index
.
column
())
{
case
AutoPasteModel
::
Type
:
{
KComboBox
*
types
=
new
KComboBox
(
parent
);
auto
*
types
=
new
KComboBox
(
parent
);
types
->
setModel
(
m_types
);
return
types
;
}
case
AutoPasteModel
::
Pattern
:
{
KLineEdit
*
pattern
=
new
KLineEdit
(
parent
);
auto
*
pattern
=
new
KLineEdit
(
parent
);
return
pattern
;
}
case
AutoPasteModel
::
PatternSyntax
:
{
KComboBox
*
syntaxes
=
new
KComboBox
(
parent
);
auto
*
syntaxes
=
new
KComboBox
(
parent
);
syntaxes
->
setModel
(
m_syntaxes
);
return
syntaxes
;
}
...
...
@@ -68,18 +68,18 @@ void AutoPasteDelegate::setEditorData(QWidget *editor, const QModelIndex &index)
switch
(
index
.
column
())
{
case
AutoPasteModel
::
Type
:
{
KComboBox
*
type
=
static_cast
<
KComboBox
*>
(
editor
);
auto
*
type
=
static_cast
<
KComboBox
*>
(
editor
);
const
int
row
=
type
->
findData
(
index
.
data
(
Qt
::
EditRole
));
type
->
setCurrentIndex
(
row
);
break
;
}
case
AutoPasteModel
::
Pattern
:
{
KLineEdit
*
line
=
static_cast
<
KLineEdit
*>
(
editor
);
auto
*
line
=
static_cast
<
KLineEdit
*>
(
editor
);
line
->
setText
(
index
.
data
(
Qt
::
EditRole
).
toString
());
break
;
}
case
AutoPasteModel
::
PatternSyntax
:
{
KComboBox
*
syntax
=
static_cast
<
KComboBox
*>
(
editor
);
auto
*
syntax
=
static_cast
<
KComboBox
*>
(
editor
);
const
int
row
=
syntax
->
findData
(
index
.
data
(
Qt
::
EditRole
));
syntax
->
setCurrentIndex
(
row
);
break
;
...
...
@@ -97,13 +97,13 @@ void AutoPasteDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
switch
(
index
.
column
())
{
case
AutoPasteModel
::
Type
:
{
KComboBox
*
typeBox
=
static_cast
<
KComboBox
*>
(
editor
);
auto
*
typeBox
=
static_cast
<
KComboBox
*>
(
editor
);
const
int
type
=
typeBox
->
itemData
(
typeBox
->
currentIndex
()).
toInt
();
model
->
setData
(
index
,
type
);
break
;
}
case
AutoPasteModel
::
Pattern
:
{
KLineEdit
*
line
=
static_cast
<
KLineEdit
*>
(
editor
);
auto
*
line
=
static_cast
<
KLineEdit
*>
(
editor
);
const
QString
text
=
line
->
text
();
if
(
!
text
.
isEmpty
())
{
model
->
setData
(
index
,
text
);
...
...
@@ -111,7 +111,7 @@ void AutoPasteDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
break
;
}
case
AutoPasteModel
::
PatternSyntax
:
{
KComboBox
*
syntaxBox
=
static_cast
<
KComboBox
*>
(
editor
);
auto
*
syntaxBox
=
static_cast
<
KComboBox
*>
(
editor
);
const
int
syntax
=
syntaxBox
->
itemData
(
syntaxBox
->
currentIndex
()).
toInt
();
model
->
setData
(
index
,
syntax
);
break
;
...
...
conf/integrationpreferences.cpp
View file @
d31fd65f
...
...
@@ -46,7 +46,7 @@ IntegrationPreferences::IntegrationPreferences(KConfigDialog *parent, Qt::Window
m_model
=
new
AutoPasteModel
(
this
);
m_model
->
load
();
ui
.
list
->
setModel
(
m_model
);
A
uto
PasteDelegate
*
delegate
=
new
AutoPasteDelegate
(
ui
.
type
->
model
(),
ui
.
patternSyntax
->
model
(),
this
);
a
uto
*
delegate
=
new
AutoPasteDelegate
(
ui
.
type
->
model
(),
ui
.
patternSyntax
->
model
(),
this
);
ui
.
list
->
setItemDelegate
(
delegate
);
QByteArray
loadedState
=
QByteArray
::
fromBase64
(
Settings
::
autoPasteHeaderState
().
toLatin1
());
...
...
conf/preferencesdialog.cpp
View file @
d31fd65f
...
...
@@ -27,18 +27,18 @@
PreferencesDialog
::
PreferencesDialog
(
QWidget
*
parent
,
KConfigSkeleton
*
skeleton
)
:
KConfigDialog
(
parent
,
"preferences"
,
skeleton
)
{
QWidget
*
appearance
=
new
QWidget
(
this
);
TransfersGroupWidget
*
groups
=
new
TransfersGroupWidget
(
this
);
DlgWebinterface
*
webinterface
=
new
DlgWebinterface
(
this
);
auto
*
appearance
=
new
QWidget
(
this
);
auto
*
groups
=
new
TransfersGroupWidget
(
this
);
auto
*
webinterface
=
new
DlgWebinterface
(
this
);
connect
(
webinterface
,
&
DlgWebinterface
::
changed
,
this
,
&
PreferencesDialog
::
enableApplyButton
);
connect
(
webinterface
,
&
DlgWebinterface
::
saved
,
this
,
&
PreferencesDialog
::
settingsChangedSlot
);
QWidget
*
network
=
new
QWidget
(
this
);
QWidget
*
advanced
=
new
QWidget
(
this
);
IntegrationPreferences
*
integration
=
new
IntegrationPreferences
(
this
);
auto
*
network
=
new
QWidget
(
this
);
auto
*
advanced
=
new
QWidget
(
this
);
auto
*
integration
=
new
IntegrationPreferences
(
this
);
connect
(
integration
,
&
IntegrationPreferences
::
changed
,
this
,
&
PreferencesDialog
::
enableApplyButton
);
VerificationPreferences
*
verification
=
new
VerificationPreferences
(
this
);
auto
*
verification
=
new
VerificationPreferences
(
this
);
connect
(
verification
,
&
VerificationPreferences
::
changed
,
this
,
&
PreferencesDialog
::
enableApplyButton
);
PluginSelec
to
r
*
pluginSelector
=
new
PluginSelector
(
this
);
au
to
*
pluginSelector
=
new
PluginSelector
(
this
);
connect
(
pluginSelector
,
&
PluginSelector
::
changed
,
this
,
&
PreferencesDialog
::
enableApplyButton
);
Ui
::
DlgAppearance
dlgApp
;
...
...
conf/transfersgrouptree.cpp
View file @
d31fd65f
...
...
@@ -42,7 +42,7 @@ QWidget *TransfersGroupDelegate::createEditor(QWidget *parent, const QStyleOptio
void
TransfersGroupDelegate
::
setEditorData
(
QWidget
*
editor
,
const
QModelIndex
&
index
)
const
{
if
(
index
.
column
()
==
TransferTreeModel
::
Name
)
{
KLineEdit
*
groupEditor
=
static_cast
<
KLineEdit
*>
(
editor
);
auto
*
groupEditor
=
static_cast
<
KLineEdit
*>
(
editor
);
groupEditor
->
setText
(
index
.
data
().
toString
());
}
else
{
BasicTransfersViewDelegate
::
setEditorData
(
editor
,
index
);
...
...
@@ -52,7 +52,7 @@ void TransfersGroupDelegate::setEditorData(QWidget *editor, const QModelIndex &i
void
TransfersGroupDelegate
::
setModelData
(
QWidget
*
editor
,
QAbstractItemModel
*
model
,
const
QModelIndex
&
index
)
const
{
if
(
index
.
column
()
==
TransferTreeModel
::
Name
)
{
KLineEdit
*
groupEditor
=
static_cast
<
KLineEdit
*>
(
editor
);
auto
*
groupEditor
=
static_cast
<
KLineEdit
*>
(
editor
);
const
QString
newName
=
groupEditor
->
text
();
const
QString
oldName
=
index
.
data
().
toString
();
...
...
core/basedialog.h
View file @
d31fd65f
...
...
@@ -40,7 +40,7 @@ class KGET_EXPORT KGetSaveSizeDialog : public QDialog
~
KGetSaveSizeDialog
()
override
;
private:
QByteArray
m_name
;
const
QByteArray
m_name
;
};
#endif
core/datasourcefactory.cpp
View file @
d31fd65f
...
...
@@ -760,7 +760,7 @@ void DataSourceFactory::slotDataWritten(KIO::Job *job, KIO::filesize_t written)
{
Q_UNUSED
(
job
)
KIO
::
filesize_t
tempSize
=
static_cast
<
KIO
::
filesize_t
>
(
m_tempData
.
size
());
auto
tempSize
=
static_cast
<
KIO
::
filesize_t
>
(
m_tempData
.
size
());
//the complete data has been written
if
(
written
==
tempSize
)
//TODO if not same cache it temporarily!
{
...
...
core/download.h
View file @
d31fd65f
...
...
@@ -36,7 +36,7 @@ class KGET_EXPORT Download : public QObject
void
slotData
(
KIO
::
Job
*
job
,
const
QByteArray
&
data
);
private:
KIO
::
TransferJob
*
m_copyJob
;
KIO
::
TransferJob
*
m_copyJob
=
nullptr
;
QUrl
m_srcUrl
;
QUrl
m_destUrl
;
QUrl
m_destFile
;
...
...
core/filedeleter.cpp
View file @
d31fd65f
...
...
@@ -56,7 +56,7 @@ KJob *FileDeleter::Private::deleteFile(const QUrl &dest, QObject *receiver, cons
void
FileDeleter
::
Private
::
slotResult
(
KJob
*
job
)
{
KIO
::
DeleteJob
*
deleteJob
=
static_cast
<
KIO
::
DeleteJob
*>
(
job
);
auto
*
deleteJob
=
static_cast
<
KIO
::
DeleteJob
*>
(
job
);
m_jobs
.
remove
(
deleteJob
->
urls
().
first
());
}
...
...
core/filemodel.cpp
View file @
d31fd65f
...
...
@@ -349,13 +349,13 @@ QVariant FileModel::data(const QModelIndex &index, int role) const
}
FileItem
*
item
=
static_cast
<
FileItem
*>
(
index
.
internalPointer
());
auto
*
item
=
static_cast
<
FileItem
*>
(
index
.
internalPointer
());
const
QVariant
data
=
item
->
data
(
index
.
column
(),
role
);
//get the status icon as well as status text
if
(
index
.
column
()
==
FileItem
::
Status
)
{
const
Job
::
Status
status
=
static_cast
<
Job
::
Status
>
(
data
.
toInt
());
const
auto
status
=
static_cast
<
Job
::
Status
>
(
data
.
toInt
());
if
(
item
->
isFile
())
{
if
(
role
==
Qt
::
DisplayRole
)
{
...
...
@@ -394,7 +394,7 @@ bool FileModel::setData(const QModelIndex &index, const QVariant &value, int rol
return
false
;
}
FileItem
*
item
=
static_cast
<
FileItem
*>
(
index
.
internalPointer
());
auto
*
item
=
static_cast
<
FileItem
*>
(
index
.
internalPointer
());
if
((
index
.
column
()
==
FileItem
::
File
)
&&
(
role
==
Qt
::
CheckStateRole
))
{
const
bool
worked
=
item
->
setData
(
index
.
column
(),
value
,
this
,
role
);
...
...
@@ -491,7 +491,7 @@ QModelIndex FileModel::parent(const QModelIndex &index) const
return
QModelIndex
();
}
FileItem
*
childItem
=
static_cast
<
FileItem
*>
(
index
.
internalPointer
());
auto
*
childItem
=
static_cast
<
FileItem
*>
(
index
.
internalPointer
());
FileItem
*
parentItem
=
childItem
->
parent
();
if
((
parentItem
==
m_rootItem
)
||
(
!
parentItem
))
{
...
...
@@ -640,7 +640,7 @@ bool FileModel::isFile(const QModelIndex &index) const
return
false
;
}
FileItem
*
item
=
static_cast
<
FileItem
*>
(
index
.
internalPointer
());
auto
*
item
=
static_cast
<
FileItem
*>
(
index
.
internalPointer
());
//only files can be renamed, no folders
return
item
->
isFile
();
...
...
@@ -653,7 +653,7 @@ void FileModel::rename(const QModelIndex &file, const QString &newName)
return
;
}
FileItem
*
item
=
static_cast
<
FileItem
*>
(
file
.
internalPointer
());
auto
*
item
=
static_cast
<
FileItem
*>
(
file
.
internalPointer
());
//only files can be renamed, no folders
if
(
!
item
->
isFile
())
{
return
;
...
...
core/keydownloader.cpp
View file @
d31fd65f
...
...
@@ -122,7 +122,7 @@ void KeyDownloader::slotDownloaded(KJob *job)
}
const
QString
fingerprint
=
m_jobs
[
job
];
KIO
::
StoredTransferJob
*
transferJob
=
static_cast
<
KIO
::
StoredTransferJob
*>
(
job
);
auto
*
transferJob
=
static_cast
<
KIO
::
StoredTransferJob
*>
(
job
);
if
(
transferJob
->
isErrorPage
())
{
qCDebug
(
KGET_DEBUG
)
<<
"Mirror did not work, try another one."
;
...
...
core/kget.cpp
View file @
d31fd65f
...
...
@@ -105,7 +105,7 @@ bool KGet::addGroup(const QString& groupName)
if
(
m_transferTreeModel
->
findGroup
(
groupName
))
return
false
;
TransferGroup
*
group
=
new
TransferGroup
(
m_transferTreeModel
,
m_scheduler
,
groupName
);
auto
*
group
=
new
TransferGroup
(
m_transferTreeModel
,
m_scheduler
,
groupName
);
m_transferTreeModel
->
addGroup
(
group
);
return
true
;
...
...
@@ -541,7 +541,7 @@ void KGet::load( QString filename ) // krazy:exclude=passbyvalue
{
qCDebug
(
KGET_DEBUG
)
<<
"KGet::load -> group not found"
;
TransferGroup
*
newGroup
=
new
TransferGroup
(
m_transferTreeModel
,
m_scheduler
);
auto
*
newGroup
=
new
TransferGroup
(
m_transferTreeModel
,
m_scheduler
);
m_transferTreeModel
->
addGroup
(
newGroup
);
...
...
@@ -1480,7 +1480,7 @@ void GenericObserver::transfersChangedEvent(QMap<TransferHandler*, Transfer::Cha
void
GenericObserver
::
slotResolveTransferError
()
{
KNotification
*
notification
=
static_cast
<
KNotification
*>
(
QObject
::
sender
());
auto
*
notification
=
static_cast
<
KNotification
*>
(
QObject
::
sender
());
if
(
notification
)
{
TransferHandler
*
handler
=
m_notifications
[
notification
];
qDebug
()
<<
"Resolve error for"
<<
handler
->
source
().
toString
()
<<
"with id"
<<
handler
->
error
().
id
;
...
...
@@ -1492,7 +1492,7 @@ void GenericObserver::slotResolveTransferError()
void
GenericObserver
::
slotNotificationClosed
()
{
qDebug
()
<<
"Remove notification"
;
KNotification
*
notification
=
static_cast
<
KNotification
*>
(
QObject
::
sender
());
auto
*
notification
=
static_cast
<
KNotification
*>
(
QObject
::
sender
());
if
(
notification
)
m_notifications
.
remove
(
notification
);
}
...
...
core/signature.cpp
View file @
d31fd65f
...
...
@@ -86,7 +86,7 @@ GpgME::VerificationResult SignaturePrivate::verify(const QUrl &dest, const QByte
std
::
shared_ptr
<
QFile
>
qFile
(
new
QFile
(
dest
.
toDisplayString
(
QUrl
::
PreferLocalFile
)));
qFile
->
open
(
QIODevice
::
ReadOnly
);
QGpgME
::
QIODeviceDataProvider
*
file
=
new
QGpgME
::
QIODeviceDataProvider
(
qFile
);
auto
*
file
=
new
QGpgME
::
QIODeviceDataProvider
(
qFile
);
GpgME
::
Data
dFile
(
file
);
QGpgME
::
QByteArrayDataProvider
signatureBA
(
sig
);
...
...
core/transfergroup.cpp
View file @
d31fd65f
...
...
@@ -42,7 +42,7 @@ int TransferGroup::downloadSpeed()
m_downloadSpeed
=
0
;
foreach
(
Job
*
job
,
runningJobs
())
{
Transfer
*
transfer
=
static_cast
<
Transfer
*>
(
job
);
auto
*
transfer
=
static_cast
<
Transfer
*>
(
job
);
if
(
transfer
)
m_downloadSpeed
+=
transfer
->
downloadSpeed
();
}
...
...
@@ -54,7 +54,7 @@ int TransferGroup::uploadSpeed()
m_uploadSpeed
=
0
;
foreach
(
Job
*
job
,
runningJobs
())
{
Transfer
*
transfer
=
static_cast
<
Transfer
*>
(
job
);
auto
*
transfer
=
static_cast
<
Transfer
*>
(
job
);
if
(
transfer
)
m_uploadSpeed
+=
transfer
->
uploadSpeed
();
}
...
...
@@ -65,7 +65,7 @@ bool TransferGroup::supportsSpeedLimits()
{
QList
<
Job
*>
jobs
=
runningJobs
();
foreach
(
Job
*
job
,
jobs
)
{
Transfer
*
transfer
=
static_cast
<
Transfer
*>
(
job
);
auto
*
transfer
=
static_cast
<
Transfer
*>
(
job
);
if
(
!
(
transfer
->
capabilities
()
&
Transfer
::
Cap_SpeedLimit
))
{
return
false
;
}
...
...
@@ -148,7 +148,7 @@ Transfer * TransferGroup::findTransfer(const QUrl &src)
for
(;
it
!=
itEnd
;
++
it
)
{
Transfer
*
t
=
(
Transfer
*
)
*
it
;
auto
*
t
=
(
Transfer
*
)
*
it
;
if
(
t
->
source
().
url
()
==
src
.
url
()
)
return
t
;
}
...
...
@@ -161,7 +161,7 @@ Transfer *TransferGroup::findTransferByDestination(const QUrl &dest)
iterator
itEnd
=
end
();
for
(;
it
!=
itEnd
;
++
it
)
{
Transfer
*
t
=
(
Transfer
*
)
*
it
;
auto
*
t
=
(
Transfer
*
)
*
it
;
if
(
t
->
dest
().
url
()
==
dest
.
url
())
{
return
t
;
}
...
...
@@ -228,7 +228,7 @@ void TransferGroup::calculateDownloadLimit()
int
pool
=
0
;
//We create a pool where we have some KiB/s to go to other transfer's...
QList
<
Transfer
*>
transfersNeedSpeed
;
foreach
(
Job
*
job
,
running
)
{
Transfer
*
transfer
=
static_cast
<
Transfer
*>
(
job
);
auto
*
transfer
=
static_cast
<
Transfer
*>
(
job
);
if
(
transfer
)
{
if
(
m_downloadLimit
==
0
&&
transfer
->
downloadLimit
(
Transfer
::
VisibleSpeedLimit
)
!=
0
)
...
...
@@ -271,7 +271,7 @@ void TransferGroup::calculateUploadLimit()
int
pool
=
0
;
//We create a pool where we have some KiB/s to go to other transfer's...
QList
<
Transfer
*>
transfersNeedSpeed
;
foreach
(
Job
*
job
,
running
)
{
Transfer
*
transfer
=
static_cast
<
Transfer
*>
(
job
);
auto
*
transfer
=
static_cast
<
Transfer
*>
(
job
);
if
(
transfer
)
{
if
(
m_uploadLimit
==
0
&&
transfer
->
uploadLimit
(
Transfer
::
VisibleSpeedLimit
)
!=
0
)
...
...
@@ -321,7 +321,7 @@ void TransferGroup::save(QDomElement e) // krazy:exclude=passbyvalue
for
(
;
it
!=
itEnd
;
++
it
)
{
Transfer
*
transfer
=
static_cast
<
Transfer
*>
(
*
it
);
auto
*
transfer
=
static_cast
<
Transfer
*>
(
*
it
);
qCDebug
(
KGET_DEBUG
)
<<
" --> "
<<
name
()
<<
" transfer: "
<<
transfer
->
source
();
QDomElement
t
=
e
.
ownerDocument
().
createElement
(
"Transfer"
);
e
.
appendChild
(
t
);
...
...
core/transfertreemodel.cpp
View file @
d31fd65f
...
...
@@ -273,7 +273,7 @@ void TransferTreeModel::addTransfers(const QList<Transfer*> &transfers, Transfer
m_transfers
.
append
(
static_cast
<
TransferModelItem
*>
(
items
.
first
()));
DBusTransferWrapper
*
wrapper
=
new
DBusTransferWrapper
(
handler
);
auto
*
wrapper
=
new
DBusTransferWrapper
(
handler
);
new
TransferAdaptor
(
wrapper
);
QDBusConnection
::
sessionBus
().
registerObject
(
handler
->
dBusObjectPath
(),
wrapper
);
}
...
...
@@ -384,7 +384,7 @@ GroupModelItem * TransferTreeModel::itemFromTransferGroupHandler(TransferGroupHa
ModelItem
*
TransferTreeModel
::
itemFromHandler
(
Handler
*
handler
)
{
TransferHandler
*
transfer
=
qobject_cast
<
TransferHandler
*>
(
handler
);
auto
*
transfer
=
qobject_cast
<
TransferHandler
*>
(
handler
);
if
(
transfer
)
{
return
itemFromTransferHandler
(
transfer
);
}
...
...
@@ -575,7 +575,7 @@ QStringList TransferTreeModel::mimeTypes() const
QMimeData
*
TransferTreeModel
::
mimeData
(
const
QModelIndexList
&
indexes
)
const
{
ItemMimeData
*
mimeData
=
new
ItemMimeData
();
auto
*
mimeData
=
new
ItemMimeData
();
QModelIndexList
sortedIndexes
=
indexes
;
std
::
sort
(
sortedIndexes
.
begin
(),
sortedIndexes
.
end
(),
[](
const
QModelIndex
&
a
,
const
QModelIndex
&
b
)
{
return
b
<
a
;
});
...
...
@@ -597,7 +597,7 @@ bool TransferTreeModel::dropMimeData(const QMimeData * mdata, Qt::DropAction act
if
(
action
==
Qt
::
IgnoreAction
)
return
true
;
const
ItemMimeData
*
itemData
=
qobject_cast
<
const
ItemMimeData
*>
(
mdata
);
const
auto
*
itemData
=
qobject_cast
<
const
ItemMimeData
*>
(
mdata
);
if
(
!
itemData
)
{
qCWarning
(
KGET_DEBUG
)
<<
"Unsupported mime data dropped."
;
return
false
;
...
...
core/urlchecker.cpp
View file @
d31fd65f
...
...
@@ -51,10 +51,10 @@ ExistingTransferDialog::ExistingTransferDialog(const QString &text, const QStrin
setWindowTitle
(
caption
.
isEmpty
()
?
i18n
(
"Question"
)
:
caption
);
setModal
(
true
);
QVBoxLayo
ut
*
layout
=
new
QVBoxLayout
;
QHBoxLayo
ut
*
bottomLayout
=
new
QHBoxLayout
;
a
ut
o
*
layout
=
new
QVBoxLayout
;
a
ut
o
*
bottomLayout
=
new
QHBoxLayout
;
QLabel
*
label
=
new
QLabel
(
text
,
this
);
auto
*
label
=
new
QLabel
(
text
,
this
);
layout
->
addWidget
(
label
);
layout
->
addWidget
(
new
KSeparator
(
Qt
::
Horizontal
,
this
));
...
...
@@ -62,7 +62,7 @@ ExistingTransferDialog::ExistingTransferDialog(const QString &text, const QStrin
bottomLayout
->
addStretch
(
1
);
bottomLayout
->
addWidget
(
m_applyAll
);
QDialogButtonBox
*
buttonBox
=
new
QDialogButtonBox
(
this
);
auto
*
buttonBox
=
new
QDialogButtonBox
(
this
);
buttonBox
->
setStandardButtons
(
QDialogButtonBox
::
Yes
|
QDialogButtonBox
::
No
|
QDialogButtonBox
::
Cancel
);
connect
(
buttonBox
->
button
(
QDialogButtonBox
::
Yes
),
&
QPushButton
::
clicked
,
this
,
&
ExistingTransferDialog
::
slotYesClicked
);
connect
(
buttonBox
->
button
(
QDialogButtonBox
::
No
),
&
QPushButton
::
clicked
,
this
,
&
ExistingTransferDialog
::
slotNoClicked
);
...
...
core/verificationdelegate.cpp
View file @
d31fd65f
...
...
@@ -52,7 +52,7 @@ QWidget *VerificationDelegate::createEditor(QWidget *parent, const QStyleOptionV
if
(
index
.
isValid
())
{
if
(
index
.
column
()
==
VerificationModel
::
Type
)
{
if
(
d
->
hashTypes
.
count
())
{
KComboBox
*
hashTypes
=
new
KComboBox
(
parent
);
auto
*
hashTypes
=
new
KComboBox
(
parent
);
hashTypes
->
addItems
(
d
->
hashTypes
);
return
hashTypes
;
...
...
@@ -69,11 +69,11 @@ void VerificationDelegate::setEditorData(QWidget *editor, const QModelIndex &ind
{
if
(
index
.
isValid
()
&&
editor
)
{
if
(
index
.
column
()
==
VerificationModel
::
Type
)
{
KComboBox
*
hashTypes
=
static_cast
<
KComboBox
*>
(
editor
);
auto
*
hashTypes
=
static_cast
<
KComboBox
*>
(
editor
);
const
QString
hashType
=
index
.
data
().
toString
();
hashTypes
->
setCurrentItem
(
hashType
);
}
else
if
(
index
.
column
()
==
VerificationModel
::
Checksum
)
{
KLineEdit
*
line
=
static_cast
<
KLineEdit
*>
(
editor
);
auto
*
line
=
static_cast
<
KLineEdit
*>
(
editor
);
const
QString
checksum
=
index
.
data
().
toString
();
line
->
setText
(
checksum
);
}
...
...
@@ -84,10 +84,10 @@ void VerificationDelegate::setModelData(QWidget *editor, QAbstractItemModel *mod
{
if
(
index
.
isValid
()
&&
editor
&&
model
)
{
if
(
index
.
column
()
==
VerificationModel
::
Type
)
{
KComboBox
*
hashTypes
=
static_cast
<
KComboBox
*>
(
editor
);
auto
*
hashTypes
=
static_cast
<
KComboBox
*>
(
editor
);
model
->
setData
(
index
,
hashTypes
->
currentText
());
}
else
if
(
index
.
column
()
==
VerificationModel
::
Checksum
)
{
KLineEdit
*
line
=
static_cast
<
KLineEdit
*>
(
editor
);
auto
*
line
=
static_cast
<
KLineEdit
*>
(
editor
);
model
->
setData
(
index
,
line
->
text
());
}
}
...
...
core/verifier.cpp
View file @
d31fd65f
...
...
@@ -169,7 +169,7 @@ Verifier::Verifier(const QUrl &dest, QObject *parent)
static
int
dBusObjIdx
=
0
;
d
->
dBusObjectPath
=
"/KGet/Verifiers/"
+
QString
::
number
(
dBusObjIdx
++
);
DBusVerifierWrapper
*
wrapper
=
new
DBusVerifierWrapper
(
this
);
auto
*
wrapper
=
new
DBusVerifierWrapper
(
this
);
new
VerifierAdaptor
(
wrapper
);
QDBusConnection
::
sessionBus
().
registerObject
(
d
->
dBusObjectPath
,
wrapper
);
...
...
dbus/dbuskgetwrapper.cpp
View file @
d31fd65f
...
...
@@ -160,7 +160,7 @@ int DBusKGetWrapper::transfersSpeed() const
void
DBusKGetWrapper
::
importLinks
(
const
QList
<
QString
>
&
links
)
{
KGetLinkView
*
link_view
=
new
KGetLinkView
(
m_mainWindow
);
auto
*
link_view
=
new
KGetLinkView
(
m_mainWindow
);
link_view
->
setLinks
(
links
);
link_view
->
show
();
}
...
...
extensions/konqueror/kget_plug_in.cpp
View file @
d31fd65f
...
...
@@ -45,14 +45,14 @@ K_PLUGIN_FACTORY(KGetPluginFactory, registerPlugin<KGetPlugin>();)
static
QWidget
*
partWidget
(
QObject
*
obj
)
{
KParts
::
ReadOnlyPart
*
part
=
qobject_cast
<
KParts
::
ReadOnlyPart
*>
(
obj
);
auto
*
part
=
qobject_cast
<
KParts
::
ReadOnlyPart
*>
(
obj
);
return
part
?
part
->
widget
()
:
nullptr
;
}
KGetPlugin
::
KGetPlugin
(
QObject
*
parent
,
const
QVariantList
&
)
:
KParts
::
Plugin
(
parent
)
{
KActionMenu
*
menu
=
new
KActionMenu
(
QIcon
::
fromTheme
(
"kget"
),
i18n
(
"Download Manager"
),
actionCollection
());
auto
*
menu
=
new
KActionMenu
(
QIcon
::
fromTheme
(
"kget"
),
i18n
(
"Download Manager"
),
actionCollection
());
actionCollection
()
->
addAction
(
"kget_menu"
,
menu
);
menu
->
setDelayed
(
false
);
...
...
main.cpp
View file @
d31fd65f
...
...
@@ -52,7 +52,7 @@ public:
kget
=
new
MainWindow
(
!
parser
->
isSet
(
"showDropTarget"
),
parser
->
isSet
(
"startWithoutAnimation"
),
false
);
#endif
DBusKGetWrapper
*
wrapper
=
new
DBusKGetWrapper
(
kget
);
auto
*
wrapper
=
new
DBusKGetWrapper
(
kget
);
new
MainAdaptor
(
wrapper
);
QDBusConnection
::
sessionBus
().
registerObject
(
"/KGet"
,
wrapper
);
}
else
{
...
...
Prev
1
2
3
4
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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