root/trunk/qt4-gui/src/dialogs/refusedlg.cpp

Revision 6463, 2.2 kB (checked in by flynd, 4 months ago)

Use a const pointer for user objects that are only fetched for read access. Fixed some places where we changed the user even though we just had a read lock.

  • Property svn:eol-style set to native
Line 
1// -*- c-basic-offset: 2 -*-
2/*
3 * This file is part of Licq, an instant messaging client for UNIX.
4 * Copyright (C) 2000-2006 Licq developers
5 *
6 * Licq is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * Licq is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Licq; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19 */
20
21#include "refusedlg.h"
22
23#include "config.h"
24
25#include <QDialogButtonBox>
26#include <QGridLayout>
27#include <QLabel>
28#include <QPushButton>
29
30#include <licq_user.h>
31
32#include "helpers/support.h"
33
34#include "widgets/mledit.h"
35
36using namespace LicqQtGui;
37/* TRANSLATOR LicqQtGui::RefuseDlg */
38
39RefuseDlg::RefuseDlg(QString id, unsigned long ppid, QString t, QWidget* parent)
40   : QDialog(parent)
41{
42  Support::setWidgetProps(this, "RefuseDialog");
43  setModal(true);
44
45  QVBoxLayout* lay = new QVBoxLayout(this);
46
47  const ICQUser* u = gUserManager.FetchUser(id.toLatin1(), ppid, LOCK_R);
48  QLabel* lbl = new QLabel(tr("Refusal message for %1 with ").arg(t) + QString::fromUtf8(u->GetAlias()) + ":");
49  lay->addWidget(lbl);
50  gUserManager.DropUser(u);
51
52  mleRefuseMsg = new MLEdit(true);
53  mleRefuseMsg->setSizeHintLines(5);
54  lay->addWidget(mleRefuseMsg);
55
56  QDialogButtonBox* buttons = new QDialogButtonBox();
57  lay->addWidget(buttons);
58
59  QPushButton* btnRefuse = new QPushButton(tr("Refuse"));
60  buttons->addButton(btnRefuse, QDialogButtonBox::AcceptRole);
61  connect( btnRefuse, SIGNAL(clicked()), SLOT(accept()) );
62
63  QPushButton* btnCancel = new QPushButton(tr("Cancel"));
64  buttons->addButton(btnCancel, QDialogButtonBox::RejectRole);
65  connect( btnCancel, SIGNAL(clicked()), SLOT(reject()) );
66
67  setWindowTitle(tr("Licq %1 Refusal").arg(t));
68}
69
70QString RefuseDlg::RefuseMessage()
71{
72  return mleRefuseMsg->toPlainText();
73}
Note: See TracBrowser for help on using the browser.