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
Unmaintained
KDE Workspace
Commits
c16d79d8
Commit
c16d79d8
authored
Jul 03, 2011
by
Craig Drummond
Browse files
Download fonts via GetHotNewStuff
BUG:235099
parent
9d0581ad
Changes
13
Hide whitespace changes
Inline
Side-by-side
kcontrol/kfontinst/dbus/Folder.cpp
View file @
c16d79d8
...
...
@@ -328,11 +328,11 @@ void Folder::add(const Family &family)
}
}
void
Folder
::
configure
()
void
Folder
::
configure
(
bool
force
)
{
KFI_DBUG
<<
"EMPTY MODIFIED "
<<
itsModifiedDirs
.
isEmpty
();
if
(
!
itsModifiedDirs
.
isEmpty
())
if
(
force
||
!
itsModifiedDirs
.
isEmpty
())
{
saveDisabled
();
...
...
kcontrol/kfontinst/dbus/Folder.h
View file @
c16d79d8
...
...
@@ -88,7 +88,7 @@ class Folder
void
addModifiedDirs
(
const
QSet
<
QString
>
&
dirs
)
{
itsModifiedDirs
+=
dirs
;
}
bool
isModified
()
const
{
return
!
itsModifiedDirs
.
isEmpty
();
}
void
clearModified
()
{
itsModifiedDirs
.
clear
();
}
void
configure
();
void
configure
(
bool
force
=
false
);
Flat
flatten
()
const
;
const
FamilyCont
&
fonts
()
const
{
return
itsFonts
;
}
FamilyCont
::
ConstIterator
addFont
(
const
Family
&
fam
)
{
return
itsFonts
.
insert
(
fam
);
}
...
...
kcontrol/kfontinst/dbus/FontInst.cpp
View file @
c16d79d8
...
...
@@ -498,16 +498,16 @@ void FontInst::removeFile(const QString &family, quint32 style, const QString &f
emit
status
(
pid
,
result
);
}
void
FontInst
::
reconfigure
(
int
pid
)
void
FontInst
::
reconfigure
(
int
pid
,
bool
force
)
{
KFI_DBUG
<<
pid
;
KFI_DBUG
<<
pid
<<
force
;
bool
sysModified
(
theFolders
[
FOLDER_SYS
].
isModified
());
saveDisabled
();
KFI_DBUG
<<
theFolders
[
FOLDER_USER
].
isModified
()
<<
sysModified
;
if
(
!
isSystem
&&
theFolders
[
FOLDER_USER
].
isModified
())
theFolders
[
FOLDER_USER
].
configure
();
if
(
!
isSystem
&&
(
force
||
theFolders
[
FOLDER_USER
].
isModified
())
)
theFolders
[
FOLDER_USER
].
configure
(
force
);
if
(
sysModified
)
{
...
...
@@ -531,6 +531,11 @@ void FontInst::reconfigure(int pid)
emit
status
(
pid
,
isSystem
?
constSystemReconfigured
:
STATUS_OK
);
}
QString
FontInst
::
folderName
(
bool
sys
)
{
return
theFolders
[
sys
||
isSystem
?
FOLDER_SYS
:
FOLDER_USER
].
location
();
}
void
FontInst
::
saveDisabled
()
{
if
(
isSystem
)
...
...
kcontrol/kfontinst/dbus/FontInst.h
View file @
c16d79d8
...
...
@@ -103,18 +103,19 @@ class KFONTINST_EXPORT FontInst : public QObject
public
Q_SLOTS
:
Q_NOREPLY
void
list
(
int
folders
,
int
pid
);
Q_NOREPLY
void
stat
(
const
QString
&
font
,
int
folders
,
int
pid
);
Q_NOREPLY
void
install
(
const
QString
&
file
,
bool
createAfm
,
bool
toSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
uninstall
(
const
QString
&
family
,
quint32
style
,
bool
fromSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
uninstall
(
const
QString
&
name
,
bool
fromSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
move
(
const
QString
&
family
,
quint32
style
,
bool
toSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
enable
(
const
QString
&
family
,
quint32
style
,
bool
inSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
disable
(
const
QString
&
family
,
quint32
style
,
bool
inSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
removeFile
(
const
QString
&
family
,
quint32
style
,
const
QString
&
file
,
bool
fromSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
reconfigure
(
int
pid
);
Q_SCRIPTABLE
void
saveDisabled
();
Q_NOREPLY
void
list
(
int
folders
,
int
pid
);
Q_NOREPLY
void
stat
(
const
QString
&
font
,
int
folders
,
int
pid
);
Q_NOREPLY
void
install
(
const
QString
&
file
,
bool
createAfm
,
bool
toSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
uninstall
(
const
QString
&
family
,
quint32
style
,
bool
fromSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
uninstall
(
const
QString
&
name
,
bool
fromSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
move
(
const
QString
&
family
,
quint32
style
,
bool
toSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
enable
(
const
QString
&
family
,
quint32
style
,
bool
inSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
disable
(
const
QString
&
family
,
quint32
style
,
bool
inSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
removeFile
(
const
QString
&
family
,
quint32
style
,
const
QString
&
file
,
bool
fromSystem
,
int
pid
,
bool
checkConfig
);
Q_NOREPLY
void
reconfigure
(
int
pid
,
bool
force
);
Q_SCRIPTABLE
QString
folderName
(
bool
sys
);
Q_SCRIPTABLE
void
saveDisabled
();
Q_SIGNALS:
...
...
kcontrol/kfontinst/dbus/FontinstIface.cpp
View file @
c16d79d8
...
...
@@ -2,7 +2,7 @@
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -m -p FontinstIface org.kde.fontinst.xml -i Family.h
*
* qdbusxml2cpp is Copyright (C) 20
09
Nokia Corporation and/or its subsidiary(-ies).
* qdbusxml2cpp is Copyright (C) 20
11
Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
...
...
kcontrol/kfontinst/dbus/FontinstIface.h
View file @
c16d79d8
...
...
@@ -2,7 +2,7 @@
* This file was generated by qdbusxml2cpp version 0.7
* Command line was: qdbusxml2cpp -m -p FontinstIface org.kde.fontinst.xml -i Family.h
*
* qdbusxml2cpp is Copyright (C) 20
09
Nokia Corporation and/or its subsidiary(-ies).
* qdbusxml2cpp is Copyright (C) 20
11
Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
...
...
@@ -51,6 +51,13 @@ public Q_SLOTS: // METHODS
callWithArgumentList
(
QDBus
::
NoBlock
,
QLatin1String
(
"enable"
),
argumentList
);
}
inline
QDBusPendingReply
<
QString
>
folderName
(
bool
sys
)
{
QList
<
QVariant
>
argumentList
;
argumentList
<<
qVariantFromValue
(
sys
);
return
asyncCallWithArgumentList
(
QLatin1String
(
"folderName"
),
argumentList
);
}
inline
Q_NOREPLY
void
install
(
const
QString
&
file
,
bool
createAfm
,
bool
toSystem
,
int
pid
,
bool
checkConfig
)
{
QList
<
QVariant
>
argumentList
;
...
...
@@ -72,10 +79,10 @@ public Q_SLOTS: // METHODS
callWithArgumentList
(
QDBus
::
NoBlock
,
QLatin1String
(
"move"
),
argumentList
);
}
inline
Q_NOREPLY
void
reconfigure
(
int
pid
)
inline
Q_NOREPLY
void
reconfigure
(
int
pid
,
bool
force
)
{
QList
<
QVariant
>
argumentList
;
argumentList
<<
qVariantFromValue
(
pid
);
argumentList
<<
qVariantFromValue
(
pid
)
<<
qVariantFromValue
(
force
)
;
callWithArgumentList
(
QDBus
::
NoBlock
,
QLatin1String
(
"reconfigure"
),
argumentList
);
}
...
...
kcontrol/kfontinst/dbus/org.kde.fontinst.xml
View file @
c16d79d8
...
...
@@ -100,8 +100,13 @@
</method>
<method
name=
"reconfigure"
>
<arg
name=
"pid"
type=
"i"
direction=
"in"
/>
<arg
name=
"force"
type=
"b"
direction=
"in"
/>
<annotation
name=
"org.freedesktop.DBus.Method.NoReply"
value=
"true"
/>
</method>
<method
name=
"saveDisabled"
/>
<method
name=
"folderName"
>
<arg
name=
"sys"
type=
"b"
direction=
"in"
/>
<arg
type=
"s"
direction=
"out"
/>
</method>
</interface>
</node>
kcontrol/kfontinst/kcmfontinst/CMakeLists.txt
View file @
c16d79d8
...
...
@@ -9,9 +9,10 @@ set(kcm_fontinst_PART_SRCS ${libkfontinstview_SRCS} ${libkfontinstjobrunner_SRCS
kde4_add_plugin
(
kcm_fontinst
${
kcm_fontinst_PART_SRCS
}
)
target_link_libraries
(
kcm_fontinst
${
KDE4_KIO_LIBS
}
${
KDE4_KDESU_LIBS
}
kfontinstui kfontinst
${
X11_LIBRARIES
}
)
target_link_libraries
(
kcm_fontinst
${
KDE4_KIO_LIBS
}
${
KDE4_KDESU_LIBS
}
${
KDE4_KNEWSTUFF3_LIBRARY
}
kfontinstui kfontinst
${
X11_LIBRARIES
}
)
install
(
TARGETS kcm_fontinst DESTINATION
${
PLUGIN_INSTALL_DIR
}
)
install
(
FILES fontinst.desktop DESTINATION
${
SERVICES_INSTALL_DIR
}
)
install
(
FILES kfontinst.knsrc DESTINATION
${
CONFIG_INSTALL_DIR
}
)
kde4_install_icons
(
${
DATA_INSTALL_DIR
}
/kfontinst/icons
)
kcontrol/kfontinst/kcmfontinst/JobRunner.cpp
View file @
c16d79d8
...
...
@@ -271,6 +271,8 @@ void CJobRunner::getAssociatedUrls(const KUrl &url, KUrl::List &list, bool afmAn
int
CJobRunner
::
exec
(
ECommand
cmd
,
const
ItemList
&
urls
,
bool
destIsSystem
)
{
itsAutoSkip
=
itsCancelClicked
=
itsModified
=
false
;
switch
(
cmd
)
{
case
CMD_INSTALL
:
...
...
@@ -287,6 +289,7 @@ int CJobRunner::exec(ECommand cmd, const ItemList &urls, bool destIsSystem)
break
;
case
CMD_UPDATE
:
setCaption
(
i18n
(
"Updating"
));
itsModified
=
true
;
break
;
case
CMD_REMOVE_FILE
:
setCaption
(
i18n
(
"Removing"
));
...
...
@@ -309,7 +312,6 @@ int CJobRunner::exec(ECommand cmd, const ItemList &urls, bool destIsSystem)
itsCmd
=
cmd
;
itsCurrentFile
=
QString
();
itsStatusLabel
->
setText
(
QString
());
itsAutoSkip
=
itsCancelClicked
=
itsModified
=
false
;
setPage
(
PAGE_PROGRESS
);
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
doNext
()));
QTimer
::
singleShot
(
constInterfaceCheck
,
this
,
SLOT
(
checkInterface
()));
...
...
@@ -329,8 +331,9 @@ void CJobRunner::doNext()
{
if
(
itsModified
)
{
// Force reconfig if command was already set to update...
dbus
()
->
reconfigure
(
getpid
(),
CMD_UPDATE
==
itsCmd
);
itsCmd
=
CMD_UPDATE
;
dbus
()
->
reconfigure
(
getpid
());
itsStatusLabel
->
setText
(
i18n
(
"Updating font configuration. Please wait..."
));
itsProgress
->
setValue
(
itsProgress
->
maximum
());
emit
configuring
();
...
...
kcontrol/kfontinst/kcmfontinst/KCmFontInst.cpp
View file @
c16d79d8
...
...
@@ -68,6 +68,7 @@
#include
<KDE/KPluginLoader>
#include
<KDE/KStandardAction>
#include
<KDE/KZip>
#include
<KDE/KNS3/DownloadDialog>
#define CFG_GROUP "Main Settings"
#define CFG_PREVIEW_SPLITTER_SIZES "PreviewSplitterSizes"
...
...
@@ -178,7 +179,8 @@ CKCmFontInst::CKCmFontInst(QWidget *parent, const QVariantList&)
itsProgress
(
NULL
),
itsUpdateDialog
(
NULL
),
itsTempDir
(
NULL
),
itsPrintProc
(
NULL
)
itsPrintProc
(
NULL
),
itsDownloadFontsAct
(
NULL
)
{
setButtons
(
Help
);
...
...
@@ -224,12 +226,14 @@ CKCmFontInst::CKCmFontInst(QWidget *parent, const QVariantList&)
// Toolbar...
KAction
*
duplicateFontsAct
=
new
KAction
(
KIcon
(
"system-search"
),
i18n
(
"Scan for Duplicate Fonts..."
),
this
);
//*validateFontsAct=new KAction(KIcon("checkmark"), i18n("Validate Fonts..."), this);
//*downloadFontsAct=new KAction(KIcon("go-down"), i18n("Download Fonts..."), this);
if
(
!
Misc
::
root
())
itsDownloadFontsAct
=
new
KAction
(
KIcon
(
"get-hot-new-stuff"
),
i18n
(
"Get New Fonts..."
),
this
);
itsToolsMenu
=
new
KActionMenu
(
KIcon
(
"system-run"
),
i18n
(
"Tools"
),
this
);
itsToolsMenu
->
addAction
(
duplicateFontsAct
);
//itsToolsMenu->addAction(validateFontsAct);
//itsToolsMenu->addAction(downloadFontsAct);
if
(
itsDownloadFontsAct
)
itsToolsMenu
->
addAction
(
itsDownloadFontsAct
);
itsToolsMenu
->
setDelayed
(
false
);
toolbar
->
addAction
(
itsToolsMenu
);
itsFilter
=
new
CFontFilter
(
toolbarWidget
);
...
...
@@ -400,7 +404,8 @@ CKCmFontInst::CKCmFontInst(QWidget *parent, const QVariantList&)
connect
(
itsDeleteFontControl
,
SIGNAL
(
clicked
()),
SLOT
(
deleteFonts
()));
connect
(
duplicateFontsAct
,
SIGNAL
(
triggered
(
bool
)),
SLOT
(
duplicateFonts
()));
//connect(validateFontsAct, SIGNAL(triggered(bool)), SLOT(validateFonts()));
//connect(downloadFontsAct, SIGNAL(triggered(bool)), SLOT(downloadFonts()));
if
(
itsDownloadFontsAct
)
connect
(
itsDownloadFontsAct
,
SIGNAL
(
triggered
(
bool
)),
SLOT
(
downloadFonts
()));
connect
(
itsPreview
,
SIGNAL
(
customContextMenuRequested
(
const
QPoint
&
)),
SLOT
(
previewMenu
(
const
QPoint
&
)));
connect
(
itsPreviewList
,
SIGNAL
(
showMenu
(
const
QPoint
&
)),
SLOT
(
previewMenu
(
const
QPoint
&
)));
...
...
@@ -541,6 +546,9 @@ void CKCmFontInst::groupSelected(const QModelIndex &index)
itsGroupList
->
removeFromGroup
(
grp
,
*
it
);
grp
->
setValidated
();
}
if
(
itsDownloadFontsAct
)
itsDownloadFontsAct
->
setEnabled
(
grp
->
isPersonal
());
}
void
CKCmFontInst
::
print
(
bool
all
)
...
...
@@ -837,9 +845,34 @@ void CKCmFontInst::duplicateFonts()
//{
//}
//void CKCmFontInst::downloadFonts()
//{
//}
void
CKCmFontInst
::
downloadFonts
()
{
KNS3
::
DownloadDialog
*
newStuff
=
new
KNS3
::
DownloadDialog
(
"kfontinst.knsrc"
,
this
);
newStuff
->
exec
();
if
(
newStuff
->
changedEntries
().
count
())
// We have new fonts, so need to reconfigure fontconfig...
{
// Ask dbus helper for the current fonts folder name...
// We then sym-link our knewstuff3 download folder into the fonts folder...
if
(
CJobRunner
::
dbus
())
{
QDBusPendingReply
<
QString
>
reply
=
CJobRunner
::
dbus
()
->
folderName
(
false
);
reply
.
waitForFinished
();
if
(
!
reply
.
isError
())
{
QString
destFolder
=
reply
.
argumentAt
<
0
>
()
+
"kfontinst"
;
if
(
!
QFile
::
exists
(
destFolder
))
QFile
::
link
(
KStandardDirs
::
locateLocal
(
"data"
,
"kfontinst"
),
destFolder
);
}
}
doCmd
(
CJobRunner
::
CMD_UPDATE
,
CJobRunner
::
ItemList
());
}
delete
newStuff
;
}
void
CKCmFontInst
::
print
()
{
...
...
kcontrol/kfontinst/kcmfontinst/KCmFontInst.h
View file @
c16d79d8
...
...
@@ -83,6 +83,7 @@ class CKCmFontInst : public KCModule
void
disableGroup
();
void
changeText
();
void
duplicateFonts
();
void
downloadFonts
();
void
print
();
void
printGroup
();
void
listingPercent
(
int
p
);
...
...
@@ -134,6 +135,7 @@ class CKCmFontInst : public KCModule
CJobRunner
*
itsRunner
;
QMenu
*
itsPreviewMenu
,
*
itsPreviewListMenu
;
KAction
*
itsDownloadFontsAct
;
};
}
...
...
kcontrol/kfontinst/kcmfontinst/kfontinst.knsrc
0 → 100644
View file @
c16d79d8
[KNewStuff3]
ProvidersUrl=http://files.kde.org/khotnewstuff/fonts-providers.xml
Categories=KDE-Look.org Fonts
ChecksumPolicy=ifpossible
SignaturePolicy=ifpossible
TargetDir=kfontinst
Uncompress=archive
kcontrol/kfontinst/kio/FontInstInterface.cpp
View file @
c16d79d8
...
...
@@ -78,7 +78,7 @@ int FontInstInterface::uninstall(const QString &name, bool fromSystem)
int
FontInstInterface
::
reconfigure
()
{
KFI_DBUG
;
itsInterface
->
reconfigure
(
getpid
());
itsInterface
->
reconfigure
(
getpid
()
,
false
);
return
waitForResponse
();
}
...
...
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