]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/urldlg.C
Move LaTeX and VC logs to GUI-I on xforms
[lyx.git] / src / frontends / kde / urldlg.C
1 /*
2  * urldlg.C
3  * (C) 2000 LyX Team
4  * John Levon, 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 <config.h>
17 #include "urldlg.h"
18
19 #include "dlg/helpers.h"
20
21 #ifdef CXX_WORKING_NAMESPACES
22 using kde_helpers::setSizeHint;
23 #endif
24
25 UrlDialog::UrlDialog(FormUrl *form, QWidget *parent, const char *name, bool, WFlags)
26         : QWidget(parent,name,0), form_(form)
27 {
28         setCaption(name);
29
30         // widgets
31
32         url = new QLineEdit(this);
33         setSizeHint(url);
34
35         urlname = new QLineEdit(this);
36         setSizeHint(urlname);
37
38         labelurl = new QLabel(this);
39         labelurl->setText(_("Url :"));
40         labelurl->setMargin(5);
41         setSizeHint(labelurl);
42         labelurl->setMaximumSize(labelurl->sizeHint());
43
44         labelurlname = new QLabel(this);
45         labelurlname->setText(_("Name :"));
46         labelurlname->setMargin(5);
47         setSizeHint(labelurlname);
48         labelurlname->setMaximumSize(labelurlname->sizeHint());
49
50         htmlurl = new QCheckBox(this);
51         htmlurl->setText(_("Generate hyperlink"));
52         setSizeHint(htmlurl);
53         htmlurl->setMaximumSize(htmlurl->sizeHint());
54
55         buttonOk = new QPushButton(this);
56         setSizeHint(buttonOk);
57         buttonOk->setMaximumSize(buttonOk->sizeHint());
58         buttonOk->setText(_("&OK"));
59         buttonOk->setDefault(true);
60
61         buttonCancel = new QPushButton(this);
62         setSizeHint(buttonCancel);
63         buttonCancel->setMaximumSize(buttonCancel->sizeHint());
64         buttonCancel->setText(_("&Cancel"));
65
66         // tooltips
67
68         QToolTip::add(labelurl,_("URL"));
69         QToolTip::add(url,_("URL"));
70         QToolTip::add(labelurlname,_("Name associated with the URL"));
71         QToolTip::add(urlname,_("Name associated with the URL"));
72         QToolTip::add(htmlurl,_("Output as a hyperlink ?"));
73
74         // layouts
75
76         topLayout = new QHBoxLayout(this,10);
77
78         layout = new QVBoxLayout();
79         topLayout->addLayout(layout);
80         layout->addSpacing(10);
81         
82         urlLayout = new QHBoxLayout();
83         layout->addLayout(urlLayout);
84         urlLayout->addWidget(labelurl, 0);
85         urlLayout->addWidget(url, 1);
86
87         urlnameLayout = new QHBoxLayout();
88         layout->addLayout(urlnameLayout);
89         urlnameLayout->addWidget(labelurlname, 0);
90         urlnameLayout->addWidget(urlname, 1);
91
92         htmlurlLayout = new QHBoxLayout();
93         layout->addStretch(1);
94         layout->addLayout(htmlurlLayout);
95         layout->addStretch(1);
96         htmlurlLayout->addWidget(htmlurl);
97         htmlurlLayout->addStretch(1);
98
99         buttonLayout = new QHBoxLayout();
100         layout->addLayout(buttonLayout);
101         buttonLayout->addStretch(1);
102         buttonLayout->addWidget(buttonOk, 1);
103         buttonLayout->addStretch(2);
104         buttonLayout->addWidget(buttonCancel, 1);
105         buttonLayout->addStretch(1);
106
107         // connections
108
109         connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply_adaptor()));
110         connect(buttonCancel, SIGNAL(clicked()), this, SLOT(close_adaptor()));
111         
112         resize(sizeHint());
113 }
114
115 UrlDialog::~UrlDialog()
116 {
117 }
118
119 void UrlDialog::closeEvent(QCloseEvent *e)
120 {
121         form_->close();
122         e->accept();
123 }