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
Rijul Gulati
Plasma applet for NetworkManager
Commits
69e1c72d
Commit
69e1c72d
authored
Apr 09, 2014
by
Lukáš Tinkl
Browse files
port away from KGlobal
parent
8f936ab9
Changes
4
Hide whitespace changes
Inline
Side-by-side
editor/connectioneditor.cpp
View file @
69e1c72d
...
...
@@ -30,10 +30,12 @@
#include "vpnuiplugin.h"
#include <networkmodelitem.h>
#include <QUrl>
#include <QStandardPaths>
#include <KActionCollection>
#include <KLocale>
#include <KGlobal>
#include <KGlobalSettings>
#include <KIcon>
#include <KLocalizedString>
#include <KMessageBox>
...
...
@@ -42,15 +44,12 @@
#include <KStandardAction>
#include <KAction>
#include <KXMLGUIFactory>
#include <KMenu>
#include <KAcceleratorManager>
#include <KConfig>
#include <KConfigGroup>
#include <KWallet/Wallet>
#include <KStandardDirs>
#include <KFileDialog>
#include <KShell>
#include <QUrl>
#include <KFilterProxySearchLine>
#include <NetworkManagerQt/Settings>
...
...
@@ -409,7 +408,7 @@ void ConnectionEditor::slotItemDoubleClicked(const QModelIndex &index)
void
ConnectionEditor
::
importSecretsFromPlainTextFiles
()
{
const
QString
secretsDirectory
=
K
Standard
Dir
s
::
locate
Local
(
"data"
,
"networkmanagement/secrets/"
);
const
QString
secretsDirectory
=
Q
Standard
Path
s
::
locate
(
QStandardPaths
::
DataLocation
,
"networkmanagement/secrets/"
,
QStandardPaths
::
LocateDirectory
);
QDir
dir
(
secretsDirectory
);
if
(
dir
.
exists
()
&&
!
dir
.
entryList
(
QDir
::
Files
).
isEmpty
())
{
QMap
<
QString
,
QMap
<
QString
,
QString
>
>
resultingMap
;
...
...
@@ -558,7 +557,7 @@ void ConnectionEditor::exportVpn()
return
;
}
const
QUrl
url
=
QUrl
::
fromLocalFile
(
KGlobalSetting
s
::
d
ocument
Path
(
)
+
QDir
::
separator
()
+
vpnPlugin
->
suggestedFileName
(
connSettings
));
const
QUrl
url
=
QUrl
::
fromLocalFile
(
QStandardPaths
::
writableLocation
(
QStandardPath
s
::
D
ocument
sLocation
)
+
QDir
::
separator
()
+
vpnPlugin
->
suggestedFileName
(
connSettings
));
const
QString
filename
=
KFileDialog
::
getSaveFileName
(
url
,
vpnPlugin
->
supportedFileExtensions
(),
this
,
i18n
(
"Export VPN Connection"
));
if
(
!
filename
.
isEmpty
())
{
if
(
!
vpnPlugin
->
exportConnectionSettings
(
connSettings
,
filename
))
{
...
...
libs/declarative/trafficmonitor.cpp
View file @
69e1c72d
...
...
@@ -27,6 +27,7 @@
#include <QLabel>
#include <QGraphicsLinearLayout>
#include <KLocale>
#include <KGlobalSettings>
#include <NetworkManagerQt/Manager>
...
...
@@ -220,9 +221,9 @@ void TrafficMonitor::updateTraffic()
_r
=
m_rx
.
toDouble
();
_t
=
m_tx
.
toDouble
();
r
=
K
Glob
al
::
lo
c
al
e
()
->
formatByteSize
(
_r
*
1024
);
r
=
K
Loc
al
e
::
g
lo
b
al
()
->
formatByteSize
(
_r
*
1024
);
r
.
append
(
"/s"
);
t
=
K
Glob
al
::
lo
c
al
e
()
->
formatByteSize
(
_t
*
1024
);
t
=
K
Loc
al
e
::
g
lo
b
al
()
->
formatByteSize
(
_t
*
1024
);
t
.
append
(
"/s"
);
}
...
...
@@ -240,10 +241,10 @@ void TrafficMonitor::updateTraffic()
temp
=
QString
(
"<qt><table align=
\"
left
\"
border=
\"
0
\"
><tr>"
);
temp
+=
QString
(
"<td width=
\"
20pt
\"
bgcolor=
\"
%1
\"
> "
).
arg
(
m_rxColor
.
name
());
temp
+=
QString
(
"</td><td width=
\"
50%
\"
>"
);
temp
+=
QString
(
format
).
arg
(
i18n
(
"Received"
),
K
Glob
al
::
lo
c
al
e
()
->
formatByteSize
(
m_rxTotal
*
1000
,
2
));
temp
+=
QString
(
format
).
arg
(
i18n
(
"Received"
),
K
Loc
al
e
::
g
lo
b
al
()
->
formatByteSize
(
m_rxTotal
*
1000
,
2
));
temp
+=
QString
(
" </td></tr><tr><td width=
\"
20pt
\"
bgcolor=
\"
%1
\"
> "
).
arg
(
m_txColor
.
name
());
temp
+=
QString
(
"</td><td width=
\"
50%
\"
>"
);
temp
+=
QString
(
format
).
arg
(
i18n
(
"Transmitted"
),
K
Glob
al
::
lo
c
al
e
()
->
formatByteSize
(
m_txTotal
*
1000
,
2
));
temp
+=
QString
(
format
).
arg
(
i18n
(
"Transmitted"
),
K
Loc
al
e
::
g
lo
b
al
()
->
formatByteSize
(
m_txTotal
*
1000
,
2
));
temp
+=
QString
(
"</td></tr></table></qt>"
);
m_traffic
->
setText
(
temp
);
}
libs/editor/mobileproviders.cpp
View file @
69e1c72d
...
...
@@ -22,10 +22,9 @@
#include <QFile>
#include <QTextStream>
#include <QDebug>
#include <KLocale>
#include <KGlobal>
const
QString
MobileProviders
::
ProvidersFile
=
"/usr/share/mobile-broadband-provider-info/serviceproviders.xml"
;
...
...
@@ -35,10 +34,10 @@ bool localeAwareCompare(const QString & one, const QString & two) {
MobileProviders
::
MobileProviders
()
{
const
QStringList
allCountries
=
K
Glob
al
::
lo
c
al
e
()
->
allCountriesList
();
const
QStringList
allCountries
=
K
Loc
al
e
::
g
lo
b
al
()
->
allCountriesList
();
foreach
(
const
QString
&
cc
,
allCountries
)
{
//qDebug() << "Inserting" << cc.toUpper() << K
Glob
al::lo
c
al
e
()->countryCodeToName(cc);
mCountries
.
insert
(
cc
.
toUpper
(),
K
Glob
al
::
lo
c
al
e
()
->
countryCodeToName
(
cc
));
//qDebug() << "Inserting" << cc.toUpper() << K
Loc
al
e
::
g
lo
b
al()->countryCodeToName(cc);
mCountries
.
insert
(
cc
.
toUpper
(),
K
Loc
al
e
::
g
lo
b
al
()
->
countryCodeToName
(
cc
));
}
mError
=
Success
;
...
...
@@ -86,7 +85,7 @@ QStringList MobileProviders::getCountryList() const
QString
MobileProviders
::
countryFromLocale
()
const
{
return
K
Glob
al
::
lo
c
al
e
()
->
country
().
toUpper
();
return
K
Loc
al
e
::
g
lo
b
al
()
->
country
().
toUpper
();
}
QStringList
MobileProviders
::
getProvidersList
(
QString
country
,
NetworkManager
::
ConnectionSettings
::
ConnectionType
type
)
...
...
@@ -304,7 +303,7 @@ QVariantMap MobileProviders::getCdmaInfo(const QString & provider)
QString
MobileProviders
::
getNameByLocale
(
const
QMap
<
QString
,
QString
>
&
localizedNames
)
const
{
QString
name
;
const
QStringList
locales
=
K
Glob
al
::
lo
c
al
e
()
->
languageList
();
const
QStringList
locales
=
K
Loc
al
e
::
g
lo
b
al
()
->
languageList
();
foreach
(
const
QString
&
locale
,
locales
)
{
QString
language
,
country
,
modifier
,
charset
;
KLocale
::
splitLocale
(
locale
,
language
,
country
,
modifier
,
charset
);
...
...
libs/models/networkmodelitem.cpp
View file @
69e1c72d
...
...
@@ -34,7 +34,6 @@
#include <NetworkManagerQt/WirelessDevice>
#include <NetworkManagerQt/WirelessSetting>
#include <KGlobal>
#include <KLocale>
#include <KLocalizedString>
...
...
@@ -151,7 +150,7 @@ void NetworkModelItem::setDeviceState(const NetworkManager::Device::State state)
QString
NetworkModelItem
::
download
()
const
{
double
download
=
m_download
.
toDouble
();
return
K
Glob
al
::
lo
c
al
e
()
->
formatByteSize
(
download
*
1024
)
+
"/s"
;
return
K
Loc
al
e
::
g
lo
b
al
()
->
formatByteSize
(
download
*
1024
)
+
"/s"
;
}
bool
NetworkModelItem
::
duplicate
()
const
...
...
@@ -373,7 +372,7 @@ QString NetworkModelItem::uni() const
QString
NetworkModelItem
::
upload
()
const
{
double
upload
=
m_upload
.
toDouble
();
return
K
Glob
al
::
lo
c
al
e
()
->
formatByteSize
(
upload
*
1024
)
+
"/s"
;
return
K
Loc
al
e
::
g
lo
b
al
()
->
formatByteSize
(
upload
*
1024
)
+
"/s"
;
}
QString
NetworkModelItem
::
uuid
()
const
...
...
Write
Preview
Markdown
is supported
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