Diffstat (limited to 'noncore/games/kpacman/score.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/kpacman/score.cpp | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/noncore/games/kpacman/score.cpp b/noncore/games/kpacman/score.cpp index 17dbf0a..b3ff3d9 100644 --- a/noncore/games/kpacman/score.cpp +++ b/noncore/games/kpacman/score.cpp | |||
@@ -475,40 +475,12 @@ void Score::read() | |||
475 | 475 | ||
476 | HighScore = hallOfFame[0].points; | 476 | HighScore = hallOfFame[0].points; |
477 | } | 477 | } |
478 | 478 | ||
479 | void Score::write() | 479 | void Score::write() |
480 | { | 480 | { |
481 | #ifndef QWS | ||
482 | if (!highscoreFile.exists() && highscoreFile.name() == systemHighscoreFileInfo.filePath()) | ||
483 | KMessageBox::information(0, | ||
484 | tr("You're going to create the highscore-file\n" | ||
485 | "'%1'\n" | ||
486 | "for your maschine, that should be used systemwide.\n" | ||
487 | "\n" | ||
488 | "To grant access to the other users, set the appropriate rights (a+w)\n" | ||
489 | "on that file or ask your systemadministator for that favor.\n" | ||
490 | "\n" | ||
491 | "To use a different directory or filename for the highscores," | ||
492 | "specify them in the configfile (kpacmanrc:highscoreFilePath)." | ||
493 | ).arg(systemHighscoreFileInfo.filePath())); | ||
494 | |||
495 | if (highscoreFile.name() == privateHighscoreFileInfo.filePath()) | ||
496 | KMessageBox::information(0, | ||
497 | tr("You're using a private highscore-file, that's mostly because of\n" | ||
498 | "missing write-access to the systemwide file\n" | ||
499 | "'%1' .\n" | ||
500 | "\n" | ||
501 | "Ask your systemadministrator for granting you access to that file,\n" | ||
502 | "by setting the appropriate rights (a+w) on it.\n" | ||
503 | "\n" | ||
504 | "To use a different directory or filename for the highscores," | ||
505 | "specify them in the configfile (kpacmanrc:highscoreFilePath)." | ||
506 | ).arg(systemHighscoreFileInfo.filePath()), | ||
507 | QString::null, "PrivateHighscore"); | ||
508 | #endif | ||
509 | if (highscoreFile.open(IO_WriteOnly)) { | 481 | if (highscoreFile.open(IO_WriteOnly)) { |
510 | QDataStream s(&highscoreFile); | 482 | QDataStream s(&highscoreFile); |
511 | for (int i = 0; i < 10; i++) | 483 | for (int i = 0; i < 10; i++) |
512 | s << hallOfFame[i].points << hallOfFame[i].levels << hallOfFame[i].duration << | 484 | s << hallOfFame[i].points << hallOfFame[i].levels << hallOfFame[i].duration << |
513 | hallOfFame[i].moment << hallOfFame[i].name.latin1(); | 485 | hallOfFame[i].moment << hallOfFame[i].name.latin1(); |
514 | highscoreFile.close(); | 486 | highscoreFile.close(); |
@@ -602,41 +574,8 @@ int Score::y(float row) | |||
602 | * der Standort der "highscore"-Datei spezifiziert werden. | 574 | * der Standort der "highscore"-Datei spezifiziert werden. |
603 | * Wenn die systemweite "highscore"-Datei nicht beschrieben werden kann, wird mit einer | 575 | * Wenn die systemweite "highscore"-Datei nicht beschrieben werden kann, wird mit einer |
604 | * privaten Datei gearbeitet. | 576 | * privaten Datei gearbeitet. |
605 | */ | 577 | */ |
606 | QFileInfo Score::locateHighscoreFilePath() | 578 | QFileInfo Score::locateHighscoreFilePath() |
607 | { | 579 | { |
608 | #ifndef QWS | ||
609 | QFileInfo systemHighscoreDirPath; | ||
610 | QStringList systemHighscoreDirs; | ||
611 | |||
612 | // Schreibfähige "private" highscore-Datei ermitteln für den fallback. | ||
613 | privateHighscoreFileInfo.setFile(KGlobal::dirs()->saveLocation("appdata")+highscoreName); | ||
614 | |||
615 | // FilePath aus der Konfigurationsdatei benutzen | ||
616 | systemHighscoreFileInfo.setFile(cfg->readEntry("HighscoreFilePath")); | ||
617 | |||
618 | // Kein Wert aus der Konfiguration erhalten, dann die "system"-Datei suchen. | ||
619 | if (systemHighscoreFileInfo.filePath().isEmpty()) | ||
620 | systemHighscoreDirs = KGlobal::dirs()->resourceDirs("appdata"); | ||
621 | else | ||
622 | systemHighscoreDirs = QStringList(systemHighscoreFileInfo.filePath()); | ||
623 | |||
624 | for (QStringList::Iterator i = systemHighscoreDirs.begin(); i != systemHighscoreDirs.end(); ++i) { | ||
625 | |||
626 | systemHighscoreFileInfo.setFile(*i); | ||
627 | if (systemHighscoreFileInfo.fileName().isEmpty()) | ||
628 | systemHighscoreFileInfo.setFile(systemHighscoreFileInfo.dirPath()+"/"+highscoreName); | ||
629 | |||
630 | // privateHighscoreFileInfo für die "system" Suche ignorieren | ||
631 | if (systemHighscoreFileInfo.filePath() != privateHighscoreFileInfo.filePath()) | ||
632 | if (!systemHighscoreFileInfo.exists()) { | ||
633 | systemHighscoreDirPath.setFile(systemHighscoreFileInfo.dirPath()); | ||
634 | if (systemHighscoreDirPath.exists() && systemHighscoreDirPath.isWritable()) | ||
635 | return systemHighscoreFileInfo; | ||
636 | } else | ||
637 | if (systemHighscoreFileInfo.isWritable()) | ||
638 | return systemHighscoreFileInfo; | ||
639 | } | ||
640 | #endif | ||
641 | return privateHighscoreFileInfo; | 580 | return privateHighscoreFileInfo; |
642 | } | 581 | } |