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

Revision 6406, 3.0 kB (checked in by flynd, 5 months ago)

More uin removed from the plugins.

  • 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) 2002-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 "reqauthdlg.h"
22
23#include "config.h"
24
25#include <QDialogButtonBox>
26#include <QGroupBox>
27#include <QHBoxLayout>
28#include <QLabel>
29#include <QLineEdit>
30#include <QPushButton>
31#include <QTextCodec>
32#include <QVBoxLayout>
33
34#include <licq_icqd.h>
35
36#include "helpers/support.h"
37#include "helpers/usercodec.h"
38
39#include "widgets/mledit.h"
40
41using namespace LicqQtGui;
42/* TRANSLATOR LicqQtGui::ReqAuthDlg */
43
44ReqAuthDlg::ReqAuthDlg(QString id, unsigned long /* ppid */, QWidget* parent)
45  : QDialog(parent)
46{
47  Support::setWidgetProps(this, "RequestAuthDialog");
48  setAttribute(Qt::WA_DeleteOnClose, true);
49  setWindowTitle(tr("Licq - Request Authorization"));
50
51  QVBoxLayout* toplay = new QVBoxLayout(this);
52
53  lblUin = new QLabel(this);
54  lblUin->setAlignment(Qt::AlignCenter);
55  lblUin->setText(tr("Request authorization from (UIN):"));
56  edtUin = new QLineEdit(this);
57  edtUin->setMinimumWidth(90);
58  connect (edtUin, SIGNAL(returnPressed()), SLOT(ok()) );
59  QHBoxLayout* lay = new QHBoxLayout();
60  lay->addWidget(lblUin);
61  lay->addWidget(edtUin);
62
63  toplay->addLayout(lay);
64  toplay->addSpacing(6);
65
66  grpRequest = new QGroupBox(tr("Request"), this);
67  toplay->addWidget(grpRequest);
68  toplay->setStretchFactor(grpRequest, 2);
69
70  QVBoxLayout* layRequest = new QVBoxLayout(grpRequest);
71  mleRequest = new MLEdit(true);
72  mleRequest->setSizeHintLines(5);
73  layRequest->addWidget(mleRequest);
74
75  QDialogButtonBox* buttons = new QDialogButtonBox();
76  btnOk = buttons->addButton(QDialogButtonBox::Ok);
77  btnCancel = buttons->addButton(QDialogButtonBox::Cancel);
78
79  connect (mleRequest, SIGNAL(ctrlEnterPressed()), this, SLOT(ok()));
80  connect (btnOk, SIGNAL(clicked()), SLOT(ok()) );
81  connect (btnCancel, SIGNAL(clicked()), SLOT(close()) );
82
83  toplay->addWidget(buttons);
84
85  if (!id.isEmpty())
86  {
87    edtUin->setText(id);
88    mleRequest->setFocus();
89  }
90  else
91    edtUin->setFocus();
92
93  show();
94}
95
96void ReqAuthDlg::ok()
97{
98  QString id = edtUin->text();
99
100  if (!id.isEmpty())
101  {
102    //TODO add a drop down list for protocol
103    QTextCodec* codec = UserCodec::codecForProtoUser(id, LICQ_PPID);
104    gLicqDaemon->icqRequestAuth(id.toLatin1().data(),
105      codec->fromUnicode(mleRequest->toPlainText()));
106    close();
107  }
108}
Note: See TracBrowser for help on using the browser.