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
PIM
libkdepim
Commits
e65fdb21
Commit
e65fdb21
authored
Jan 26, 2021
by
Laurent Montel
😁
Browse files
run git clang-format
parent
67b2999c
Changes
26
Hide whitespace changes
Inline
Side-by-side
src/libkdepim/libkdepim_private_export.h
View file @
e65fdb21
...
...
@@ -11,11 +11,11 @@
/* Classes which are exported only for unit tests */
#ifdef BUILD_TESTING
#
ifndef LIBKDEPIM_TESTS_EXPORT
#
define LIBKDEPIM_TESTS_EXPORT KDEPIM_EXPORT
#
endif
#ifndef LIBKDEPIM_TESTS_EXPORT
#define LIBKDEPIM_TESTS_EXPORT KDEPIM_EXPORT
#endif
#else
/* not compiling tests */
#
define LIBKDEPIM_TESTS_EXPORT
#define LIBKDEPIM_TESTS_EXPORT
#endif
#endif
src/libkdepim/misc/lineeditcatchreturnkey.cpp
View file @
e65fdb21
...
...
@@ -28,8 +28,7 @@ bool LineEditCatchReturnKey::eventFilter(QObject *obj, QEvent *event)
if
(
event
->
type
()
==
QEvent
::
KeyPress
)
{
auto
e
=
static_cast
<
QKeyEvent
*>
(
event
);
if
(
e
->
key
()
==
Qt
::
Key_Return
||
e
->
key
()
==
Qt
::
Key_Enter
)
{
const
bool
stopEvent
=
(
e
->
modifiers
()
==
Qt
::
NoButton
||
e
->
modifiers
()
==
Qt
::
KeypadModifier
);
const
bool
stopEvent
=
(
e
->
modifiers
()
==
Qt
::
NoButton
||
e
->
modifiers
()
==
Qt
::
KeypadModifier
);
if
(
stopEvent
)
{
Q_EMIT
mLineEdit
->
returnPressed
();
}
...
...
src/libkdepim/misc/lineeditcatchreturnkey.h
View file @
e65fdb21
...
...
@@ -7,10 +7,11 @@
#ifndef LINEEDITCATCHRETURNKEY_H
#define LINEEDITCATCHRETURNKEY_H
#include <QObject>
#include "kdepim_export.h"
#include <QObject>
class
QLineEdit
;
namespace
KPIM
{
namespace
KPIM
{
/**
* @brief The LineEditCatchReturnKey class
* @author Laurent Montel <montel@kde.org>
...
...
src/libkdepim/multiplyingline/multiplyingline.h
View file @
e65fdb21
...
...
@@ -15,10 +15,11 @@
#include "kdepim_export.h"
#include <KCompletion>
#include <QWidget>
#include <QSharedPointer>
#include <QWidget>
namespace
KPIM
{
namespace
KPIM
{
/**
@short ABC representing line data
@author Casey Link
...
...
src/libkdepim/multiplyingline/multiplyinglineeditor.cpp
View file @
e65fdb21
...
...
@@ -25,12 +25,10 @@ MultiplyingLineEditor::MultiplyingLineEditor(MultiplyingLineFactory *factory, QW
topLayout
->
addWidget
(
mView
);
connect
(
mView
,
&
MultiplyingLineView
::
focusUp
,
this
,
&
MultiplyingLineEditor
::
focusUp
);
connect
(
mView
,
&
MultiplyingLineView
::
focusDown
,
this
,
&
MultiplyingLineEditor
::
focusDown
);
connect
(
mView
,
&
MultiplyingLineView
::
completionModeChanged
,
this
,
&
MultiplyingLineEditor
::
completionModeChanged
);
connect
(
mView
,
&
MultiplyingLineView
::
completionModeChanged
,
this
,
&
MultiplyingLineEditor
::
completionModeChanged
);
connect
(
mView
,
&
MultiplyingLineView
::
lineDeleted
,
this
,
&
MultiplyingLineEditor
::
lineDeleted
);
connect
(
mView
,
&
MultiplyingLineView
::
lineAdded
,
this
,
&
MultiplyingLineEditor
::
lineAdded
);
connect
(
mView
,
&
MultiplyingLineView
::
sizeHintChanged
,
this
,
&
MultiplyingLineEditor
::
sizeHintChanged
);
connect
(
mView
,
&
MultiplyingLineView
::
sizeHintChanged
,
this
,
&
MultiplyingLineEditor
::
sizeHintChanged
);
}
MultiplyingLineEditor
::~
MultiplyingLineEditor
()
...
...
@@ -108,7 +106,7 @@ MultiplyingLineFactory *MultiplyingLineEditor::factory() const
return
mMultiplyingLineFactory
;
}
QVector
<
MultiplyingLineData
::
Ptr
>
MultiplyingLineEditor
::
allData
()
const
QVector
<
MultiplyingLineData
::
Ptr
>
MultiplyingLineEditor
::
allData
()
const
{
return
mView
->
allData
();
}
...
...
@@ -118,7 +116,7 @@ MultiplyingLineData::Ptr MultiplyingLineEditor::activeData() const
return
mView
->
activeLine
()
->
data
();
}
QList
<
MultiplyingLine
*
>
MultiplyingLineEditor
::
lines
()
const
QList
<
MultiplyingLine
*>
MultiplyingLineEditor
::
lines
()
const
{
return
mView
->
lines
();
}
...
...
src/libkdepim/multiplyingline/multiplyinglineeditor.h
View file @
e65fdb21
...
...
@@ -17,10 +17,11 @@
#include "multiplyingline.h"
#include <KCompletion>
#include <QWidget>
#include <QObject>
#include <QWidget>
namespace
KPIM
{
namespace
KPIM
{
class
MultiplyingLineView
;
/**
...
...
@@ -32,7 +33,8 @@ class KDEPIM_EXPORT MultiplyingLineFactory : public QObject
{
Q_OBJECT
public:
explicit
MultiplyingLineFactory
(
QObject
*
parent
)
:
QObject
(
parent
)
explicit
MultiplyingLineFactory
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
...
...
@@ -72,7 +74,6 @@ class KDEPIM_EXPORT MultiplyingLineEditor : public QWidget
Q_PROPERTY
(
bool
dynamicSizeHint
READ
dynamicSizeHint
WRITE
setDynamicSizeHint
)
public:
// We take ownership of factory
explicit
MultiplyingLineEditor
(
MultiplyingLineFactory
*
factory
,
QWidget
*
parent
=
nullptr
);
...
...
@@ -98,7 +99,7 @@ public:
bool
isModified
();
/** Resets the modified flag to false.
*/
*/
void
clearModified
();
/** Adds data to one line of the editor.
...
...
src/libkdepim/multiplyingline/multiplyinglineview_p.cpp
View file @
e65fdb21
...
...
@@ -11,13 +11,13 @@
#include "multiplyinglineview_p.h"
#include "libkdepim_debug.h"
#include <KMessageBox>
#include <KLocalizedString>
#include <KMessageBox>
#include <QVBoxLayout>
#include <QTimer>
#include <QScrollBar>
#include <QResizeEvent>
#include <QScrollBar>
#include <QTimer>
#include <QVBoxLayout>
using
namespace
KPIM
;
...
...
@@ -59,8 +59,7 @@ MultiplyingLine *MultiplyingLineView::addLine()
if
(
maximumRecipients
!=
-
1
)
{
int
numberOfLine
=
mLines
.
count
();
if
(
numberOfLine
++
>=
maximumRecipients
)
{
KMessageBox
::
sorry
(
this
,
i18n
(
"We can not add more recipients. We have reached maximum recipients"
));
KMessageBox
::
sorry
(
this
,
i18n
(
"We can not add more recipients. We have reached maximum recipients"
));
return
nullptr
;
}
...
...
@@ -70,17 +69,12 @@ MultiplyingLine *MultiplyingLineView::addLine()
mTopLayout
->
addWidget
(
line
);
line
->
setCompletionMode
(
mCompletionMode
);
line
->
show
();
connect
(
line
,
&
MultiplyingLine
::
returnPressed
,
this
,
&
MultiplyingLineView
::
slotReturnPressed
);
connect
(
line
,
&
MultiplyingLine
::
upPressed
,
this
,
&
MultiplyingLineView
::
slotUpPressed
);
connect
(
line
,
&
MultiplyingLine
::
downPressed
,
this
,
&
MultiplyingLineView
::
slotDownPressed
);
connect
(
line
,
&
MultiplyingLine
::
returnPressed
,
this
,
&
MultiplyingLineView
::
slotReturnPressed
);
connect
(
line
,
&
MultiplyingLine
::
upPressed
,
this
,
&
MultiplyingLineView
::
slotUpPressed
);
connect
(
line
,
&
MultiplyingLine
::
downPressed
,
this
,
&
MultiplyingLineView
::
slotDownPressed
);
connect
(
line
,
&
MultiplyingLine
::
rightPressed
,
this
,
&
MultiplyingLineView
::
focusRight
);
connect
(
line
,
&
MultiplyingLine
::
deleteLine
,
this
,
&
MultiplyingLineView
::
slotDecideLineDeletion
);
connect
(
line
,
&
MultiplyingLine
::
completionModeChanged
,
this
,
&
MultiplyingLineView
::
setCompletionMode
);
connect
(
line
,
&
MultiplyingLine
::
deleteLine
,
this
,
&
MultiplyingLineView
::
slotDecideLineDeletion
);
connect
(
line
,
&
MultiplyingLine
::
completionModeChanged
,
this
,
&
MultiplyingLineView
::
setCompletionMode
);
if
(
!
mLines
.
isEmpty
())
{
line
->
fixTabOrder
(
mLines
.
last
()
->
tabOut
());
...
...
@@ -278,7 +272,7 @@ void MultiplyingLineView::setCompletionMode(KCompletion::CompletionMode mode)
line
->
setCompletionMode
(
mode
);
line
->
blockSignals
(
false
);
}
Q_EMIT
completionModeChanged
(
mode
);
//report change to MultiplyingLineEditor
Q_EMIT
completionModeChanged
(
mode
);
//
report change to MultiplyingLineEditor
}
void
MultiplyingLineView
::
removeData
(
const
MultiplyingLineData
::
Ptr
&
data
)
...
...
@@ -374,7 +368,7 @@ int MultiplyingLineView::setFirstColumnWidth(int w)
return
mFirstColumnWidth
;
}
QList
<
MultiplyingLine
*
>
MultiplyingLineView
::
lines
()
const
QList
<
MultiplyingLine
*>
MultiplyingLineView
::
lines
()
const
{
return
mLines
;
}
...
...
src/libkdepim/multiplyingline/multiplyinglineview_p.h
View file @
e65fdb21
...
...
@@ -18,7 +18,8 @@
#include <QPointer>
#include <QScrollArea>
namespace
KPIM
{
namespace
KPIM
{
class
MultiplyingLineView
:
public
QScrollArea
{
Q_OBJECT
...
...
@@ -49,18 +50,18 @@ public:
bool
isModified
()
const
;
/** Resets the modified flag to false.
*/
*/
void
clearModified
();
/** Activates the line */
void
activateLine
(
MultiplyingLine
*
line
);
/**QScrollArea
* Set the width of the left most column to be the argument width.
* This method allows other widgets to align their label/combobox column with ours
* by communicating how many pixels that first column is for them.
* Returns the width that is actually being used.
*/
* Set the width of the left most column to be the argument width.
* This method allows other widgets to align their label/combobox column with ours
* by communicating how many pixels that first column is for them.
* Returns the width that is actually being used.
*/
int
setFirstColumnWidth
(
int
);
/**
...
...
@@ -123,4 +124,4 @@ private:
};
}
#endif //MULTIPLYINGLINEVIEW_P_H
#endif //
MULTIPLYINGLINEVIEW_P_H
src/libkdepim/progresswidget/autotests/progressstatusbarwidgettest.cpp
View file @
e65fdb21
...
...
@@ -5,10 +5,10 @@
*/
#include "progressstatusbarwidgettest.h"
#include "../progressstatusbarwidget.h"
#include <QTest>
#include "../progressdialog.h"
#include "../progressstatusbarwidget.h"
#include "../statusbarprogresswidget.h"
#include <QTest>
QTEST_MAIN
(
ProgressStatusBarWidgetTest
)
ProgressStatusBarWidgetTest
::
ProgressStatusBarWidgetTest
(
QObject
*
parent
)
...
...
src/libkdepim/progresswidget/autotests/statusbarprogresswidgettest.cpp
View file @
e65fdb21
...
...
@@ -5,15 +5,15 @@
*/
#include "statusbarprogresswidgettest.h"
#include "../statusbarprogresswidget.h"
#include "../progressdialog.h"
#include "../progressmanager.h"
#include
<QTest>
#include
"../statusbarprogresswidget.h"
#include <QHBoxLayout>
#include <QProgressBar>
#include <QPushButton>
#include <QStackedWidget>
#include <QProgressBar>
#include <QStandardPaths>
#include <QTest>
#include <progresswidget/ssllabel.h>
QTEST_MAIN
(
StatusbarProgressWidgetTest
)
...
...
src/libkdepim/progresswidget/progressdialog.cpp
View file @
e65fdb21
...
...
@@ -10,18 +10,18 @@
#include "progressdialog.h"
#include "ssllabel.h"
#include <QHBoxLayout>
#include <KLocalizedString>
#include <QHBoxLayout>
#include <QCloseEvent>
#include <QFrame>
#include <QLabel>
#include <QLayout>
#include <QObject>
#include <QProgressBar>
#include <QPushButton>
#include <QScrollBar>
#include <QTimer>
#include <QLayout>
#include <QVBoxLayout>
using
namespace
KPIM
;
...
...
@@ -97,8 +97,7 @@ void OverlayWidget::setAlignWidget(QWidget *w)
bool
OverlayWidget
::
eventFilter
(
QObject
*
o
,
QEvent
*
e
)
{
if
(
o
==
d
->
mAlignWidget
&&
(
e
->
type
()
==
QEvent
::
Move
||
e
->
type
()
==
QEvent
::
Resize
))
{
if
(
o
==
d
->
mAlignWidget
&&
(
e
->
type
()
==
QEvent
::
Move
||
e
->
type
()
==
QEvent
::
Resize
))
{
reposition
();
}
return
QFrame
::
eventFilter
(
o
,
e
);
...
...
@@ -110,7 +109,6 @@ void OverlayWidget::resizeEvent(QResizeEvent *ev)
QFrame
::
resizeEvent
(
ev
);
}
TransactionItemView
::
TransactionItemView
(
QWidget
*
parent
,
const
QString
&
name
)
:
QScrollArea
(
parent
)
{
...
...
@@ -171,9 +169,9 @@ QSize TransactionItemView::minimumSizeHint() const
void
TransactionItemView
::
slotLayoutFirstItem
()
{
//This slot is called whenever a TransactionItem is deleted, so this is a
//good place to call updateGeometry(), so our parent takes the new size
//into account and resizes.
//
This slot is called whenever a TransactionItem is deleted, so this is a
//
good place to call updateGeometry(), so our parent takes the new size
//
into account and resizes.
updateGeometry
();
/*
...
...
@@ -214,8 +212,7 @@ TransactionItem::TransactionItem(QWidget *parent, ProgressItem *item, bool first
hHBoxLayout
->
setSpacing
(
5
);
layout
()
->
addWidget
(
h
);
mItemLabel
=
new
QLabel
(
fontMetrics
().
elidedText
(
item
->
label
(),
Qt
::
ElideRight
,
MAX_LABEL_WIDTH
),
h
);
mItemLabel
=
new
QLabel
(
fontMetrics
().
elidedText
(
item
->
label
(),
Qt
::
ElideRight
,
MAX_LABEL_WIDTH
),
h
);
h
->
layout
()
->
addWidget
(
mItemLabel
);
h
->
setSizePolicy
(
QSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Fixed
));
...
...
@@ -229,8 +226,7 @@ TransactionItem::TransactionItem(QWidget *parent, ProgressItem *item, bool first
mCancelButton
=
new
QPushButton
(
QIcon
::
fromTheme
(
QStringLiteral
(
"dialog-cancel"
)),
QString
(),
h
);
hHBoxLayout
->
addWidget
(
mCancelButton
);
mCancelButton
->
setToolTip
(
i18n
(
"Cancel this operation."
));
connect
(
mCancelButton
,
&
QAbstractButton
::
clicked
,
this
,
&
TransactionItem
::
slotItemCanceled
);
connect
(
mCancelButton
,
&
QAbstractButton
::
clicked
,
this
,
&
TransactionItem
::
slotItemCanceled
);
h
->
layout
()
->
addWidget
(
mCancelButton
);
}
...
...
@@ -247,8 +243,7 @@ TransactionItem::TransactionItem(QWidget *parent, ProgressItem *item, bool first
mItemStatus
=
new
QLabel
(
h
);
hHBoxLayout
->
addWidget
(
mItemStatus
);
mItemStatus
->
setTextFormat
(
Qt
::
RichText
);
mItemStatus
->
setText
(
fontMetrics
().
elidedText
(
item
->
status
(),
Qt
::
ElideRight
,
MAX_LABEL_WIDTH
));
mItemStatus
->
setText
(
fontMetrics
().
elidedText
(
item
->
status
(),
Qt
::
ElideRight
,
MAX_LABEL_WIDTH
));
h
->
layout
()
->
addWidget
(
mItemStatus
);
setCryptoStatus
(
item
->
cryptoStatus
());
if
(
first
)
{
...
...
@@ -321,9 +316,9 @@ ProgressDialog::ProgressDialog(QWidget *alignWidget, QWidget *parent)
// Qt Bug: Sunken is not applied for RTL layouts correctly (is not mirrored).
// For now let's just use Plain, which is fine for this.
if
(
layoutDirection
()
==
Qt
::
LeftToRight
)
{
setFrameStyle
(
QFrame
::
Panel
|
QFrame
::
Sunken
);
// QFrame
setFrameStyle
(
QFrame
::
Panel
|
QFrame
::
Sunken
);
// QFrame
}
else
{
setFrameStyle
(
QFrame
::
Panel
|
QFrame
::
Plain
);
// QFrame
setFrameStyle
(
QFrame
::
Panel
|
QFrame
::
Plain
);
// QFrame
}
setAutoFillBackground
(
true
);
...
...
@@ -331,26 +326,18 @@ ProgressDialog::ProgressDialog(QWidget *alignWidget, QWidget *parent)
mScrollView
=
new
TransactionItemView
(
this
,
QStringLiteral
(
"ProgressScrollView"
));
layout
()
->
addWidget
(
mScrollView
);
/*
* Get the singleton ProgressManager item which will inform us of
* appearing and vanishing items.
*/
* Get the singleton ProgressManager item which will inform us of
* appearing and vanishing items.
*/
ProgressManager
*
pm
=
ProgressManager
::
instance
();
connect
(
pm
,
&
ProgressManager
::
progressItemAdded
,
this
,
&
ProgressDialog
::
slotTransactionAdded
);
connect
(
pm
,
&
ProgressManager
::
progressItemCompleted
,
this
,
&
ProgressDialog
::
slotTransactionCompleted
);
connect
(
pm
,
&
ProgressManager
::
progressItemProgress
,
this
,
&
ProgressDialog
::
slotTransactionProgress
);
connect
(
pm
,
&
ProgressManager
::
progressItemStatus
,
this
,
&
ProgressDialog
::
slotTransactionStatus
);
connect
(
pm
,
&
ProgressManager
::
progressItemLabel
,
this
,
&
ProgressDialog
::
slotTransactionLabel
);
connect
(
pm
,
&
ProgressManager
::
progressItemCryptoStatus
,
this
,
&
ProgressDialog
::
slotTransactionCryptoStatus
);
connect
(
pm
,
&
ProgressManager
::
progressItemUsesBusyIndicator
,
this
,
&
ProgressDialog
::
slotTransactionUsesBusyIndicator
);
connect
(
pm
,
&
ProgressManager
::
showProgressDialog
,
this
,
&
ProgressDialog
::
slotShow
);
connect
(
pm
,
&
ProgressManager
::
progressItemAdded
,
this
,
&
ProgressDialog
::
slotTransactionAdded
);
connect
(
pm
,
&
ProgressManager
::
progressItemCompleted
,
this
,
&
ProgressDialog
::
slotTransactionCompleted
);
connect
(
pm
,
&
ProgressManager
::
progressItemProgress
,
this
,
&
ProgressDialog
::
slotTransactionProgress
);
connect
(
pm
,
&
ProgressManager
::
progressItemStatus
,
this
,
&
ProgressDialog
::
slotTransactionStatus
);
connect
(
pm
,
&
ProgressManager
::
progressItemLabel
,
this
,
&
ProgressDialog
::
slotTransactionLabel
);
connect
(
pm
,
&
ProgressManager
::
progressItemCryptoStatus
,
this
,
&
ProgressDialog
::
slotTransactionCryptoStatus
);
connect
(
pm
,
&
ProgressManager
::
progressItemUsesBusyIndicator
,
this
,
&
ProgressDialog
::
slotTransactionUsesBusyIndicator
);
connect
(
pm
,
&
ProgressManager
::
showProgressDialog
,
this
,
&
ProgressDialog
::
slotShow
);
}
void
ProgressDialog
::
closeEvent
(
QCloseEvent
*
e
)
...
...
@@ -404,8 +391,7 @@ void ProgressDialog::slotTransactionCompleted(ProgressItem *item)
ti
->
setItemComplete
();
QTimer
::
singleShot
(
3000
,
ti
,
&
QObject
::
deleteLater
);
// see the slot for comments as to why that works
connect
(
ti
,
&
QObject
::
destroyed
,
mScrollView
,
&
TransactionItemView
::
slotLayoutFirstItem
);
connect
(
ti
,
&
QObject
::
destroyed
,
mScrollView
,
&
TransactionItemView
::
slotLayoutFirstItem
);
}
// This was the last item, hide.
if
(
mTransactionsToListviewItems
.
empty
())
{
...
...
@@ -484,10 +470,10 @@ void ProgressDialog::setVisible(bool b)
void
ProgressDialog
::
slotToggleVisibility
()
{
/* Since we are only hiding with a timeout, there is a short period of
* time where the last item is still visible, but clicking on it in
* the statusbarwidget should not display the dialog, because there
* are no items to be shown anymore. Guard against that.
*/
* time where the last item is still visible, but clicking on it in
* the statusbarwidget should not display the dialog, because there
* are no items to be shown anymore. Guard against that.
*/
if
(
!
isHidden
()
||
!
mTransactionsToListviewItems
.
isEmpty
())
{
const
bool
showNow
=
isHidden
();
setVisible
(
showNow
);
...
...
src/libkdepim/progresswidget/progressdialog.h
View file @
e65fdb21
...
...
@@ -15,15 +15,16 @@
#include "progressmanager.h"
#include <QScrollArea>
#include <QMap>
#include <QScrollArea>
class
QProgressBar
;
class
QFrame
;
class
QLabel
;
class
QPushButton
;
namespace
KPIM
{
namespace
KPIM
{
class
TransactionItem
;
class
SSLLabel
;
...
...
src/libkdepim/progresswidget/progressmanager.cpp
View file @
e65fdb21
...
...
@@ -227,37 +227,49 @@ bool ProgressManager::isEmpty() const
return
mTransactions
.
isEmpty
();
}
ProgressItem
*
ProgressManager
::
createProgressItem
(
const
QString
&
id
,
const
QString
&
label
,
const
QString
&
status
,
bool
canBeCanceled
,
ProgressItem
::
CryptoStatus
cryptoStatus
)
ProgressItem
*
ProgressManager
::
createProgressItem
(
const
QString
&
id
,
const
QString
&
label
,
const
QString
&
status
,
bool
canBeCanceled
,
ProgressItem
::
CryptoStatus
cryptoStatus
)
{
return
instance
()
->
createProgressItemImpl
(
nullptr
,
id
,
label
,
status
,
canBeCanceled
,
cryptoStatus
);
return
instance
()
->
createProgressItemImpl
(
nullptr
,
id
,
label
,
status
,
canBeCanceled
,
cryptoStatus
);
}
ProgressItem
*
ProgressManager
::
createProgressItem
(
const
QString
&
parent
,
const
QString
&
id
,
const
QString
&
label
,
const
QString
&
status
,
bool
canBeCanceled
,
ProgressItem
::
CryptoStatus
cryptoStatus
)
ProgressItem
*
ProgressManager
::
createProgressItem
(
const
QString
&
parent
,
const
QString
&
id
,
const
QString
&
label
,
const
QString
&
status
,
bool
canBeCanceled
,
ProgressItem
::
CryptoStatus
cryptoStatus
)
{
return
instance
()
->
createProgressItemImpl
(
parent
,
id
,
label
,
status
,
canBeCanceled
,
cryptoStatus
);
return
instance
()
->
createProgressItemImpl
(
parent
,
id
,
label
,
status
,
canBeCanceled
,
cryptoStatus
);
}
ProgressItem
*
ProgressManager
::
createProgressItem
(
ProgressItem
*
parent
,
const
QString
&
id
,
const
QString
&
label
,
const
QString
&
status
,
bool
canBeCanceled
,
ProgressItem
::
CryptoStatus
cryptoStatus
)
ProgressItem
*
ProgressManager
::
createProgressItem
(
ProgressItem
*
parent
,
const
QString
&
id
,
const
QString
&
label
,
const
QString
&
status
,
bool
canBeCanceled
,
ProgressItem
::
CryptoStatus
cryptoStatus
)
{
return
instance
()
->
createProgressItemImpl
(
parent
,
id
,
label
,
status
,
canBeCanceled
,
cryptoStatus
);
return
instance
()
->
createProgressItemImpl
(
parent
,
id
,
label
,
status
,
canBeCanceled
,
cryptoStatus
);
}
ProgressItem
*
ProgressManager
::
createProgressItem
(
const
QString
&
label
)
{
return
instance
()
->
createProgressItemImpl
(
nullptr
,
getUniqueID
(),
label
,
QString
(),
true
,
KPIM
::
ProgressItem
::
Unencrypted
);
return
instance
()
->
createProgressItemImpl
(
nullptr
,
getUniqueID
(),
label
,
QString
(),
true
,
KPIM
::
ProgressItem
::
Unencrypted
);
}
ProgressItem
*
ProgressManager
::
createProgressItem
(
unsigned
int
progressType
,
const
QString
&
label
)
{
return
instance
()
->
createProgressItemImpl
(
nullptr
,
getUniqueID
(),
label
,
QString
(),
true
,
KPIM
::
ProgressItem
::
Unencrypted
,
progressType
);
return
instance
()
->
createProgressItemImpl
(
nullptr
,
getUniqueID
(),
label
,
QString
(),
true
,
KPIM
::
ProgressItem
::
Unencrypted
,
progressType
);
}
ProgressItem
*
ProgressManager
::
createProgressItemImpl
(
ProgressItem
*
parent
,
const
QString
&
id
,
const
QString
&
label
,
const
QString
&
status
,
bool
cancellable
,
ProgressItem
::
CryptoStatus
cryptoStatus
,
unsigned
int
progressType
)
ProgressItem
*
ProgressManager
::
createProgressItemImpl
(
ProgressItem
*
parent
,
const
QString
&
id
,
const
QString
&
label
,
const
QString
&
status
,
bool
cancellable
,
ProgressItem
::
CryptoStatus
cryptoStatus
,
unsigned
int
progressType
)
{
ProgressItem
*
t
=
nullptr
;
if
(
!
mTransactions
.
value
(
id
))
{
...
...
@@ -271,22 +283,14 @@ ProgressItem *ProgressManager::createProgressItemImpl(ProgressItem *parent, cons
}
}
// connect all signals
connect
(
t
,
&
ProgressItem
::
progressItemCompleted
,
this
,
&
ProgressManager
::
slotTransactionCompleted
);
connect
(
t
,
&
ProgressItem
::
progressItemProgress
,
this
,
&
ProgressManager
::
progressItemProgress
);
connect
(
t
,
&
ProgressItem
::
progressItemAdded
,
this
,
&
ProgressManager
::
progressItemAdded
);
connect
(
t
,
&
ProgressItem
::
progressItemCanceled
,
this
,
&
ProgressManager
::
progressItemCanceled
);
connect
(
t
,
&
ProgressItem
::
progressItemStatus
,
this
,
&
ProgressManager
::
progressItemStatus
);
connect
(
t
,
&
ProgressItem
::
progressItemLabel
,
this
,
&
ProgressManager
::
progressItemLabel
);
connect
(
t
,
&
ProgressItem
::
progressItemCryptoStatus
,
this
,
&
ProgressManager
::
progressItemCryptoStatus
);
connect
(
t
,
&
ProgressItem
::
progressItemUsesBusyIndicator
,
this
,
&
ProgressManager
::
progressItemUsesBusyIndicator
);
connect
(
t
,
&
ProgressItem
::
progressItemCompleted
,
this
,
&
ProgressManager
::
slotTransactionCompleted
);
connect
(
t
,
&
ProgressItem
::
progressItemProgress
,
this
,
&
ProgressManager
::
progressItemProgress
);
connect
(
t
,
&
ProgressItem
::
progressItemAdded
,
this
,
&
ProgressManager
::
progressItemAdded
);
connect
(
t
,
&
ProgressItem
::
progressItemCanceled
,
this
,
&
ProgressManager
::
progressItemCanceled
);
connect
(
t
,
&
ProgressItem
::
progressItemStatus
,
this
,
&
ProgressManager
::
progressItemStatus
);
connect
(
t
,
&
ProgressItem
::
progressItemLabel
,
this
,
&
ProgressManager
::
progressItemLabel
);
connect
(
t
,
&
ProgressItem
::
progressItemCryptoStatus
,
this
,
&
ProgressManager
::
progressItemCryptoStatus
);
connect
(
t
,
&
ProgressItem
::
progressItemUsesBusyIndicator
,
this
,
&
ProgressManager
::
progressItemUsesBusyIndicator
);
Q_EMIT
progressItemAdded
(
t
);
}
else
{
...
...
@@ -296,7 +300,13 @@ ProgressItem *ProgressManager::createProgressItemImpl(ProgressItem *parent, cons
return
t
;
}
ProgressItem
*
ProgressManager
::
createProgressItemImpl
(
const
QString
&
parent
,
const
QString
&
id
,
const
QString
&
label
,
const
QString
&
status
,
bool
canBeCanceled
,
ProgressItem
::
CryptoStatus
cryptoStatus
,
unsigned
int
progressType
)
ProgressItem
*
ProgressManager
::
createProgressItemImpl
(
const
QString
&
parent
,
const
QString
&
id
,
const
QString
&
label
,
const
QString
&
status
,
bool
canBeCanceled
,
ProgressItem
::
CryptoStatus
cryptoStatus
,
unsigned
int
progressType
)
{
ProgressItem
*
p
=
mTransactions
.
value
(
parent
);
return
createProgressItemImpl
(
p
,
id
,
label
,
status
,
canBeCanceled
,
cryptoStatus
,
progressType
);
...
...
@@ -323,15 +333,15 @@ void ProgressManager::slotStandardCancelHandler(ProgressItem *item)
ProgressItem
*
ProgressManager
::
singleItem
()
const
{
ProgressItem
*
item
=
nullptr
;
QHash
<
QString
,
ProgressItem
*
>::
const_iterator
it
=
mTransactions
.
constBegin
();
QHash
<
QString
,
ProgressItem
*
>::
const_iterator
end
=
mTransactions
.
constEnd
();
QHash
<
QString
,
ProgressItem
*>::
const_iterator
it
=
mTransactions
.
constBegin
();
QHash
<
QString
,
ProgressItem
*>::
const_iterator
end
=
mTransactions
.
constEnd
();
while
(
it
!=
end
)
{
// No single item for progress possible, as one of them is a busy indicator one.
if
((
*
it
)
->
usesBusyIndicator
())
{
return
nullptr
;
}
if
(
!
(
*
it
)
->
parent
())
{
// if it's a top level one, only those count
if
(
!
(
*
it
)
->
parent
())
{
// if it's a top level one, only those count
if
(
item
)
{
return
nullptr
;
// we found more than one
}
else
{
...
...
src/libkdepim/progresswidget/progressmanager.h
View file @
e65fdb21
...
...
@@ -13,13 +13,14 @@
#include "kdepim_export.h"
#include <QObject>
#include <QString>
#include <QMap>
#include <QHash>
#include <QMap>
#include <QObject>
#include <QPointer>
#include <QString>
namespace
KPIM
{
namespace
KPIM
{
class
ProgressItem
;
class
ProgressManager
;