Summary: | Kpoker: When you save a game and then immediately quit, kpoker asks if you want to save the game anyway | ||
---|---|---|---|
Product: | [Unmaintained] kpoker | Reporter: | Inge Wallin <inge> |
Component: | general | Assignee: | Inge Wallin <inge> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Inge Wallin
2004-08-31 20:43:11 UTC
CVS commit by ingwa: Fix bug 88548: When you save a game and then immediately quit, kpoker asks if you want to save the game anyway. CCMAIL: 88548-done@bugs.kde.org M +7 -0 ChangeLog 1.20 M +10 -0 kpoker.cpp 1.77 M +4 -2 kpoker.h 1.36 M +4 -0 top.cpp 1.45 --- kdegames/kpoker/ChangeLog #1.19:1.20 @@ -1,2 +1,9 @@ +2004-09-03 Inge Wallin <inge@lysator.liu.se> + + Fix bug 88548: Kpoker: When you save a game and then immediately + quit, kpoker asks if you want to save the game anyway + * kpoker::isDirty: New member + * misc: set and use isDirty + 2004-09-01 Inge Wallin <inge@lysator.liu.se> --- kdegames/kpoker/kpoker.cpp #1.76:1.77 @@ -77,4 +77,6 @@ kpok::kpok(QWidget *parent, const char * initSound(); + m_isDirty = false; + if (!readEntriesAndInitPoker()) exit(0); @@ -145,4 +147,5 @@ void kpok::newGame() playerBox[i]->showName(); m_activePlayers.at(i)->setCash((newGameDlg->money() >= m_minBet) ? newGameDlg->money() : START_MONEY); + m_isDirty = true; } paintCash(); @@ -581,4 +584,6 @@ void kpok::displayWinner_Computer(Player winner->setCash(winner->getCash() + m_pot); + m_isDirty = true; + QString label; if (winner->getHuman()) @@ -818,4 +823,5 @@ void kpok::displayWin(const QString& han setHand(hand); m_activePlayers.at(0)->setCash(m_activePlayers.at(0)->getCash() + cashWon); + m_isDirty = true; paintCash(); @@ -997,4 +1003,5 @@ bool kpok::readEntriesAndInitPoker() newPlayers[i].setName(newGameDlg->name(i)); newPlayers[i].setCash(newGameDlg->money()); + m_isDirty = true; } } @@ -1064,4 +1071,6 @@ void kpok::saveGame(KConfig* conf) conf->writeEntry(QString("Cash_%1").arg(i), m_players[i].getCash()); } + + m_isDirty = 0; } @@ -1170,4 +1179,5 @@ bool kpok::loadGame(KConfig* conf) START_MONEY); newPlayers[i].setCash(cash); + m_isDirty = true; } oldGame = true; --- kdegames/kpoker/kpoker.h #1.35:1.36 @@ -75,4 +75,5 @@ class kpok : public QWidget int getPlayers() const { return m_activePlayers.count(); } PokerGameState getState() const { return m_state; } + bool isDirty() const { return m_isDirty; } void setState(PokerGameState newState) { m_state = newState; } @@ -227,5 +228,6 @@ class kpok : public QWidget // The "document" - players and the game itself int m_numPlayers; // used for constructing and deleting only - Player *m_players; //the players + Player *m_players; // the players + bool m_isDirty; // True if we need to save before exiting. PokerGameState m_state; --- kdegames/kpoker/top.cpp #1.44:1.45 @@ -167,4 +167,8 @@ void PokerWindow::toggleStatusbar() bool PokerWindow::queryClose() { + if (!m_kpok->isDirty()) + return true; + + // Only ask if the game is changed some way. switch(KMessageBox::warningYesNoCancel(this, i18n("Do you want to save this game?"))) { case KMessageBox::Yes : |