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
KWalletManager
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
0
Merge Requests
0
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
KWalletManager
Commits
45e687ae
Commit
45e687ae
authored
Jul 02, 2017
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix clazy warning
parent
4f95d012
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
128 additions
and
128 deletions
+128
-128
src/konfigurator/konfigurator.cpp
src/konfigurator/konfigurator.cpp
+12
-12
src/manager/allyourbase.cpp
src/manager/allyourbase.cpp
+21
-21
src/manager/authorizedappmodel.cpp
src/manager/authorizedappmodel.cpp
+2
-2
src/manager/connectedappmodel.cpp
src/manager/connectedappmodel.cpp
+1
-1
src/manager/disconnectappbutton.cpp
src/manager/disconnectappbutton.cpp
+1
-1
src/manager/kwalleteditor.cpp
src/manager/kwalleteditor.cpp
+39
-39
src/manager/kwalletmanager.cpp
src/manager/kwalletmanager.cpp
+33
-33
src/manager/kwalletmanagerwidget.cpp
src/manager/kwalletmanagerwidget.cpp
+1
-1
src/manager/kwalletmanagerwidgetitem.cpp
src/manager/kwalletmanagerwidgetitem.cpp
+2
-2
src/manager/kwalletpopup.cpp
src/manager/kwalletpopup.cpp
+7
-7
src/manager/kwmapeditor.cpp
src/manager/kwmapeditor.cpp
+2
-2
src/manager/main.cpp
src/manager/main.cpp
+6
-6
src/manager/revokeauthbutton.cpp
src/manager/revokeauthbutton.cpp
+1
-1
No files found.
src/konfigurator/konfigurator.cpp
View file @
45e687ae
...
...
@@ -47,7 +47,7 @@ K_PLUGIN_FACTORY(KWalletFactory, registerPlugin<KWalletConfig>();)
KWalletConfig
::
KWalletConfig
(
QWidget
*
parent
,
const
QVariantList
&
args
)
:
KCModule
(
parent
,
args
),
_cfg
(
KSharedConfig
::
openConfig
(
Q
Latin1String
(
"kwalletrc"
),
KConfig
::
NoGlobals
))
_cfg
(
KSharedConfig
::
openConfig
(
Q
StringLiteral
(
"kwalletrc"
),
KConfig
::
NoGlobals
))
{
KAboutData
*
about
=
new
KAboutData
(
QStringLiteral
(
"kcmkwallet5"
),
i18n
(
"KDE Wallet Control Module"
),
...
...
@@ -87,7 +87,7 @@ KWalletConfig::KWalletConfig(QWidget *parent, const QVariantList &args)
_wcw
->
_accessList
->
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
updateWalletLists
();
if
(
QDBusConnection
::
sessionBus
().
interface
()
->
isServiceRegistered
(
Q
Latin1String
(
"org.kde.kwalletmanager"
)))
{
if
(
QDBusConnection
::
sessionBus
().
interface
()
->
isServiceRegistered
(
Q
StringLiteral
(
"org.kde.kwalletmanager"
)))
{
_wcw
->
_launch
->
hide
();
}
...
...
@@ -172,12 +172,12 @@ void KWalletConfig::newNetworkWallet()
void
KWalletConfig
::
launchManager
()
{
if
(
!
QDBusConnection
::
sessionBus
().
interface
()
->
isServiceRegistered
(
Q
Latin1String
(
"org.kde.kwalletmanager5"
)))
{
QProcess
::
startDetached
(
Q
Latin1String
(
"kwalletmanager5 --show"
));
if
(
!
QDBusConnection
::
sessionBus
().
interface
()
->
isServiceRegistered
(
Q
StringLiteral
(
"org.kde.kwalletmanager5"
)))
{
QProcess
::
startDetached
(
Q
StringLiteral
(
"kwalletmanager5 --show"
));
}
else
{
QDBusInterface
kwalletd
(
Q
Latin1String
(
"org.kde.kwalletmanager5"
),
QLatin1String
(
"/kwalletmanager5/MainWindow_1"
));
kwalletd
.
call
(
Q
Latin1String
(
"show"
));
kwalletd
.
call
(
Q
Latin1String
(
"raise"
));
QDBusInterface
kwalletd
(
Q
StringLiteral
(
"org.kde.kwalletmanager5"
),
QStringLiteral
(
"/kwalletmanager5/MainWindow_1"
));
kwalletd
.
call
(
Q
StringLiteral
(
"show"
));
kwalletd
.
call
(
Q
StringLiteral
(
"raise"
));
}
}
...
...
@@ -228,13 +228,13 @@ void KWalletConfig::load()
// perform cleanup in the kwalletrc file, by removing entries that correspond to non-existent
// (previously deleted, for example) wallets
QString
path
=
QStandardPaths
::
writableLocation
(
QStandardPaths
::
GenericDataLocation
);
path
.
append
(
QString
(
"/kwalletd/%1.kwl"
).
arg
(
walletName
));
path
.
append
(
QString
Literal
(
"/kwalletd/%1.kwl"
).
arg
(
walletName
));
if
(
!
QFile
::
exists
(
path
))
{
// if the wallet no longer exists, delete the entries from the configuration file and skip to next entry
KConfigGroup
cfgAllow
=
KSharedConfig
::
openConfig
(
"kwalletrc"
)
->
group
(
"Auto Allow"
);
KConfigGroup
cfgAllow
=
KSharedConfig
::
openConfig
(
QStringLiteral
(
"kwalletrc"
)
)
->
group
(
"Auto Allow"
);
cfgAllow
.
deleteEntry
(
walletName
);
KConfigGroup
cfgDeny
=
KSharedConfig
::
openConfig
(
"kwalletrc"
)
->
group
(
"Auto Deny"
);
KConfigGroup
cfgDeny
=
KSharedConfig
::
openConfig
(
QStringLiteral
(
"kwalletrc"
)
)
->
group
(
"Auto Deny"
);
cfgDeny
.
deleteEntry
(
walletName
);
continue
;
}
...
...
@@ -338,12 +338,12 @@ void KWalletConfig::save()
_cfg
->
sync
();
// this restarts kwalletd if necessary
QDBusInterface
kwalletd
(
Q
Latin1String
(
"org.kde.kwalletd5"
),
QLatin1String
(
"/modules/kwalletd"
),
QLatin1String
(
KWALLETMANAGERINTERFACE
));
QDBusInterface
kwalletd
(
Q
StringLiteral
(
"org.kde.kwalletd5"
),
QStringLiteral
(
"/modules/kwalletd"
),
QStringLiteral
(
KWALLETMANAGERINTERFACE
));
// if wallet was deactivated, then kwalletd will exit upon start so check
// the status before invoking reconfigure
if
(
kwalletd
.
isValid
())
{
// this will eventually make kwalletd exit upon deactivation
kwalletd
.
call
(
Q
Latin1String
(
"reconfigure"
));
kwalletd
.
call
(
Q
StringLiteral
(
"reconfigure"
));
}
emit
changed
(
false
);
...
...
src/manager/allyourbase.cpp
View file @
45e687ae
...
...
@@ -42,7 +42,7 @@
KWalletFolderItem
::
KWalletFolderItem
(
KWallet
::
Wallet
*
w
,
QTreeWidget
*
parent
,
const
QString
&
name
,
int
entries
)
:
QTreeWidgetItem
(
parent
,
KWalletFolderItemClass
),
_wallet
(
w
),
_name
(
name
),
_entries
(
entries
)
{
setText
(
0
,
QString
::
fromLatin1
(
"%1 (%2)"
).
arg
(
_name
).
arg
(
_entries
));
setText
(
0
,
QString
Literal
(
"%1 (%2)"
).
arg
(
_name
).
arg
(
_entries
));
setFlags
(
Qt
::
ItemIsSelectable
|
Qt
::
ItemIsDragEnabled
|
Qt
::
ItemIsDropEnabled
|
Qt
::
ItemIsEnabled
);
setIcon
(
0
,
getFolderIcon
(
KIconLoader
::
Small
));
}
...
...
@@ -55,7 +55,7 @@ QPixmap KWalletFolderItem::getFolderIcon(KIconLoader::Group group)
pix
=
QIcon
::
fromTheme
(
_name
.
toLower
()).
pixmap
(
IconSize
(
group
),
IconSize
(
group
));
if
(
pix
.
isNull
())
pix
=
QIcon
::
fromTheme
(
Q
Latin1String
(
"folder-red"
)).
pixmap
(
IconSize
(
group
),
IconSize
(
group
));
pix
=
QIcon
::
fromTheme
(
Q
StringLiteral
(
"folder-red"
)).
pixmap
(
IconSize
(
group
),
IconSize
(
group
));
return
pix
;
}
...
...
@@ -64,7 +64,7 @@ void KWalletFolderItem::refresh()
{
const
QString
saveFolder
=
_wallet
->
currentFolder
();
_wallet
->
setFolder
(
_name
);
setText
(
0
,
QString
::
fromLatin1
(
"%1 (%2)"
).
arg
(
_name
).
arg
(
_wallet
->
entryList
().
count
()));
setText
(
0
,
QString
Literal
(
"%1 (%2)"
).
arg
(
_name
).
arg
(
_wallet
->
entryList
().
count
()));
_wallet
->
setFolder
(
saveFolder
);
}
...
...
@@ -82,7 +82,7 @@ void KWalletFolderItem::refreshItemsCount()
}
}
}
setText
(
0
,
QString
::
fromLatin1
(
"%1 (%2)"
).
arg
(
_name
).
arg
(
visibleLeafCount
));
setText
(
0
,
QString
Literal
(
"%1 (%2)"
).
arg
(
_name
).
arg
(
visibleLeafCount
));
}
KWalletContainerItem
*
KWalletFolderItem
::
getContainer
(
KWallet
::
Wallet
::
EntryType
type
)
...
...
@@ -121,8 +121,8 @@ QTreeWidgetItem *KWalletFolderItem::getItem(const QString &key)
bool
KWalletFolderItem
::
acceptDrop
(
const
QMimeData
*
mime
)
const
{
return
mime
->
hasFormat
(
"application/x-kwallet-entry"
)
||
mime
->
hasFormat
(
"text/uri-list"
);
return
mime
->
hasFormat
(
QStringLiteral
(
"application/x-kwallet-entry"
)
)
||
mime
->
hasFormat
(
QStringLiteral
(
"text/uri-list"
)
);
}
QString
KWalletFolderItem
::
name
()
const
...
...
@@ -295,8 +295,8 @@ void KWalletItem::processDropEvent(QDropEvent *e)
el
=
dynamic_cast
<
KWalletEntryList
*>
(
e
->
source
()
->
parent
());
}
if
(
e
->
mimeData
()
->
hasFormat
(
"application/x-kwallet-folder"
)
||
e
->
mimeData
()
->
hasFormat
(
"text/uri-list"
))
{
if
(
e
->
mimeData
()
->
hasFormat
(
QStringLiteral
(
"application/x-kwallet-folder"
)
)
||
e
->
mimeData
()
->
hasFormat
(
QStringLiteral
(
"text/uri-list"
)
))
{
// FIXME: don't allow the drop if the wallet name is the same
KWallet
::
Wallet
*
_wallet
=
KWallet
::
Wallet
::
openWallet
(
text
(),
listWidget
()
->
topLevelWidget
()
->
winId
());
if
(
!
_wallet
)
{
...
...
@@ -308,8 +308,8 @@ void KWalletItem::processDropEvent(QDropEvent *e)
QByteArray
data
;
if
(
e
->
mimeData
()
->
hasFormat
(
"application/x-kwallet-folder"
))
{
data
=
e
->
mimeData
()
->
data
(
"application/x-kwallet-folder"
);
if
(
e
->
mimeData
()
->
hasFormat
(
QStringLiteral
(
"application/x-kwallet-folder"
)
))
{
data
=
e
->
mimeData
()
->
data
(
QStringLiteral
(
"application/x-kwallet-folder"
)
);
e
->
accept
();
}
else
{
// text/uri-list
const
QList
<
QUrl
>
urls
=
e
->
mimeData
()
->
urls
();
...
...
@@ -407,7 +407,7 @@ void KWalletEntryList::itemDropped(QDropEvent *e, QTreeWidgetItem *item)
}
}
if
(
e
->
mimeData
()
->
hasFormat
(
"application/x-kwallet-entry"
))
{
if
(
e
->
mimeData
()
->
hasFormat
(
QStringLiteral
(
"application/x-kwallet-entry"
)
))
{
//do nothing if we are in the same folder
if
(
sel
&&
sel
->
parent
()
->
parent
()
==
KWalletEntryList
::
getItemFolder
(
item
))
{
...
...
@@ -415,26 +415,26 @@ void KWalletEntryList::itemDropped(QDropEvent *e, QTreeWidgetItem *item)
return
;
}
isEntry
=
true
;
data
=
e
->
mimeData
()
->
data
(
"application/x-kwallet-entry"
);
data
=
e
->
mimeData
()
->
data
(
QStringLiteral
(
"application/x-kwallet-entry"
)
);
if
(
data
.
isEmpty
())
{
e
->
ignore
();
return
;
}
e
->
accept
();
}
else
if
(
e
->
mimeData
()
->
hasFormat
(
"application/x-kwallet-folder"
))
{
}
else
if
(
e
->
mimeData
()
->
hasFormat
(
QStringLiteral
(
"application/x-kwallet-folder"
)
))
{
//do nothing if we are in the same wallet
if
(
this
==
el
)
{
e
->
ignore
();
return
;
}
isEntry
=
false
;
data
=
e
->
mimeData
()
->
data
(
"application/x-kwallet-folder"
);
data
=
e
->
mimeData
()
->
data
(
QStringLiteral
(
"application/x-kwallet-folder"
)
);
if
(
data
.
isEmpty
())
{
e
->
ignore
();
return
;
}
e
->
accept
();
}
else
if
(
e
->
mimeData
()
->
hasFormat
(
"text/uri-list"
))
{
}
else
if
(
e
->
mimeData
()
->
hasFormat
(
QStringLiteral
(
"text/uri-list"
)
))
{
const
QList
<
QUrl
>
urls
=
e
->
mimeData
()
->
urls
();
if
(
urls
.
isEmpty
())
{
e
->
ignore
();
...
...
@@ -549,7 +549,7 @@ QMimeData *KWalletEntryList::itemMimeData(const QTreeWidgetItem *i) const
QByteArray
value
;
ei
->
_wallet
->
readEntry
(
i
->
text
(
0
),
value
);
ds
<<
value
;
sd
->
setData
(
"application/x-kwallet-entry"
,
a
);
sd
->
setData
(
QStringLiteral
(
"application/x-kwallet-entry"
)
,
a
);
}
else
if
(
i
->
type
()
==
KWalletFolderItemClass
)
{
const
KWalletFolderItem
*
fi
=
dynamic_cast
<
const
KWalletFolderItem
*>
(
i
);
if
(
!
fi
)
{
...
...
@@ -563,7 +563,7 @@ QMimeData *KWalletEntryList::itemMimeData(const QTreeWidgetItem *i) const
ds
<<
KWALLETFOLDERMAGIC
;
ds
<<
*
fi
;
sd
->
setData
(
"application/x-kwallet-folder"
,
a
);
sd
->
setData
(
QStringLiteral
(
"application/x-kwallet-folder"
)
,
a
);
}
return
sd
;
}
...
...
@@ -615,14 +615,14 @@ void KWalletEntryList::dragMoveEvent(QDragMoveEvent *e)
QTreeWidgetItem
*
i
=
itemAt
(
e
->
pos
());
e
->
ignore
();
if
(
i
)
{
if
(
e
->
mimeData
()
->
hasFormat
(
"application/x-kwallet-entry"
)
||
e
->
mimeData
()
->
hasFormat
(
"text/uri-list"
))
{
if
(
e
->
mimeData
()
->
hasFormat
(
QStringLiteral
(
"application/x-kwallet-entry"
)
)
||
e
->
mimeData
()
->
hasFormat
(
QStringLiteral
(
"text/uri-list"
)
))
{
e
->
accept
();
}
}
if
((
e
->
mimeData
()
->
hasFormat
(
"application/x-kwallet-folder"
)
&&
if
((
e
->
mimeData
()
->
hasFormat
(
QStringLiteral
(
"application/x-kwallet-folder"
)
)
&&
e
->
source
()
!=
viewport
())
||
e
->
mimeData
()
->
hasFormat
(
"text/uri-list"
))
{
e
->
mimeData
()
->
hasFormat
(
QStringLiteral
(
"text/uri-list"
)
))
{
e
->
accept
();
}
}
...
...
src/manager/authorizedappmodel.cpp
View file @
45e687ae
...
...
@@ -26,7 +26,7 @@
AuthorizedAppModel
::
AuthorizedAppModel
(
KWallet
::
Wallet
*
wallet
)
:
QStandardItemModel
(),
_cfg
(
KSharedConfig
::
openConfig
(
Q
Latin1String
(
"kwalletrc"
),
KConfig
::
NoGlobals
)),
_cfg
(
KSharedConfig
::
openConfig
(
Q
StringLiteral
(
"kwalletrc"
),
KConfig
::
NoGlobals
)),
_wallet
(
wallet
)
{
// TODO: handle "Auto Deny" applications
...
...
@@ -41,7 +41,7 @@ AuthorizedAppModel::AuthorizedAppModel(KWallet::Wallet *wallet):
int
row
=
0
;
Q_FOREACH
(
QString
appName
,
apps
)
{
setItem
(
row
,
0
,
new
QStandardItem
(
appName
));
setItem
(
row
,
1
,
new
QStandardItem
(
"dummy"
));
// this item will be hidden by the disconnect button, see below setIndexWidget call
setItem
(
row
,
1
,
new
QStandardItem
(
QStringLiteral
(
"dummy"
)
));
// this item will be hidden by the disconnect button, see below setIndexWidget call
_authorizedAppsIndexMap
.
insert
(
appName
,
QPersistentModelIndex
(
index
(
row
,
0
)));
row
++
;
}
...
...
src/manager/connectedappmodel.cpp
View file @
45e687ae
...
...
@@ -44,7 +44,7 @@ void ConnectedAppModel::refresh()
item
->
setEditable
(
false
);
setItem
(
row
,
0
,
item
);
// this item will be hidden by the disconnect button, see below setIndexWidget call
setItem
(
row
,
1
,
new
QStandardItem
(
"dummy"
));
setItem
(
row
,
1
,
new
QStandardItem
(
QStringLiteral
(
"dummy"
)
));
_connectedAppsIndexMap
.
insert
(
appName
,
QPersistentModelIndex
(
index
(
row
,
0
)));
row
++
;
}
...
...
src/manager/disconnectappbutton.cpp
View file @
45e687ae
...
...
@@ -25,7 +25,7 @@
DisconnectAppButton
::
DisconnectAppButton
(
const
QString
&
appName
,
KWallet
::
Wallet
*
wallet
)
:
_appName
(
appName
),
_wallet
(
wallet
)
{
setObjectName
(
QString
(
"Disconnect_%1"
).
arg
(
appName
));
setObjectName
(
QString
Literal
(
"Disconnect_%1"
).
arg
(
appName
));
setText
(
i18n
(
"Disconnect"
));
connect
(
this
,
&
DisconnectAppButton
::
clicked
,
this
,
&
DisconnectAppButton
::
onClicked
);
}
...
...
src/manager/kwalleteditor.cpp
View file @
45e687ae
...
...
@@ -86,8 +86,8 @@ KWalletEditor::KWalletEditor(QWidget *parent, const char *name)
_splitter
->
setStretchFactor
(
1
,
2
);
_contextMenu
=
new
QMenu
(
this
);
_undoChanges
->
setIcon
(
QIcon
::
fromTheme
(
Q
Latin1String
(
"edit-undo"
)));
_saveChanges
->
setIcon
(
QIcon
::
fromTheme
(
Q
Latin1String
(
"document-save"
)));
_undoChanges
->
setIcon
(
QIcon
::
fromTheme
(
Q
StringLiteral
(
"edit-undo"
)));
_saveChanges
->
setIcon
(
QIcon
::
fromTheme
(
Q
StringLiteral
(
"document-save"
)));
_hasUnsavedChanges
=
false
;
QVBoxLayout
*
box
=
new
QVBoxLayout
(
_entryListFrame
);
...
...
@@ -196,47 +196,47 @@ KActionCollection *KWalletEditor::actionCollection()
void
KWalletEditor
::
createActions
(
KActionCollection
*
actionCollection
)
{
_newFolderAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"create_folder"
));
_newFolderAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"create_folder"
));
_newFolderAction
->
setText
(
i18n
(
"&New Folder..."
));
_newFolderAction
->
setIcon
(
QIcon
::
fromTheme
(
Q
Latin1String
(
"folder-new"
)));
_newFolderAction
->
setIcon
(
QIcon
::
fromTheme
(
Q
StringLiteral
(
"folder-new"
)));
_deleteFolderAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"delete_folder"
));
_deleteFolderAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"delete_folder"
));
_deleteFolderAction
->
setText
(
i18n
(
"&Delete Folder"
));
_mergeAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"wallet_merge"
));
_mergeAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"wallet_merge"
));
_mergeAction
->
setText
(
i18n
(
"&Import a wallet..."
));
_importAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"wallet_import"
));
_importAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"wallet_import"
));
_importAction
->
setText
(
i18n
(
"&Import XML..."
));
_exportAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"wallet_export"
));
_exportAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"wallet_export"
));
_exportAction
->
setText
(
i18n
(
"&Export as XML..."
));
_copyPassAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"copy_action"
));
_copyPassAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"copy_action"
));
_copyPassAction
->
setText
(
i18n
(
"&Copy"
));
actionCollection
->
setDefaultShortcut
(
_copyPassAction
,
Qt
::
Key_C
+
Qt
::
CTRL
);
_copyPassAction
->
setEnabled
(
false
);
_newEntryAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"new_entry"
));
_newEntryAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"new_entry"
));
_newEntryAction
->
setText
(
i18n
(
"&New..."
));
actionCollection
->
setDefaultShortcut
(
_newEntryAction
,
Qt
::
Key_Insert
);
_newEntryAction
->
setEnabled
(
false
);
_renameEntryAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"rename_entry"
));
_renameEntryAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"rename_entry"
));
_renameEntryAction
->
setText
(
i18n
(
"&Rename"
));
actionCollection
->
setDefaultShortcut
(
_renameEntryAction
,
Qt
::
Key_F2
);
_renameEntryAction
->
setEnabled
(
false
);
_deleteEntryAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"delete_entry"
));
_deleteEntryAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"delete_entry"
));
_deleteEntryAction
->
setText
(
i18n
(
"&Delete"
));
actionCollection
->
setDefaultShortcut
(
_deleteEntryAction
,
Qt
::
Key_Delete
);
_deleteEntryAction
->
setEnabled
(
false
);
_alwaysShowContentsAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"always_show_contents"
));
_alwaysShowContentsAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"always_show_contents"
));
_alwaysShowContentsAction
->
setText
(
i18n
(
"Always show contents"
));
_alwaysShowContentsAction
->
setCheckable
(
true
);
_alwaysHideContentsAction
=
actionCollection
->
addAction
(
Q
Latin1String
(
"always_hide_contents"
));
_alwaysHideContentsAction
=
actionCollection
->
addAction
(
Q
StringLiteral
(
"always_hide_contents"
));
_alwaysHideContentsAction
->
setText
(
i18n
(
"Always hide contents"
));
_alwaysHideContentsAction
->
setCheckable
(
true
);
}
...
...
@@ -623,7 +623,7 @@ void KWalletEditor::entrySelectionChanged(QTreeWidgetItem *item)
if
(
fi
)
{
_currentFolder
=
fi
->
name
();
_entryTitle
->
setText
(
QString
::
fromLatin1
(
"<font size=
\"
+1
\"
>%1</font>"
).
arg
(
fi
->
text
(
0
)));
_entryTitle
->
setText
(
QString
Literal
(
"<font size=
\"
+1
\"
>%1</font>"
).
arg
(
fi
->
text
(
0
)));
_iconTitle
->
setPixmap
(
fi
->
getFolderIcon
(
KIconLoader
::
Toolbar
));
}
...
...
@@ -716,7 +716,7 @@ void KWalletEditor::updateEntries(const QString &folder)
}
fi
->
refresh
();
if
(
fi
->
name
()
==
_currentFolder
)
{
_entryTitle
->
setText
(
QString
::
fromLatin1
(
"<font size=
\"
+1
\"
>%1</font>"
).
arg
(
fi
->
text
(
0
)));
_entryTitle
->
setText
(
QString
Literal
(
"<font size=
\"
+1
\"
>%1</font>"
).
arg
(
fi
->
text
(
0
)));
}
if
(
!
_entryList
->
currentItem
())
{
_entryName
->
clear
();
...
...
@@ -823,7 +823,7 @@ void KWalletEditor::newEntry()
_entryList
->
scrollToItem
(
ni
);
fi
->
refresh
();
_entryTitle
->
setText
(
QString
::
fromLatin1
(
"<font size=
\"
+1
\"
>%1</font>"
).
arg
(
fi
->
text
(
0
)));
_entryTitle
->
setText
(
QString
Literal
(
"<font size=
\"
+1
\"
>%1</font>"
).
arg
(
fi
->
text
(
0
)));
}
}
...
...
@@ -889,7 +889,7 @@ void KWalletEditor::deleteEntry()
delete
item
;
entrySelectionChanged
(
_entryList
->
currentItem
());
fi
->
refresh
();
_entryTitle
->
setText
(
QString
::
fromLatin1
(
"<font size=
\"
+1
\"
>%1</font>"
).
arg
(
fi
->
text
(
0
)));
_entryTitle
->
setText
(
QString
Literal
(
"<font size=
\"
+1
\"
>%1</font>"
).
arg
(
fi
->
text
(
0
)));
}
}
}
...
...
@@ -937,7 +937,7 @@ enum MergePlan { Prompt = 0, Always = 1, Never = 2, Yes = 3, No = 4 };
void
KWalletEditor
::
importWallet
()
{
QUrl
url
=
QFileDialog
::
getOpenFileUrl
(
this
,
QString
(),
QUrl
(),
Q
Latin1String
(
"*.kwl"
));
QUrl
url
=
QFileDialog
::
getOpenFileUrl
(
this
,
QString
(),
QUrl
(),
Q
StringLiteral
(
"*.kwl"
));
if
(
url
.
isEmpty
())
{
return
;
...
...
@@ -976,7 +976,7 @@ void KWalletEditor::importWallet()
QMap
<
QString
,
QMap
<
QString
,
QString
>
>
map
;
QSet
<
QString
>
mergedkeys
;
// prevents re-merging already merged entries.
int
rc
;
rc
=
w
->
readMapList
(
Q
Latin1String
(
"*"
),
map
);
rc
=
w
->
readMapList
(
Q
StringLiteral
(
"*"
),
map
);
if
(
rc
==
0
)
{
QMap
<
QString
,
QMap
<
QString
,
QString
>
>::
ConstIterator
me
;
for
(
me
=
map
.
constBegin
();
me
!=
map
.
constEnd
();
++
me
)
{
...
...
@@ -1007,7 +1007,7 @@ void KWalletEditor::importWallet()
}
QMap
<
QString
,
QString
>
pwd
;
rc
=
w
->
readPasswordList
(
Q
Latin1String
(
"*"
),
pwd
);
rc
=
w
->
readPasswordList
(
Q
StringLiteral
(
"*"
),
pwd
);
if
(
rc
==
0
)
{
QMap
<
QString
,
QString
>::
ConstIterator
pe
;
for
(
pe
=
pwd
.
constBegin
();
pe
!=
pwd
.
constEnd
();
++
pe
)
{
...
...
@@ -1038,7 +1038,7 @@ void KWalletEditor::importWallet()
}
QMap
<
QString
,
QByteArray
>
ent
;
rc
=
w
->
readEntryList
(
Q
Latin1String
(
"*"
),
ent
);
rc
=
w
->
readEntryList
(
Q
StringLiteral
(
"*"
),
ent
);
if
(
rc
==
0
)
{
QMap
<
QString
,
QByteArray
>::
ConstIterator
ee
;
for
(
ee
=
ent
.
constBegin
();
ee
!=
ent
.
constEnd
();
++
ee
)
{
...
...
@@ -1081,7 +1081,7 @@ void KWalletEditor::importWallet()
void
KWalletEditor
::
importXML
()
{
QUrl
url
=
QFileDialog
::
getOpenFileUrl
(
this
,
QString
(),
QUrl
(),
Q
Latin1String
(
"*.xml"
));
QUrl
url
=
QFileDialog
::
getOpenFileUrl
(
this
,
QString
(),
QUrl
(),
Q
StringLiteral
(
"*.xml"
));
if
(
url
.
isEmpty
())
{
return
;
...
...
@@ -1115,7 +1115,7 @@ void KWalletEditor::importXML()
continue
;
}
QString
fname
=
e
.
attribute
(
Q
Latin1String
(
"name"
));
QString
fname
=
e
.
attribute
(
Q
StringLiteral
(
"name"
));
if
(
fname
.
isEmpty
())
{
n
=
n
.
nextSibling
();
continue
;
...
...
@@ -1128,7 +1128,7 @@ void KWalletEditor::importXML()
while
(
!
enode
.
isNull
())
{
e
=
enode
.
toElement
();
QString
type
=
e
.
tagName
().
toLower
();
QString
ename
=
e
.
attribute
(
Q
Latin1String
(
"name"
));
QString
ename
=
e
.
attribute
(
Q
StringLiteral
(
"name"
));
bool
hasEntry
=
_w
->
hasEntry
(
ename
);
if
(
hasEntry
&&
mp
==
Prompt
)
{
KBetterThanKDialogBase
*
bd
;
...
...
@@ -1162,7 +1162,7 @@ void KWalletEditor::importXML()
while
(
!
mapNode
.
isNull
())
{
QDomElement
mape
=
mapNode
.
toElement
();
if
(
mape
.
tagName
().
toLower
()
==
QLatin1String
(
"mapentry"
))
{
map
[
mape
.
attribute
(
Q
Latin1String
(
"name"
))]
=
mape
.
text
();
map
[
mape
.
attribute
(
Q
StringLiteral
(
"name"
))]
=
mape
.
text
();
}
mapNode
=
mapNode
.
nextSibling
();
}
...
...
@@ -1186,11 +1186,11 @@ void KWalletEditor::exportXML()
xml
.
writeStartDocument
();
const
QStringList
fl
=
_w
->
folderList
();
xml
.
writeStartElement
(
Q
Latin1String
(
"wallet"
));
xml
.
writeAttribute
(
Q
Latin1String
(
"name"
),
_walletName
);
xml
.
writeStartElement
(
Q
StringLiteral
(
"wallet"
));
xml
.
writeAttribute
(
Q
StringLiteral
(
"name"
),
_walletName
);
for
(
QStringList
::
const_iterator
i
=
fl
.
constBegin
();
i
!=
fl
.
constEnd
();
++
i
)
{
xml
.
writeStartElement
(
Q
Latin1String
(
"folder"
));
xml
.
writeAttribute
(
Q
Latin1String
(
"name"
),
*
i
);
xml
.
writeStartElement
(
Q
StringLiteral
(
"folder"
));
xml
.
writeAttribute
(
Q
StringLiteral
(
"name"
),
*
i
);
_w
->
setFolder
(
*
i
);
QStringList
entries
=
_w
->
entryList
();
for
(
QStringList
::
const_iterator
j
=
entries
.
constBegin
();
j
!=
entries
.
constEnd
();
++
j
)
{
...
...
@@ -1198,8 +1198,8 @@ void KWalletEditor::exportXML()
case
KWallet
::
Wallet
::
Password
:
{
QString
pass
;
if
(
_w
->
readPassword
(
*
j
,
pass
)
==
0
)
{
xml
.
writeStartElement
(
Q
Latin1String
(
"password"
));
xml
.
writeAttribute
(
Q
Latin1String
(
"name"
),
*
j
);
xml
.
writeStartElement
(
Q
StringLiteral
(
"password"
));
xml
.
writeAttribute
(
Q
StringLiteral
(
"name"
),
*
j
);
xml
.
writeCharacters
(
pass
);
xml
.
writeEndElement
();
}
...
...
@@ -1208,8 +1208,8 @@ void KWalletEditor::exportXML()
case
KWallet
::
Wallet
::
Stream
:
{
QByteArray
ba
;
if
(
_w
->
readEntry
(
*
j
,
ba
)
==
0
)
{
xml
.
writeStartElement
(
Q
Latin1String
(
"stream"
));
xml
.
writeAttribute
(
Q
Latin1String
(
"name"
),
*
j
);
xml
.
writeStartElement
(
Q
StringLiteral
(
"stream"
));
xml
.
writeAttribute
(
Q
StringLiteral
(
"name"
),
*
j
);
xml
.
writeCharacters
(
QLatin1String
(
KCodecs
::
base64Encode
(
ba
)));
xml
.
writeEndElement
();
}
...
...
@@ -1218,11 +1218,11 @@ void KWalletEditor::exportXML()
case
KWallet
::
Wallet
::
Map
:
{
QMap
<
QString
,
QString
>
map
;
if
(
_w
->
readMap
(
*
j
,
map
)
==
0
)
{
xml
.
writeStartElement
(
Q
Latin1String
(
"map"
));
xml
.
writeAttribute
(
Q
Latin1String
(
"name"
),
*
j
);
xml
.
writeStartElement
(
Q
StringLiteral
(
"map"
));
xml
.
writeAttribute
(
Q
StringLiteral
(
"name"
),
*
j
);
for
(
QMap
<
QString
,
QString
>::
ConstIterator
k
=
map
.
constBegin
();
k
!=
map
.
constEnd
();
++
k
)
{
xml
.
writeStartElement
(
Q
Latin1String
(
"mapentry"
));
xml
.
writeAttribute
(
Q
Latin1String
(
"name"
),
k
.
key
());
xml
.
writeStartElement
(
Q
StringLiteral
(
"mapentry"
));
xml
.
writeAttribute
(
Q
StringLiteral
(
"name"
),
k
.
key
());
xml
.
writeCharacters
(
k
.
value
());
xml
.
writeEndElement
();
}
...
...
@@ -1242,7 +1242,7 @@ void KWalletEditor::exportXML()
xml
.
writeEndDocument
();
tf
.
flush
();
QUrl
url
=
QFileDialog
::
getSaveFileUrl
(
this
,
QString
(),
QUrl
(),
Q
Latin1String
(
"*.xml"
));
QUrl
url
=
QFileDialog
::
getSaveFileUrl
(
this
,
QString
(),
QUrl
(),
Q
StringLiteral
(
"*.xml"
));
if
(
url
.
isEmpty
())
{
return
;
...
...
src/manager/kwalletmanager.cpp
View file @
45e687ae
...
...
@@ -62,7 +62,7 @@ KWalletManager::KWalletManager(QWidget *parent, const char *name, Qt::WindowFlag
}
void
KWalletManager
::
beginConfiguration
()
{
KConfig
cfg
(
Q
Latin1String
(
"kwalletrc"
));
// not sure why this setting isn't in kwalletmanagerrc...
KConfig
cfg
(
Q
StringLiteral
(
"kwalletrc"
));
// not sure why this setting isn't in kwalletmanagerrc...
KConfigGroup
walletConfigGroup
(
&
cfg
,
"Wallet"
);
if
(
walletConfigGroup
.
readEntry
(
"Enabled"
,
true
)){
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
configUI
()));
...
...
@@ -79,23 +79,23 @@ void KWalletManager::beginConfiguration() {
}
void
KWalletManager
::
configUI
()
{
QDBusConnection
::
sessionBus
().
registerObject
(
Q
Latin1String
(
"/KWalletManager"
),
this
,
QDBusConnection
::
ExportScriptableSlots
);
KConfig
cfg
(
Q
Latin1String
(
"kwalletrc"
));
// not sure why this setting isn't in kwalletmanagerrc...
QDBusConnection
::
sessionBus
().
registerObject
(
Q
StringLiteral
(
"/KWalletManager"
),
this
,
QDBusConnection
::
ExportScriptableSlots
);
KConfig
cfg
(
Q
StringLiteral
(
"kwalletrc"
));
// not sure why this setting isn't in kwalletmanagerrc...
KConfigGroup
walletConfigGroup
(
&
cfg
,
"Wallet"
);
if
(
walletConfigGroup
.
readEntry
(
"Launch Manager"
,
false
))
{
_tray
=
new
KStatusNotifierItem
(
this
);
_tray
->
setObjectName
(
Q
Latin1String
(
"kwalletmanager tray"
));
_tray
->
setObjectName
(
Q
StringLiteral
(
"kwalletmanager tray"
));
_tray
->
setCategory
(
KStatusNotifierItem
::
SystemServices
);
_tray
->
setStatus
(
KStatusNotifierItem
::
Passive
);
_tray
->
setIconByName
(
Q
Latin1String
(
"wallet-closed"
));
_tray
->
setToolTip
(
Q
Latin1String
(
"wallet-closed"
),
i18n
(
"Wallet"
),
i18n
(
"No wallets open."
));
_tray
->
setIconByName
(
Q
StringLiteral
(
"wallet-closed"
));
_tray
->
setToolTip
(
Q
StringLiteral
(
"wallet-closed"
),
i18n
(
"Wallet"
),
i18n
(
"No wallets open."
));
//connect(_tray, SIGNAL(quitSelected()), SLOT(shuttingDown()));
const
QStringList
wl
=
KWallet
::
Wallet
::
walletList
();
bool
isOpen
=
false
;
for
(
QStringList
::
ConstIterator
it
=
wl
.
begin
();
it
!=
wl
.
end
();
++
it
)
{
if
(
KWallet
::
Wallet
::
isOpen
(
*
it
))
{
_tray
->
setIconByName
(
Q
Latin1String
(
"wallet-open"
));
_tray
->
setToolTip
(
Q
Latin1String
(
"wallet-open"
),
i18n
(
"Wallet"
),
i18n
(
"A wallet is open."
));
_tray
->
setIconByName
(
Q
StringLiteral
(
"wallet-open"
));
_tray
->
setToolTip
(
Q
StringLiteral
(
"wallet-open"
),
i18n
(
"Wallet"
),
i18n
(
"A wallet is open."
));
isOpen
=
true
;
break
;
}
...
...
@@ -114,11 +114,11 @@ void KWalletManager::configUI() {
updateWalletDisplay
();
setCentralWidget
(
_managerWidget
);
setAutoSaveSettings
(
Q
Latin1String
(
"MainWindow"
),
true
);
setAutoSaveSettings
(
Q
StringLiteral
(
"MainWindow"
),
true
);
QFontMetrics
fm
=
fontMetrics
();
_managerWidget
->
setMinimumSize
(
16
*
fm
.
height
(),
18
*
fm
.
height
());
m_kwalletdModule
=
new
org
::
kde
::
KWallet
(
Q
Latin1String
(
"org.kde.kwalletd5"
),
QLatin1String
(
"/modules/kwalletd5"
),
QDBusConnection
::
sessionBus
());
m_kwalletdModule
=
new
org
::
kde
::
KWallet
(
Q
StringLiteral
(
"org.kde.kwalletd5"
),
QStringLiteral
(
"/modules/kwalletd5"
),
QDBusConnection
::
sessionBus
());
connect
(
QDBusConnection
::
sessionBus
().
interface
(),
SIGNAL
(
serviceOwnerChanged
(
QString
,
QString
,
QString
)),
this
,
SLOT
(
possiblyRescan
(
QString
,
QString
,
QString
)));
connect
(
m_kwalletdModule
,
&
OrgKdeKWalletInterface
::
allWalletsClosed
,
this
,
&
KWalletManager
::
allWalletsClosed
);
...
...
@@ -133,39 +133,39 @@ void KWalletManager::configUI() {
// wallet closes before we are done opening. We will then stay
// open. Must check that a wallet is still open here.
QAction
*
action
=
actionCollection
()
->
addAction
(
Q
Latin1String
(
"wallet_create"
));
QAction
*
action
=
actionCollection
()
->
addAction
(
Q
StringLiteral
(
"wallet_create"
));
action
->
setText
(
i18n
(
"&New Wallet..."
));
action
->
setIcon
(
QIcon
::
fromTheme
(
Q
Latin1String
(
"kwalletmanager"
)));
action
->
setIcon
(
QIcon
::
fromTheme
(
Q
StringLiteral
(
"kwalletmanager"
)));
connect
(
action
,
SIGNAL
(
triggered
()),
SLOT
(
createWallet
()));
action
=
actionCollection
()
->
addAction
(
Q
Latin1String
(
"wallet_open"
));
action
=
actionCollection
()
->
addAction
(
Q
StringLiteral
(
"wallet_open"
));
action
->
setText
(
i18n
(
"Open Wallet..."
));
connect
(
action
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
openWallet
()));
action
=
actionCollection
()
->
addAction
(
Q
Latin1String
(
"wallet_delete"
));
action
=
actionCollection
()
->
addAction
(
Q
StringLiteral
(
"wallet_delete"
));
action
->
setText
(
i18n
(
"&Delete Wallet..."
));
action
->
setIcon
(
QIcon
::
fromTheme
(
Q
Latin1String
(
"trash-empty"
)));
action
->
setIcon
(
QIcon
::
fromTheme
(
Q
StringLiteral
(
"trash-empty"
)));
connect
(
action
,
&
QAction
::
triggered
,
this
,
&
KWalletManager
::
deleteWallet
);
_walletsExportAction
=
actionCollection
()
->
addAction
(
"wallet_export_encrypted"
);
_walletsExportAction
=
actionCollection
()
->
addAction
(
QStringLiteral
(
"wallet_export_encrypted"
)
);
_walletsExportAction
->
setText
(
i18n
(
"Export as encrypted"
));
_walletsExportAction
->
setIcon
(
QIcon
::
fromTheme
(
"document-export"
));
_walletsExportAction
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"document-export"
)
));
connect
(
_walletsExportAction
,
&
QAction
::
triggered
,
this
,
&
KWalletManager
::
exportWallets
);
action
=
actionCollection
()
->
addAction
(
"wallet_import_encrypted"
);
action
=
actionCollection
()
->
addAction
(
QStringLiteral
(
"wallet_import_encrypted"
)
);
action
->
setText
(
i18n
(
"&Import encrypted"
));
action
->
setIcon
(
QIcon
::
fromTheme
(
"document-import"
));
action
->
setIcon
(
QIcon
::
fromTheme
(
QStringLiteral
(
"document-import"
)
));
connect
(
action
,
&
QAction
::
triggered
,
this
,
&
KWalletManager
::
importWallets
);
QAction
*
act
=
actionCollection
()
->
addAction
(
Q
Latin1String
(
"wallet_settings"
));
QAction
*
act
=
actionCollection
()
->
addAction
(
Q
StringLiteral
(
"wallet_settings"
));
act
->
setText
(
i18n
(
"Configure &Wallet..."
));
act
->
setIcon
(
QIcon
::
fromTheme
(
Q
Latin1String
(
"configure"
)));
act
->
setIcon
(
QIcon
::
fromTheme
(
Q
StringLiteral
(
"configure"
)));
connect
(
act
,
&
QAction
::
triggered
,
this
,
&
KWalletManager
::
setupWallet
);
if
(
_tray
)
{
_tray
->
contextMenu
()
->
addAction
(
act
);
}
act
=
actionCollection
()
->
addAction
(
Q
Latin1String
(
"close_all_wallets"
));
act
=
actionCollection
()
->
addAction
(
Q
StringLiteral
(
"close_all_wallets"
));
act
->
setText
(
i18n
(
"Close &All Wallets"
));
connect
(
act
,
&
QAction
::
triggered
,
this
,
&
KWalletManager
::
closeAllWallets
);
if
(
_tray
)
{
...
...
@@ -175,7 +175,7 @@ void KWalletManager::configUI() {
KStandardAction
::
keyBindings
(
guiFactory
(),
SLOT
(
configureShortcuts
()),
actionCollection
());
setupGUI
(
Keys
|
Save
|
Create
,
Q
Latin1String
(
"kwalletmanager.rc"
));
setupGUI
(
Keys
|
Save
|
Create
,
Q
StringLiteral
(
"kwalletmanager.rc"
));
setStandardToolBarMenuEnabled
(
false
);
if
(
_tray
)
{
...
...
@@ -185,7 +185,7 @@ void KWalletManager::configUI() {
}
_walletsExportAction
->
setDisabled
(
KWallet
::
Wallet
::
walletList
().
isEmpty
());
qApp
->
setObjectName
(
Q
Latin1String
(
"kwallet"
));
// hack to fix docs
qApp
->
setObjectName
(
Q
StringLiteral
(
"kwallet"
));
// hack to fix docs
}
KWalletManager
::~
KWalletManager
()
...
...
@@ -220,12 +220,12 @@ bool KWalletManager::queryClose()
void
KWalletManager
::
aWalletWasOpened
()
{
if
(
_tray
)
{
_tray
->
setIconByName
(
Q
Latin1String
(
"wallet-open"
));
_tray
->
setToolTip
(
Q
Latin1String
(
"wallet-open"
),
i18n
(
"Wallet"
),
i18n
(
"A wallet is open."
));