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