00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "kcarddialog.h"
00020 #include "ui_kgamecardselector.h"
00021
00022 #include <QMatrix>
00023 #include <QPixmap>
00024 #include <QListWidget>
00025 #include <QListWidgetItem>
00026 #include <QFileInfo>
00027 #include <QDir>
00028
00029 #include <klocale.h>
00030 #include <kstandarddirs.h>
00031 #include <krandom.h>
00032 #include <kconfig.h>
00033
00034 #include <kdebug.h>
00035
00036
00037 #define CONF_GROUP "KCardDialog"
00038 #define CONF_RANDOMDECK QString::fromLatin1("RandomDeck")
00039 #define CONF_DECK "Deck"
00040 #define CONF_CARDDIR QString::fromLatin1("CardDir")
00041 #define CONF_RANDOMCARDDIR QString::fromLatin1("RandomCardDir")
00042 #define CONF_USEGLOBALDECK QString::fromLatin1("GlobalDeck")
00043 #define CONF_USEGLOBALCARDDIR QString::fromLatin1("GlobalCardDir")
00044 #define CONF_SCALE QString::fromLatin1("Scale")
00045
00046 #define CONF_GLOBAL_GROUP QString::fromLatin1("KCardDialog Settings")
00047 #define CONF_GLOBAL_DECK "GlobalDeck"
00048 #define CONF_GLOBAL_CARDDIR QString::fromLatin1("GlobalCardDir")
00049 #define CONF_GLOBAL_RANDOMDECK QString::fromLatin1("GlobalRandomDeck")
00050 #define CONF_GLOBAL_RANDOMCARDDIR QString::fromLatin1("GlobalRandomCardDir")
00051
00052
00053
00054 class KCardInfo
00055 {
00056 public:
00057
00058 QString name;
00059 QString comment;
00060 QString path;
00061 QString back;
00062 QPixmap preview;
00063 QString svgfile;
00064 QSizeF size;
00065 bool isDefault;
00066 };
00067
00068 class KCardDialogPrivate
00069 {
00070 public:
00071
00072 KCardDialogPrivate()
00073 {
00074
00075 useSVGOnly = false;
00076 usePNGOnly = false;
00077 useLocking = true;
00078 }
00079
00080 bool filterOutCard(const KCardInfo& v)
00081 {
00082 if (usePNGOnly && !v.svgfile.isNull()) return true;
00083 if (useSVGOnly && v.svgfile.isNull()) return true;
00084 return false;
00085 }
00086
00087 Ui::KGameCardSelectorBase ui;
00088 bool useSVGOnly;
00089 bool usePNGOnly;
00090 bool useLocking;
00091 QString currentDeck;
00092 QString currentCard;
00093 };
00094
00095 class KCardDialogStatic
00096 {
00097 public:
00098 QMap<QString, KCardInfo> cardInfo;
00099 QMap<QString, KCardInfo> deckInfo;
00100 QString defaultDeck;
00101 QString defaultCard;
00102
00103 bool filterOutCard(const KCardInfo& v, bool useSVGOnly, bool usePNGOnly)
00104 {
00105 if (usePNGOnly && !v.svgfile.isNull()) return true;
00106 if (useSVGOnly && v.svgfile.isNull()) return true;
00107 return false;
00108 }
00109 };
00110
00111 static KCardDialogStatic ds;
00112
00113
00114 KCardDialog::KCardDialog(QWidget *parent, bool pAllowSVG, bool pAllowPNG, bool pLock)
00115 : KDialog( parent ), d( new KCardDialogPrivate )
00116 {
00117 setCaption(i18n("Carddeck Selection"));
00118 setButtons(Ok|Cancel);
00119 setDefaultButton(Ok);
00120 setModal(true);
00121 showButtonSeparator(true);
00122 KCardDialog::init();
00123 adjustSize();
00124 }
00125
00126 KCardDialog::~KCardDialog()
00127 {
00128 delete d;
00129 }
00130
00131
00132 int KCardDialog::getCardDeck(QString &pFrontName,
00133 QString &pBackName,
00134 QWidget *pParent,
00135 bool pAllowSVG,
00136 bool pAllowPNG,
00137 bool pLock,
00138 bool pRandom
00139 )
00140 {
00141 KCardDialog::init();
00142
00143
00144
00145 if (pRandom)
00146 {
00147 pFrontName = randomCardName();
00148 pBackName = randomDeckName();
00149 return QDialog::Accepted;
00150 }
00151
00152 KCardDialog dlg(pParent, pAllowSVG, pAllowPNG, pLock);
00153 Ui::KGameCardSelectorBase* ui = &dlg.d->ui;
00154
00155 kDebug() << "LOCK = " << pLock;
00156
00157 QWidget widget(&dlg);
00158 ui->setupUi(&widget);
00159 dlg.setMainWidget(&widget);
00160 dlg.insertCardIcons();
00161 dlg.insertDeckIcons();
00162
00163 dlg.d->useLocking = pLock;
00164 if (dlg.d->useLocking) ui->checkBoxLock->setCheckState(Qt::Checked);
00165
00166
00167 if (!pAllowPNG)
00168 {
00169 ui->checkBoxPNG->setEnabled(false);
00170 ui->checkBoxPNG->setCheckState(Qt::Unchecked);
00171 dlg.d->usePNGOnly = false;
00172 }
00173
00174 if (!pAllowSVG)
00175 {
00176 ui->checkBoxSVG->setEnabled(false);
00177 ui->checkBoxSVG->setCheckState(Qt::Unchecked);
00178 dlg.d->useSVGOnly = false;
00179 }
00180
00181 if (dlg.d->useSVGOnly)
00182 {
00183 ui->checkBoxSVG->setCheckState(Qt::Checked);
00184 }
00185 if (dlg.d->usePNGOnly)
00186 {
00187 ui->checkBoxPNG->setCheckState(Qt::Checked);
00188 }
00189
00190
00191 if (!pFrontName.isNull()) dlg.d->currentCard = pFrontName;
00192 else dlg.d->currentCard = dlg.defaultCardName(pAllowSVG, pAllowPNG);
00193 if (!pBackName.isNull()) dlg.d->currentDeck = pBackName;
00194 else dlg.d->currentDeck = dlg.defaultDeckName(pAllowSVG, pAllowPNG);
00195
00196 dlg.updateFront(dlg.d->currentCard);
00197 dlg.updateBack(dlg.d->currentDeck);
00198
00199
00200 ui->backList->setEnabled(!dlg.d->useLocking);
00201
00202 connect(ui->frontList, SIGNAL(currentItemChanged( QListWidgetItem * , QListWidgetItem * )),
00203 &dlg, SLOT(updateFront(QListWidgetItem * , QListWidgetItem * )));
00204 connect(ui->backList, SIGNAL(currentItemChanged( QListWidgetItem * , QListWidgetItem * )),
00205 &dlg, SLOT(updateBack(QListWidgetItem * , QListWidgetItem * )));
00206 connect(ui->checkBoxLock, SIGNAL(stateChanged(int)), &dlg, SLOT(updateLocking(int)));
00207 connect(ui->checkBoxSVG, SIGNAL(stateChanged(int)), &dlg, SLOT(updateSVG(int)));
00208 connect(ui->checkBoxPNG, SIGNAL(stateChanged(int)), &dlg, SLOT(updatePNG(int)));
00209
00210
00211
00212 kDebug() << "DEFAULT DECK: " << dlg.defaultDeckName(pAllowSVG, pAllowPNG);
00213 kDebug() << "DEFAULT CARD: " << dlg.defaultCardName(pAllowSVG, pAllowPNG);
00214 kDebug() << "RANDOM DECK: " << dlg.randomDeckName(pAllowSVG, pAllowPNG);
00215 kDebug() << "RANDOM CARD: " << dlg.randomCardName(pAllowSVG, pAllowPNG);
00216
00217
00218 int result=dlg.exec();
00219 if (result==QDialog::Accepted)
00220 {
00221 pFrontName = dlg.d->currentCard;
00222 pBackName = dlg.d->currentDeck;
00223 }
00224
00225 return result;
00226 }
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253 QString KCardDialog::deckName() const
00254 {
00255 return d->currentDeck;
00256 }
00257
00258 QString KCardDialog::cardName() const
00259 {
00260 return d->currentCard;
00261 }
00262
00263
00264 void KCardDialog::readFronts()
00265 {
00266
00267 ds.cardInfo.clear();
00268
00269 QStringList svg;
00270
00271 svg = KGlobal::dirs()->findAllResources("cards", "svg*/index.desktop", KStandardDirs::NoDuplicates);
00272 QStringList list = svg+KGlobal::dirs()->findAllResources("cards", "card*/index.desktop", KStandardDirs::NoDuplicates);
00273
00274 if (list.isEmpty()) return;
00275
00276 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
00277 {
00278 KConfig cfg(*it, KConfig::OnlyLocal);
00279 KConfigGroup cfgcg(&cfg, "KDE Backdeck");
00280 QString path = (*it).left((*it).lastIndexOf('/') + 1);
00281 Q_ASSERT(path[path.length() - 1] == '/');
00282 QPixmap pixmap(path + cfgcg.readEntry("Preview", "12c.png"));
00283
00284 if (pixmap.isNull()) continue;
00285
00286 QString name = cfgcg.readEntry("Name", i18n("unnamed"));
00287 KCardInfo info;
00288 info.name = name;
00289 info.comment = cfgcg.readEntry("Comment",i18n("KDE card deck"));
00290 info.preview = pixmap;
00291 info.path = path;
00292 info.back = cfgcg.readEntry("Back",QString());
00293 info.size = cfgcg.readEntry("BackSize", QSizeF(pixmap.size()));
00294 info.isDefault = cfgcg.readEntry("Default", false);
00295
00296 QString svg = cfgcg.readEntry("SVG", QString());
00297 if (!svg.isNull())
00298 {
00299 QFileInfo svgInfo(QDir(path), svg);
00300 info.svgfile = svgInfo.filePath();
00301 }
00302 else
00303 {
00304 info.svgfile = QString();
00305 }
00306
00307
00308 ds.cardInfo[name] = info;
00309
00310 }
00311 }
00312
00313
00314 void KCardDialog::insertCardIcons()
00315 {
00316
00317 if (d->useSVGOnly && !isSVGCard(d->currentCard)) updateFront(defaultCardName(!d->usePNGOnly, !d->useSVGOnly));
00318 if (d->usePNGOnly && isSVGCard(d->currentCard)) updateFront(defaultCardName(!d->usePNGOnly, !d->useSVGOnly));
00319
00320
00321 d->ui.frontList->clear();
00322
00323
00324 QSize itemSize;
00325 QMapIterator<QString, KCardInfo> it(ds.cardInfo);
00326 while (it.hasNext())
00327 {
00328 it.next();
00329 KCardInfo v = it.value();
00330
00331 if (d->filterOutCard(v)) continue;
00332
00333 QPixmap previewPixmap = v.preview.scaled(QSize(32,43), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
00334
00335 QListWidgetItem *item = new QListWidgetItem(v.name, d->ui.frontList);
00336 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
00337 item->setToolTip(v.name);
00338 item->setData(Qt::DecorationRole, previewPixmap);
00339 itemSize = itemSize.expandedTo(previewPixmap.size());
00340 }
00341 d->ui.frontList->setIconSize(itemSize);
00342 }
00343
00344 void KCardDialog::updateFront(QListWidgetItem* current , QListWidgetItem* )
00345 {
00346 kDebug() << " updateFront p= " << current;
00347 if (current != 0) updateFront(current->text());
00348 }
00349
00350 void KCardDialog::updateFront(QString item)
00351 {
00352 kDebug() << " updateFront to " << item;
00353
00354 if (item.isNull())
00355 {
00356 d->ui.frontPreview->setPixmap(QPixmap());
00357 d->ui.cardName->setText(QString());
00358 d->ui.cardDescription->setText(QString());
00359 }
00360 else
00361 {
00362 KCardInfo info = ds.cardInfo[item];
00363 QFont font;
00364 font.setBold(true);
00365 d->ui.cardName->setText(info.name);
00366 d->ui.cardName->setFont(font);
00367 kDebug() << " back" << info.back;
00368
00369 d->ui.cardDescription->setText(info.comment);
00370 QPixmap pixmap= info.preview;
00371 if (pixmap.height() > d->ui.frontPreview->height())
00372 pixmap = pixmap.scaledToHeight(d->ui.frontPreview->height(), Qt::SmoothTransformation);
00373 if (pixmap.width() > d->ui.frontPreview->width())
00374 pixmap = pixmap.scaledToWidth(d->ui.frontPreview->width(), Qt::SmoothTransformation);
00375 d->ui.frontPreview->setPixmap(pixmap);
00376
00377
00378 if (d->useLocking && !info.back.isNull())
00379 {
00380 kDebug() << "LOCK BACK";
00381 updateBack(info.back);
00382 }
00383 else if (d->useLocking)
00384 {
00385
00386 QString name = defaultDeckName(!d->usePNGOnly, !d->useSVGOnly);
00387 kDebug() << "LOCK BACK without back to "<<name;
00388 updateBack(name);
00389 }
00390 }
00391 d->currentCard = item;
00392 }
00393
00394 QString KCardDialog::getDefaultCardDir(bool pAllowSVG, bool pAllowPNG)
00395 {
00396 KCardDialog::init();
00397 QString name = defaultCardName(pAllowSVG, pAllowPNG);
00398 return cardDir(name);
00399 }
00400 QString KCardDialog::getDefaultDeck(bool pAllowSVG, bool pAllowPNG)
00401 {
00402 KCardDialog::init();
00403 QString name = defaultDeckName(pAllowSVG, pAllowPNG);
00404 return deckFilename(name);
00405 }
00406
00407 QString KCardDialog::defaultCardName(bool pAllowSVG, bool pAllowPNG)
00408 {
00409 KCardDialog::init();
00410 kDebug() << "defaultCardName " << pAllowSVG <<", "<<pAllowPNG;
00411 QString noDefault;
00412
00413 QMapIterator<QString, KCardInfo> it(ds.cardInfo);
00414 while (it.hasNext())
00415 {
00416 it.next();
00417 KCardInfo v = it.value();
00418
00419 if (ds.filterOutCard(v, !pAllowPNG, !pAllowSVG)) continue;
00420 if (v.isDefault) return v.name;
00421
00422 noDefault = v.name;
00423 }
00424 if (noDefault.isNull()) kError() << "Could not find default card name";
00425 return noDefault;
00426 }
00427 QString KCardDialog::defaultDeckName(bool pAllowSVG, bool pAllowPNG)
00428 {
00429 KCardDialog::init();
00430 kDebug() << "defaultDeckName " << pAllowSVG <<", "<<pAllowPNG;
00431 QString noDefault;
00432
00433 QMapIterator<QString, KCardInfo> it(ds.deckInfo);
00434 while (it.hasNext())
00435 {
00436 it.next();
00437 KCardInfo v = it.value();
00438
00439 if (ds.filterOutCard(v, !pAllowPNG, !pAllowSVG)) continue;
00440 if (v.isDefault)
00441 {
00442 return v.name;
00443 }
00444
00445 noDefault = v.name;
00446 }
00447 if (noDefault.isNull()) kError() << "Could not find default deck name";
00448 return noDefault;
00449 }
00450
00451
00452 QString KCardDialog::randomCardName(bool pAllowSVG, bool pAllowPNG)
00453 {
00454 KCardDialog::init();
00455
00456 QStringList list;
00457
00458
00459 QMapIterator<QString, KCardInfo> it(ds.cardInfo);
00460 while (it.hasNext())
00461 {
00462 it.next();
00463 KCardInfo v = it.value();
00464
00465 if (ds.filterOutCard(v, !pAllowPNG, !pAllowSVG)) continue;
00466 list.append(v.name);
00467 }
00468
00469
00470 int d = KRandom::random() % list.count();
00471 return list.at(d);
00472 }
00473
00474 QString KCardDialog::randomDeckName(bool pAllowSVG, bool pAllowPNG)
00475 {
00476 KCardDialog::init();
00477
00478 QStringList list;
00479
00480
00481 QMapIterator<QString, KCardInfo> it(ds.deckInfo);
00482 while (it.hasNext())
00483 {
00484 it.next();
00485 KCardInfo v = it.value();
00486
00487 if (ds.filterOutCard(v, !pAllowPNG, !pAllowSVG)) continue;
00488 list.append(v.name);
00489 }
00490
00491
00492 int d = KRandom::random() % list.count();
00493 return list.at(d);
00494 }
00495
00496 void KCardDialog::updateLocking(int state)
00497 {
00498 kDebug() <<" updateLocking";
00499 if (state == Qt::Checked)
00500 {
00501 d->useLocking = true;
00502
00503 updateFront(d->currentCard);
00504 }
00505 else
00506 {
00507 d->useLocking = false;
00508 }
00509 d->ui.backList->setEnabled(!d->useLocking);
00510 }
00511
00512 void KCardDialog::updateSVG(int state)
00513 {
00514 kDebug() <<" updateSVG";
00515 if (state == Qt::Checked)
00516 {
00517 d->useSVGOnly = true;
00518 }
00519 else
00520 {
00521 d->useSVGOnly = false;
00522 }
00523
00524 if (d->usePNGOnly && d->useSVGOnly)
00525 {
00526 d->usePNGOnly = false;
00527 d->ui.checkBoxPNG->setCheckState(Qt::Unchecked);
00528 }
00529 insertCardIcons();
00530 insertDeckIcons();
00531 }
00532
00533 void KCardDialog::updatePNG(int state)
00534 {
00535 kDebug() <<" updatePNG";
00536 if (state == Qt::Checked)
00537 {
00538 d->usePNGOnly = true;
00539 }
00540 else
00541 {
00542 d->usePNGOnly = false;
00543 }
00544
00545 if (d->usePNGOnly && d->useSVGOnly)
00546 {
00547 d->useSVGOnly = false;
00548 d->ui.checkBoxSVG->setCheckState(Qt::Unchecked);
00549 }
00550 insertCardIcons();
00551 insertDeckIcons();
00552 }
00553
00554
00555 void KCardDialog::updateBack(QListWidgetItem* current , QListWidgetItem* )
00556 {
00557 kDebug() <<"updateBack back p="<<current;
00558 if (current != 0) updateBack(current->text());
00559 }
00560
00561 void KCardDialog::updateBack(QString item)
00562 {
00563 kDebug() << " updateBack to" << item;
00564 if (item.isNull())
00565 {
00566 d->ui.backPreview->setPixmap(QPixmap());
00567 }
00568 else
00569 {
00570 KCardInfo info = ds.deckInfo[item];
00571 QPixmap pixmap= info.preview;
00572 if (pixmap.height() > d->ui.backPreview->height())
00573 pixmap = pixmap.scaledToHeight(d->ui.backPreview->height(), Qt::SmoothTransformation);
00574 if (pixmap.width() > d->ui.backPreview->width())
00575 pixmap = pixmap.scaledToWidth(d->ui.backPreview->width(), Qt::SmoothTransformation);
00576 d->ui.backPreview->setPixmap(pixmap);
00577 }
00578 d->currentDeck = item;
00579 }
00580
00581 void KCardDialog::insertDeckIcons()
00582 {
00583
00584 if (d->useSVGOnly && !isSVGDeck(d->currentDeck)) updateBack(defaultDeckName(!d->usePNGOnly, !d->useSVGOnly));
00585 if (d->usePNGOnly && isSVGDeck(d->currentDeck)) updateBack(defaultDeckName(!d->usePNGOnly, !d->useSVGOnly));
00586 kDebug() << "insert deck " << d->useSVGOnly << !isSVGDeck(d->currentDeck) << d->usePNGOnly;
00587
00588
00589 d->ui.backList->clear();
00590
00591
00592 QSize itemSize;
00593 QMapIterator<QString, KCardInfo> it(ds.deckInfo);
00594 while (it.hasNext())
00595 {
00596 it.next();
00597 KCardInfo v = it.value();
00598
00599 if (d->filterOutCard(v)) continue;
00600 QPixmap previewPixmap = v.preview.scaled(QSize(32,43), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
00601
00602 QString name = v.name;
00603 QListWidgetItem *item = new QListWidgetItem(name, d->ui.backList);
00604 item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
00605 item->setToolTip(name);
00606 item->setData(Qt::DecorationRole, previewPixmap);
00607 itemSize = itemSize.expandedTo(previewPixmap.size());
00608 }
00609 d->ui.backList->setIconSize(itemSize);
00610 }
00611
00612 void KCardDialog::readBacks()
00613 {
00614
00615 ds.deckInfo.clear();
00616
00617 QStringList list = KGlobal::dirs()->findAllResources("cards", "decks/*.desktop", KStandardDirs::NoDuplicates);
00618 if (list.isEmpty()) return;
00619
00620 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it)
00621 {
00622 KConfig cfg(*it, KConfig::OnlyLocal);
00623 QString path = (*it).left((*it).lastIndexOf('/') + 1);
00624 Q_ASSERT(path[path.length() - 1] == '/');
00625 QPixmap pixmap(getDeckFileNameFromIndex(*it));
00626 if (pixmap.isNull()) continue;
00627
00628 QPixmap previewPixmap = pixmap.scaled(QSize(32,43), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
00629
00630 KConfigGroup cfgcg(&cfg, "KDE Cards");
00631 QString name = cfgcg.readEntry("Name", i18n("unnamed"));
00632
00633 KCardInfo info;
00634 info.name = name;
00635 info.path = getDeckFileNameFromIndex(*it);
00636 info.comment = cfgcg.readEntry("Comment",i18n("KDE card deck"));
00637 info.preview = pixmap;
00638 info.size = cfgcg.readEntry("Size", QSizeF(pixmap.size()));
00639 info.isDefault = cfgcg.readEntry("Default", false);
00640
00641 QString svg = cfgcg.readEntry("SVG", QString());
00642 if (!svg.isNull())
00643 {
00644 QFileInfo svgInfo(QDir(path), svg);
00645 info.svgfile = svgInfo.filePath();
00646 }
00647 else
00648 {
00649 info.svgfile = QString();
00650 }
00651
00652 ds.deckInfo[name] = info;
00653 }
00654 }
00655
00656
00657
00658
00659 QString KCardDialog::getDeckFileNameFromIndex(const QString &desktop)
00660 {
00661 QString entry = desktop.left(desktop.length() - strlen(".desktop"));
00662 if (KStandardDirs::exists(entry + QString::fromLatin1(".png")))
00663 return entry + QString::fromLatin1(".png");
00664
00665
00666 if (KStandardDirs::exists(entry + QString::fromLatin1(".xpm")))
00667 return entry + QString::fromLatin1(".xpm");
00668 return QString();
00669 }
00670
00671
00672 void KCardDialog::loadConfig(KConfig* conf)
00673 {
00674 if (!conf) {
00675 return;
00676 }
00677
00678 KConfigGroup cg(conf, CONF_GROUP);
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712 }
00713
00714
00715 void KCardDialog::saveConfig(KConfig* conf)
00716 {
00717 if (!conf) {
00718 return;
00719 }
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734 }
00735
00736
00737 void KCardDialog::init()
00738 {
00739 static bool _inited = false;
00740 if (_inited) return;
00741 _inited = true;
00742
00743 KGlobal::dirs()->addResourceType("cards", "data", "carddecks/");
00744 KGlobal::locale()->insertCatalog("libkdegames");
00745 readFronts();
00746 readBacks();
00747 }
00748
00749
00750 QString KCardDialog::deckSVGFilePath(const QString& name)
00751 {
00752 KCardDialog::init();
00753 if (!ds.deckInfo.contains(name)) return QString();
00754 KCardInfo v = ds.deckInfo.value(name);
00755 return v.svgfile;
00756 }
00757
00758
00759 QString KCardDialog::cardSVGFilePath(const QString& name)
00760 {
00761 KCardDialog::init();
00762 if (!ds.cardInfo.contains(name)) return QString();
00763 KCardInfo v = ds.cardInfo.value(name);
00764 return v.svgfile;
00765 }
00766
00767
00768 QString KCardDialog::deckFilename(const QString& name)
00769 {
00770 KCardDialog::init();
00771 if (!ds.deckInfo.contains(name)) return QString();
00772 KCardInfo v = ds.deckInfo.value(name);
00773 return v.path;
00774 }
00775
00776
00777 QString KCardDialog::cardDir(const QString& name)
00778 {
00779 KCardDialog::init();
00780 if (!ds.cardInfo.contains(name)) return QString();
00781 KCardInfo v = ds.cardInfo.value(name);
00782 return v.path;
00783 }
00784
00785
00786 bool KCardDialog::isSVGCard(const QString& name)
00787 {
00788 KCardDialog::init();
00789 if (!ds.cardInfo.contains(name)) return false;
00790 KCardInfo v = ds.cardInfo.value(name);
00791 return !v.svgfile.isNull();
00792 }
00793
00794
00795 bool KCardDialog::isSVGDeck(const QString& name)
00796 {
00797 KCardDialog::init();
00798 if (!ds.deckInfo.contains(name)) return false;
00799 KCardInfo v = ds.deckInfo.value(name);
00800 return !v.svgfile.isNull();
00801 }
00802
00803 #include "kcarddialog.moc"