summaryrefslogtreecommitdiffstats
path: root/src/modules/dcc/dialogs.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 02:13:59 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 02:13:59 +0000
commita6d58bb6052ac8cb01805a48c4ad2f129126116f (patch)
treedd867a099fcbb263a8009a9fb22695b87855dad6 /src/modules/dcc/dialogs.cpp
downloadkvirc-a6d58bb6052ac8cb01805a48c4ad2f129126116f.tar.gz
kvirc-a6d58bb6052ac8cb01805a48c4ad2f129126116f.zip
Added KDE3 version of kvirc
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1095341 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/modules/dcc/dialogs.cpp')
-rw-r--r--src/modules/dcc/dialogs.cpp206
1 files changed, 206 insertions, 0 deletions
diff --git a/src/modules/dcc/dialogs.cpp b/src/modules/dcc/dialogs.cpp
new file mode 100644
index 00000000..0ec0afba
--- /dev/null
+++ b/src/modules/dcc/dialogs.cpp
@@ -0,0 +1,206 @@
+//
+// File : dialogs.cpp
+// Creation date : Tue Sep 19 09 2000 15:23:12 by Szymon Stefanek
+//
+// This file is part of the KVirc irc client distribution
+// Copyright (C) 1999-2000 Szymon Stefanek (pragma at kvirc dot net)
+//
+// 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 the Free Software Foundation; either version 2
+// of the License, or (at your opinion) any later version.
+//
+// This program is distributed in the HOPE that it will be USEFUL,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, write to the Free Software Foundation,
+// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+#include "dialogs.h"
+
+#include "kvi_locale.h"
+#include "kvi_iconmanager.h"
+#include "kvi_app.h"
+
+#include <qlayout.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
+#include <qstringlist.h>
+#include <qevent.h>
+#include <qdesktopwidget.h>
+
+KviDccBox::KviDccBox(KviDccBroker * br,KviDccDescriptor * dcc)
+{
+ m_pDescriptor = dcc;
+ m_pBroker = br;
+}
+
+KviDccBox::~KviDccBox()
+{
+ if(m_pDescriptor)delete m_pDescriptor;
+ m_pDescriptor = 0;
+ m_pBroker->unregisterDccBox(this);
+}
+
+void KviDccBox::forgetDescriptor()
+{
+ m_pDescriptor = 0;
+}
+
+KviDccAcceptBox::KviDccAcceptBox(KviDccBroker * br,KviDccDescriptor * dcc,const QString &text,const QString &capt)
+: QWidget(0,"dcc_accept_box") , KviDccBox(br,dcc)
+{
+ QVBoxLayout * vb = new QVBoxLayout(this,4,4);
+ QLabel * l = new QLabel(text,this);
+#ifdef COMPILE_USE_QT4
+ l->setWordWrap(true);
+#endif
+ vb->addWidget(l);
+ QHBoxLayout *hb = new QHBoxLayout(4);
+ vb->addLayout(hb,Qt::AlignCenter);
+ QPushButton * btn = new QPushButton(__tr2qs_ctx("&Accept","dcc"),this);
+ btn->setDefault(true);
+ //btn->setFocus();
+ hb->addWidget(btn);
+ connect(btn,SIGNAL(clicked()),this,SLOT(acceptClicked()));
+ btn = new QPushButton(__tr2qs_ctx("&Reject","dcc"),this);
+ connect(btn,SIGNAL(clicked()),this,SLOT(rejectClicked()));
+ hb->addWidget(btn);
+
+ setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_DCCMSG)));
+ setCaption(capt);
+
+ l->setActiveWindow();
+ l->setFocus();
+}
+
+KviDccAcceptBox::~KviDccAcceptBox()
+{
+}
+
+void KviDccAcceptBox::acceptClicked()
+{
+ hide();
+ emit accepted(this,m_pDescriptor);
+ g_pApp->collectGarbage(this);
+}
+
+void KviDccAcceptBox::rejectClicked()
+{
+ hide();
+ emit rejected(this,m_pDescriptor);
+ g_pApp->collectGarbage(this);
+}
+
+void KviDccAcceptBox::closeEvent(QCloseEvent *e)
+{
+ hide();
+ e->ignore();
+ emit rejected(this,m_pDescriptor);
+ g_pApp->collectGarbage(this);
+}
+
+void KviDccAcceptBox::showEvent(QShowEvent *e)
+{
+ move((g_pApp->desktop()->width() - width()) >> 1,
+ (g_pApp->desktop()->height() - height()) >> 1);
+ QWidget::showEvent(e);
+}
+
+
+
+
+KviDccRenameBox::KviDccRenameBox(KviDccBroker * br,KviDccDescriptor * dcc,const QString &text,bool bDisableResume)
+: QWidget(0,"dcc_rename_box") , KviDccBox(br,dcc)
+{
+ QVBoxLayout * vb = new QVBoxLayout(this,4,4);
+ QLabel * l = new QLabel(text,this);
+#ifdef COMPILE_USE_QT4
+ l->setWordWrap(true);
+#endif
+ vb->addWidget(l);
+
+ QHBoxLayout *hb = new QHBoxLayout(4);
+ vb->addLayout(hb,Qt::AlignCenter);
+
+ QPushButton * btn = new QPushButton(__tr2qs_ctx("&Rename","dcc"),this);
+ hb->addWidget(btn);
+ connect(btn,SIGNAL(clicked()),this,SLOT(renameClicked()));
+
+ btn = new QPushButton(__tr2qs_ctx("Over&write","dcc"),this);
+ hb->addWidget(btn);
+ connect(btn,SIGNAL(clicked()),this,SLOT(overwriteClicked()));
+
+ btn = new QPushButton(__tr2qs_ctx("Re&sume","dcc"),this);
+ hb->addWidget(btn);
+ connect(btn,SIGNAL(clicked()),this,SLOT(resumeClicked()));
+ if(bDisableResume)btn->setEnabled(false);
+
+ btn = new QPushButton(__tr2qs_ctx("Cancel","dcc"),this);
+ hb->addWidget(btn);
+ connect(btn,SIGNAL(clicked()),this,SLOT(cancelClicked()));
+ btn->setDefault(true);
+ //btn->setFocus();
+
+ setIcon(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_DCCMSG)));
+ setCaption(__tr2qs_ctx("File Already Exists - KVIrc","dcc"));
+}
+
+KviDccRenameBox::~KviDccRenameBox()
+{
+}
+
+void KviDccRenameBox::closeEvent(QCloseEvent *e)
+{
+ hide();
+ e->ignore();
+ if(m_pDescriptor)
+ {
+ emit cancelSelected(this,m_pDescriptor);
+ g_pApp->collectGarbage(this);
+ }
+}
+
+void KviDccRenameBox::showEvent(QShowEvent *e)
+{
+ move((g_pApp->desktop()->width() - width()) >> 1,
+ (g_pApp->desktop()->height() - height()) >> 1);
+ QWidget::showEvent(e);
+}
+
+void KviDccRenameBox::renameClicked()
+{
+ hide();
+ emit renameSelected(this,m_pDescriptor);
+ g_pApp->collectGarbage(this);
+}
+
+void KviDccRenameBox::overwriteClicked()
+{
+ hide();
+ emit overwriteSelected(this,m_pDescriptor);
+ g_pApp->collectGarbage(this);
+}
+
+void KviDccRenameBox::resumeClicked()
+{
+ hide();
+ m_pDescriptor->bResume = true;
+ emit overwriteSelected(this,m_pDescriptor);
+ g_pApp->collectGarbage(this);
+}
+
+void KviDccRenameBox::cancelClicked()
+{
+ hide();
+ emit cancelSelected(this,m_pDescriptor);
+ g_pApp->collectGarbage(this);
+}
+
+
+
+
+#include "m_dialogs.moc"