|
Lines 29-35
Link Here
|
| 29 |
#include <config.h> |
29 |
#include <config.h> |
| 30 |
#endif |
30 |
#endif |
| 31 |
|
31 |
|
| 32 |
#ifdef HAVE_KNEWSTUFF |
32 |
#ifdef HAVE_TDENEWSTUFF |
| 33 |
#include "sknewstuff.h" |
33 |
#include "sknewstuff.h" |
| 34 |
#endif |
34 |
#endif |
| 35 |
|
35 |
|
|
Lines 55-61
ThemesDlg::ThemesDlg(TQWidget *parent, const char *name)
Link Here
|
| 55 |
: ThemesLayout(parent, name) |
55 |
: ThemesLayout(parent, name) |
| 56 |
{ |
56 |
{ |
| 57 |
populateListbox(); |
57 |
populateListbox(); |
| 58 |
#ifdef HAVE_KNEWSTUFF |
58 |
#ifdef HAVE_TDENEWSTUFF |
| 59 |
mNewStuff = 0; |
59 |
mNewStuff = 0; |
| 60 |
#endif |
60 |
#endif |
| 61 |
} |
61 |
} |
|
Lines 64-70
ThemesDlg::~ThemesDlg()
Link Here
|
| 64 |
{ |
64 |
{ |
| 65 |
//kdDebug() << k_funcinfo << endl; |
65 |
//kdDebug() << k_funcinfo << endl; |
| 66 |
saveUserAddedThemes(); |
66 |
saveUserAddedThemes(); |
| 67 |
#ifdef HAVE_KNEWSTUFF |
67 |
#ifdef HAVE_TDENEWSTUFF |
| 68 |
if(mNewStuff) |
68 |
if(mNewStuff) |
| 69 |
{ |
69 |
{ |
| 70 |
delete mNewStuff; |
70 |
delete mNewStuff; |
|
Lines 126-138
void ThemesDlg::populateListbox()
Link Here
|
| 126 |
tableThemes->clear(); |
126 |
tableThemes->clear(); |
| 127 |
|
127 |
|
| 128 |
item = new ThemeWidget; |
128 |
item = new ThemeWidget; |
| 129 |
item->icon->setPixmap(TDEGlobal::iconLoader()->loadIcon("knewstuff", |
129 |
item->icon->setPixmap(TDEGlobal::iconLoader()->loadIcon("tdenewstuff", |
| 130 |
TDEIcon::NoGroup, TDEIcon::SizeHuge)); |
130 |
TDEIcon::NoGroup, TDEIcon::SizeHuge)); |
| 131 |
item->setHeaderText(i18n("Get New Stuff")); |
131 |
item->setHeaderText(i18n("Get New Stuff")); |
| 132 |
item->setDescriptionText(i18n("Download new themes.")); |
132 |
item->setDescriptionText(i18n("Download new themes.")); |
| 133 |
|
133 |
|
| 134 |
item->buttonGo->setText(i18n("New Stuff...")); |
134 |
item->buttonGo->setText(i18n("New Stuff...")); |
| 135 |
#ifdef HAVE_KNEWSTUFF |
135 |
#ifdef HAVE_TDENEWSTUFF |
| 136 |
item->buttonGo->setEnabled(true); |
136 |
item->buttonGo->setEnabled(true); |
| 137 |
connect(item->buttonGo, TQT_SIGNAL(clicked()), |
137 |
connect(item->buttonGo, TQT_SIGNAL(clicked()), |
| 138 |
this, TQT_SLOT(getNewStuff())); |
138 |
this, TQT_SLOT(getNewStuff())); |
|
Lines 216-229
void ThemesDlg::openLocalTheme()
Link Here
|
| 216 |
|
216 |
|
| 217 |
void ThemesDlg::getNewStuff() |
217 |
void ThemesDlg::getNewStuff() |
| 218 |
{ |
218 |
{ |
| 219 |
#ifdef HAVE_KNEWSTUFF |
219 |
#ifdef HAVE_TDENEWSTUFF |
| 220 |
TDEConfig* config = TDEGlobal::config(); |
220 |
TDEConfig* config = TDEGlobal::config(); |
| 221 |
config->setGroup("KNewStuff"); |
221 |
config->setGroup("TDENewStuff"); |
| 222 |
config->writePathEntry("ProvidersUrl", |
222 |
config->writePathEntry("ProvidersUrl", |
| 223 |
TQString::fromLatin1("http://download.kde.org/khotnewstuff/karamba-providers.xml")); |
223 |
TQString::fromLatin1("http://download.kde.org/khotnewstuff/karamba-providers.xml")); |
| 224 |
config->sync(); |
224 |
config->sync(); |
| 225 |
m_newStuffStatus = config->entryMap("KNewStuffStatus").keys(); |
225 |
m_newStuffStatus = config->entryMap("TDENewStuffStatus").keys(); |
| 226 |
//This check is b/c KNewStuff will download, throw an error, |
226 |
//This check is b/c TDENewStuff will download, throw an error, |
| 227 |
//and still have the entry in the config that it was successful |
227 |
//and still have the entry in the config that it was successful |
| 228 |
configSanityCheck(); |
228 |
configSanityCheck(); |
| 229 |
|
229 |
|
|
Lines 300-308
void ThemesDlg::addThemeToDialog(const KArchiveDirectory *archiveDir,
Link Here
|
| 300 |
|
300 |
|
| 301 |
void ThemesDlg::writeNewStuffConfig(const TQString &file) |
301 |
void ThemesDlg::writeNewStuffConfig(const TQString &file) |
| 302 |
{ |
302 |
{ |
| 303 |
#ifdef HAVE_KNEWSTUFF |
303 |
#ifdef HAVE_TDENEWSTUFF |
| 304 |
TDEConfig* config = TDEGlobal::config(); |
304 |
TDEConfig* config = TDEGlobal::config(); |
| 305 |
TQStringList keys = config->entryMap("KNewStuffStatus").keys(); |
305 |
TQStringList keys = config->entryMap("TDENewStuffStatus").keys(); |
| 306 |
|
306 |
|
| 307 |
for(TQStringList::Iterator it = m_newStuffStatus.begin(); |
307 |
for(TQStringList::Iterator it = m_newStuffStatus.begin(); |
| 308 |
it != m_newStuffStatus.end(); ++it) |
308 |
it != m_newStuffStatus.end(); ++it) |
|
Lines 311-317
void ThemesDlg::writeNewStuffConfig(const TQString &file)
Link Here
|
| 311 |
} |
311 |
} |
| 312 |
if(!keys.isEmpty()) |
312 |
if(!keys.isEmpty()) |
| 313 |
{ |
313 |
{ |
| 314 |
config->setGroup("KNewStuffNames"); |
314 |
config->setGroup("TDENewStuffNames"); |
| 315 |
config->writeEntry(file, keys[0]); |
315 |
config->writeEntry(file, keys[0]); |
| 316 |
config->sync(); |
316 |
config->sync(); |
| 317 |
} |
317 |
} |
|
Lines 320-329
void ThemesDlg::writeNewStuffConfig(const TQString &file)
Link Here
|
| 320 |
|
320 |
|
| 321 |
void ThemesDlg::configSanityCheck() |
321 |
void ThemesDlg::configSanityCheck() |
| 322 |
{ |
322 |
{ |
| 323 |
#ifdef HAVE_KNEWSTUFF |
323 |
#ifdef HAVE_TDENEWSTUFF |
| 324 |
TDEConfig* config = TDEGlobal::config(); |
324 |
TDEConfig* config = TDEGlobal::config(); |
| 325 |
TQStringList statusKeys = config->entryMap("KNewStuffStatus").keys(); |
325 |
TQStringList statusKeys = config->entryMap("TDENewStuffStatus").keys(); |
| 326 |
TQStringList nameKeys = config->entryMap("KNewStuffNames").keys(); |
326 |
TQStringList nameKeys = config->entryMap("TDENewStuffNames").keys(); |
| 327 |
TQStringList removeList; |
327 |
TQStringList removeList; |
| 328 |
|
328 |
|
| 329 |
for(TQStringList::Iterator it = statusKeys.begin(); |
329 |
for(TQStringList::Iterator it = statusKeys.begin(); |
|
Lines 331-337
void ThemesDlg::configSanityCheck()
Link Here
|
| 331 |
{ |
331 |
{ |
| 332 |
TQString keyName(*it); |
332 |
TQString keyName(*it); |
| 333 |
bool removeKey = true; |
333 |
bool removeKey = true; |
| 334 |
config->setGroup("KNewStuffNames"); |
334 |
config->setGroup("TDENewStuffNames"); |
| 335 |
for(TQStringList::Iterator it2 = nameKeys.begin(); |
335 |
for(TQStringList::Iterator it2 = nameKeys.begin(); |
| 336 |
it2 != nameKeys.end(); ++it2) |
336 |
it2 != nameKeys.end(); ++it2) |
| 337 |
{ |
337 |
{ |
|
Lines 345-351
void ThemesDlg::configSanityCheck()
Link Here
|
| 345 |
if( removeKey ) |
345 |
if( removeKey ) |
| 346 |
{ |
346 |
{ |
| 347 |
kdDebug() << "sanityCheck() deleting entry " << keyName << endl; |
347 |
kdDebug() << "sanityCheck() deleting entry " << keyName << endl; |
| 348 |
config->setGroup("KNewStuffStatus"); |
348 |
config->setGroup("TDENewStuffStatus"); |
| 349 |
config->deleteEntry( keyName ); |
349 |
config->deleteEntry( keyName ); |
| 350 |
} |
350 |
} |
| 351 |
} |
351 |
} |
|
Lines 428-434
bool ThemesDlg::isDownloaded( const TQString& path )
Link Here
|
| 428 |
{ |
428 |
{ |
| 429 |
kdDebug() << "isDownloaded path: " << path << endl; |
429 |
kdDebug() << "isDownloaded path: " << path << endl; |
| 430 |
TDEConfig* config = TDEGlobal::config(); |
430 |
TDEConfig* config = TDEGlobal::config(); |
| 431 |
config->setGroup("KNewStuffNames"); |
431 |
config->setGroup("TDENewStuffNames"); |
| 432 |
return !config->readEntry(path).isEmpty(); |
432 |
return !config->readEntry(path).isEmpty(); |
| 433 |
} |
433 |
} |
| 434 |
|
434 |
|
|
Lines 476-493
void ThemesDlg::uninstall()
Link Here
|
| 476 |
karambaApp->dcopIface()->closeTheme(twPtr->themeFile()->name()); |
476 |
karambaApp->dcopIface()->closeTheme(twPtr->themeFile()->name()); |
| 477 |
tableThemes->removeItem( twPtr ); |
477 |
tableThemes->removeItem( twPtr ); |
| 478 |
} |
478 |
} |
| 479 |
#ifdef HAVE_KNEWSTUFF |
479 |
#ifdef HAVE_TDENEWSTUFF |
| 480 |
// Remove theme from KNewStuffStatus |
480 |
// Remove theme from TDENewStuffStatus |
| 481 |
TDEConfig* config = TDEGlobal::config(); |
481 |
TDEConfig* config = TDEGlobal::config(); |
| 482 |
config->setGroup("KNewStuffNames"); |
482 |
config->setGroup("TDENewStuffNames"); |
| 483 |
TQString name = config->readEntry(tempPath); |
483 |
TQString name = config->readEntry(tempPath); |
| 484 |
if(!name.isEmpty()) |
484 |
if(!name.isEmpty()) |
| 485 |
{ |
485 |
{ |
| 486 |
kdDebug() << "removing " << tempPath << " under KNewStuffNames from superkarambarc" |
486 |
kdDebug() << "removing " << tempPath << " under TDENewStuffNames from superkarambarc" |
| 487 |
<< endl; |
487 |
<< endl; |
| 488 |
kapp->config()->deleteEntry(tempPath); |
488 |
kapp->config()->deleteEntry(tempPath); |
| 489 |
config->setGroup("KNewStuffStatus"); |
489 |
config->setGroup("TDENewStuffStatus"); |
| 490 |
kdDebug() << "removing " << name << " under KNewStuffStatus from superkarambarc" |
490 |
kdDebug() << "removing " << name << " under TDENewStuffStatus from superkarambarc" |
| 491 |
<< endl; |
491 |
<< endl; |
| 492 |
kapp->config()->deleteEntry(name); |
492 |
kapp->config()->deleteEntry(name); |
| 493 |
kapp->config()->sync(); |
493 |
kapp->config()->sync(); |
|
Lines 506-521
void ThemesDlg::uninstall()
Link Here
|
| 506 |
TDEIO::move(remDir.path(), trash); |
506 |
TDEIO::move(remDir.path(), trash); |
| 507 |
} |
507 |
} |
| 508 |
tableThemes->removeItem(w); |
508 |
tableThemes->removeItem(w); |
| 509 |
#ifdef HAVE_KNEWSTUFF |
509 |
#ifdef HAVE_TDENEWSTUFF |
| 510 |
// Remove theme from KNewStuffStatus |
510 |
// Remove theme from TDENewStuffStatus |
| 511 |
TDEConfig* config = TDEGlobal::config(); |
511 |
TDEConfig* config = TDEGlobal::config(); |
| 512 |
config->setGroup("KNewStuffNames"); |
512 |
config->setGroup("TDENewStuffNames"); |
| 513 |
TQString name = config->readEntry(theme.path()); |
513 |
TQString name = config->readEntry(theme.path()); |
| 514 |
if(!name.isEmpty()) |
514 |
if(!name.isEmpty()) |
| 515 |
{ |
515 |
{ |
| 516 |
kdDebug() << "removing " << theme.path() << " from superkarambarc" << endl; |
516 |
kdDebug() << "removing " << theme.path() << " from superkarambarc" << endl; |
| 517 |
kapp->config()->deleteEntry(theme.path()); |
517 |
kapp->config()->deleteEntry(theme.path()); |
| 518 |
config->setGroup("KNewStuffStatus"); |
518 |
config->setGroup("TDENewStuffStatus"); |
| 519 |
kdDebug() << "removing " << name << " from superkarambarc" << endl; |
519 |
kdDebug() << "removing " << name << " from superkarambarc" << endl; |
| 520 |
kapp->config()->deleteEntry(name); |
520 |
kapp->config()->deleteEntry(name); |
| 521 |
kapp->config()->sync(); |
521 |
kapp->config()->sync(); |