summaryrefslogtreecommitdiff
path: root/src/gui/windows/socialwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/socialwindow.cpp')
-rw-r--r--src/gui/windows/socialwindow.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index c8c96d4cf..c7556e58f 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -1,10 +1,10 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2010 The Mana Developers
* Copyright (C) 2011-2020 The ManaPlus Developers
- * Copyright (C) 2020-2023 The ManaVerse Developers
+ * Copyright (C) 2020-2025 The ManaVerse Developers
*
- * This file is part of The ManaPlus Client.
+ * This file is part of The ManaVerse Client.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -55,6 +55,7 @@ SocialWindow::SocialWindow() :
PlayerRelationsListener(),
mGuildInvited(0),
mGuildAcceptDialog(nullptr),
+ mGuildLeaveDialog(nullptr),
mGuildCreateDialog(nullptr),
mPartyInviter(),
mGuilds(),
@@ -159,6 +160,13 @@ SocialWindow::~SocialWindow()
mGuildInvited = 0;
}
+ if (mGuildLeaveDialog != nullptr)
+ {
+ mGuildLeaveDialog->close();
+ mGuildLeaveDialog->scheduleDelete();
+ mGuildLeaveDialog = nullptr;
+ }
+
if (mPartyAcceptDialog != nullptr)
{
mPartyAcceptDialog->close();
@@ -351,6 +359,19 @@ void SocialWindow::action(const ActionEvent &event)
mGuildInvited = 0;
mGuildAcceptDialog = nullptr;
}
+ else if (event.getSource() == mGuildLeaveDialog)
+ {
+ if (eventId == "yes")
+ {
+ if ((guildHandler != nullptr) && (localPlayer != nullptr))
+ {
+ const Guild *const guild = localPlayer->getGuild();
+ if (guild != nullptr)
+ guildHandler->leave(guild->getId());
+ }
+ }
+ mGuildLeaveDialog = nullptr;
+ }
else if (eventId == "party")
{
popupMenu->showPartyPopup();
@@ -425,6 +446,19 @@ void SocialWindow::showGuildInvite(const std::string &restrict guildName,
mGuildInvited = guildId;
}
+void SocialWindow::confirmGuildLeave()
+{
+ CREATEWIDGETV(mGuildLeaveDialog, ConfirmDialog,
+ // TRANSLATORS: guild invite message
+ _("Really leave your guild?"),
+ "",
+ SOUND_REQUEST,
+ false,
+ Modal_false,
+ this);
+ mGuildLeaveDialog->addActionListener(this);
+}
+
void SocialWindow::showPartyInvite(const std::string &restrict partyName,
const std::string &restrict inviter,
const int partyId)