Changeset View
Changeset View
Standalone View
Standalone View
krusader/Konfigurator/kgprotocols.cpp
Show All 39 Lines | |||||
40 | #include <QGridLayout> | 40 | #include <QGridLayout> | ||
41 | #include <QVBoxLayout> | 41 | #include <QVBoxLayout> | ||
42 | 42 | | |||
43 | #include <KConfigCore/KSharedConfig> | 43 | #include <KConfigCore/KSharedConfig> | ||
44 | #include <KI18n/KLocalizedString> | 44 | #include <KI18n/KLocalizedString> | ||
45 | #include <KIOCore/KProtocolManager> | 45 | #include <KIOCore/KProtocolManager> | ||
46 | #include <KIconThemes/KIconLoader> | 46 | #include <KIconThemes/KIconLoader> | ||
47 | 47 | | |||
48 | QString KgProtocols::defaultProtocols = "krarc"; | | |||
49 | QString KgProtocols::defaultKrarcMimes = "application/zip"; | | |||
50 | | ||||
51 | KgProtocols::KgProtocols(bool first, QWidget* parent) : | 48 | KgProtocols::KgProtocols(bool first, QWidget* parent) : | ||
52 | KonfiguratorPage(first, parent) | 49 | KonfiguratorPage(first, parent) | ||
53 | { | 50 | { | ||
54 | QGridLayout *KgProtocolsLayout = new QGridLayout(this); | 51 | QGridLayout *KgProtocolsLayout = new QGridLayout(this); | ||
55 | KgProtocolsLayout->setSpacing(6); | 52 | KgProtocolsLayout->setSpacing(6); | ||
56 | 53 | | |||
57 | // -------------------------- LINK VIEW ---------------------------------- | 54 | // -------------------------- LINK VIEW ---------------------------------- | ||
58 | 55 | | |||
▲ Show 20 Lines • Show All 267 Lines • ▼ Show 20 Line(s) | 302 | { | |||
326 | emit sigChanged(); | 323 | emit sigChanged(); | ||
327 | } | 324 | } | ||
328 | 325 | | |||
329 | void KgProtocols::setDefaults() | 326 | void KgProtocols::setDefaults() | ||
330 | { | 327 | { | ||
331 | while (linkList->topLevelItemCount() != 0) | 328 | while (linkList->topLevelItemCount() != 0) | ||
332 | removeProtocol(linkList->topLevelItem(0)->text(0)); | 329 | removeProtocol(linkList->topLevelItem(0)->text(0)); | ||
333 | 330 | | |||
334 | #ifdef KRARC_ENABLED | | |||
335 | addProtocol("krarc"); | | |||
336 | QStringList krarcMimes = defaultKrarcMimes.split(','); | | |||
337 | foreach(const QString &mime, krarcMimes) { | | |||
338 | addMime(mime, "krarc"); | | |||
339 | } | | |||
340 | #endif | | |||
341 | | ||||
342 | slotDisableButtons(); | 331 | slotDisableButtons(); | ||
343 | 332 | | |||
344 | if (isChanged()) | 333 | if (isChanged()) | ||
345 | emit sigChanged(); | 334 | emit sigChanged(); | ||
346 | } | 335 | } | ||
347 | 336 | | |||
348 | bool KgProtocols::isChanged() | 337 | bool KgProtocols::isChanged() | ||
349 | { | 338 | { | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 368 | { | |||
401 | KrServices::clearProtocolCache(); | 390 | KrServices::clearProtocolCache(); | ||
402 | 391 | | |||
403 | emit sigChanged(); | 392 | emit sigChanged(); | ||
404 | return false; | 393 | return false; | ||
405 | } | 394 | } | ||
406 | 395 | | |||
407 | void KgProtocols::init() | 396 | void KgProtocols::init() | ||
408 | { | 397 | { | ||
409 | if (!krConfig->groupList().contains("Protocols")) { | | |||
410 | KConfigGroup group(krConfig, "Protocols"); | | |||
411 | group.writeEntry("Handled Protocols", defaultProtocols); | | |||
412 | group.writeEntry("Mimes For krarc", defaultKrarcMimes); | | |||
413 | } | | |||
414 | } | 398 | } |