]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/formurldialog.C
Added GUII RunTime support and KDE InsetUrl-GUI support from John
[lyx.git] / src / frontends / kde / formurldialog.C
1 /*
2  * formurldialog.C
3  * (C) 2000 John Levon
4  * moz@compsoc.man.ac.uk
5  */
6
7 /***************************************************************************
8  *                                                                         *
9  *   This program is free software; you can redistribute it and/or modify  *
10  *   it under the terms of the GNU General Public License as published by  *
11  *   the Free Software Foundation; either version 2 of the License, or     *
12  *   (at your option) any later version.                                   *
13  *                                                                         *
14  ***************************************************************************/
15
16 #include "formurldialog.h"
17
18 FormUrlDialog::FormUrlDialog(FormUrl *form, QWidget *parent, const char *name, bool, WFlags)
19         : QDialog(parent,name,false), form_(form)
20 {
21         setCaption(name);
22
23         // widgets
24
25         url = new QLineEdit(this);
26         url->setMinimumSize(url->sizeHint());
27
28         urlname = new QLineEdit(this);
29         urlname->setMinimumSize(urlname->sizeHint());
30
31         labelurl = new QLabel(this);
32         labelurl->setText(_("Url :"));
33         labelurl->setMargin(5);
34         labelurl->setMinimumSize(labelurl->sizeHint());
35         labelurl->setMaximumSize(labelurl->sizeHint());
36
37         labelurlname = new QLabel(this);
38         labelurlname->setText(_("Name :"));
39         labelurlname->setMargin(5);
40         labelurlname->setMinimumSize(labelurlname->sizeHint());
41         labelurlname->setMaximumSize(labelurlname->sizeHint());
42
43         htmlurl = new QCheckBox(this);
44         htmlurl->setText(_("Generate hyperlink"));
45         htmlurl->setMinimumSize(htmlurl->sizeHint());
46         htmlurl->setMaximumSize(htmlurl->sizeHint());
47
48         buttonOk = new QPushButton(this);
49         buttonOk->setMinimumSize(buttonOk->sizeHint());
50         buttonOk->setMaximumSize(buttonOk->sizeHint());
51         buttonOk->setText(_("OK"));
52         buttonOk->setDefault(true);
53
54         buttonCancel = new QPushButton(this);
55         buttonCancel->setMinimumSize(buttonCancel->sizeHint());
56         buttonCancel->setMaximumSize(buttonCancel->sizeHint());
57         buttonCancel->setText(_("Cancel"));
58
59         // tooltips
60
61         QToolTip::add(labelurl,_("URL"));
62         QToolTip::add(url,_("URL"));
63         QToolTip::add(labelurlname,_("Name associated with the URL"));
64         QToolTip::add(urlname,_("Name associated with the URL"));
65         QToolTip::add(htmlurl,_("Output as a hyperlink ?"));
66
67         // layouts
68
69         topLayout = new QHBoxLayout(this,10);
70
71         layout = new QVBoxLayout();
72         topLayout->addLayout(layout);
73         layout->addSpacing(10);
74         
75         urlLayout = new QHBoxLayout();
76         layout->addLayout(urlLayout);
77         urlLayout->addWidget(labelurl, 0);
78         urlLayout->addWidget(url, 1);
79
80         urlnameLayout = new QHBoxLayout();
81         layout->addLayout(urlnameLayout);
82         urlnameLayout->addWidget(labelurlname, 0);
83         urlnameLayout->addWidget(urlname, 1);
84
85         htmlurlLayout = new QHBoxLayout();
86         layout->addStretch(1);
87         layout->addLayout(htmlurlLayout);
88         layout->addStretch(1);
89         htmlurlLayout->addWidget(htmlurl);
90         htmlurlLayout->addStretch(1);
91
92         buttonLayout = new QHBoxLayout();
93         layout->addLayout(buttonLayout);
94         buttonLayout->addStretch(1);
95         buttonLayout->addWidget(buttonOk, 1);
96         buttonLayout->addStretch(2);
97         buttonLayout->addWidget(buttonCancel, 1);
98         buttonLayout->addStretch(1);
99
100         // connections
101
102         connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply_gate()));
103         connect(buttonCancel, SIGNAL(clicked()), this, SLOT(close_gate()));
104 }
105
106 void FormUrlDialog::closeEvent(QCloseEvent *e)
107 {
108         form_->close();
109         e->accept();
110 }
111
112 FormUrlDialog::~FormUrlDialog()
113 {
114 }