]> git.lyx.org Git - lyx.git/blob - src/frontends/kde/citationdlg.C
small cleanup, doxygen, formatting changes
[lyx.git] / src / frontends / kde / citationdlg.C
1 /**
2  * \file citationdlg.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author John Levon
7  */
8
9 #include <config.h>
10
11 #include "dlg/helpers.h"
12 #include "citationdlg.h"
13
14 #ifdef CXX_WORKING_NAMESPACES
15 using kde_helpers::setSizeHint;
16 #endif
17
18 CitationDialog::CitationDialog(FormCitation *form, QWidget *parent, char const * name, bool, WFlags)
19         : QDialog(parent,name,0), form_(form)
20 {
21         setCaption(name);
22         setMinimumWidth(500);
23
24         // widgets
25
26         labelchosen = new QLabel(this);
27         labelchosen->setText(_("Selected keys"));
28         setSizeHint(labelchosen);
29         labelchosen->setMaximumSize(labelchosen->sizeHint());
30
31         chosen = new QListBox(this);
32
33         labelkeys = new QLabel(this);
34         labelkeys->setText(_("Available keys"));
35         setSizeHint(labelkeys);
36         labelkeys->setMaximumSize(labelkeys->sizeHint());
37
38         keys = new QListBox(this);
39
40         labelentry = new QLabel(this);
41         labelentry->setText(_("Reference entry"));
42         setSizeHint(labelentry);
43         labelentry->setMaximumSize(labelentry->sizeHint());
44
45         after = new QLineEdit(this);
46         setSizeHint(after);
47
48         entry = new QMultiLineEdit(this);
49         entry->setReadOnly(true);
50         entry->setFixedVisibleLines(2); 
51
52         labelafter = new QLabel(this);
53         labelafter->setText(_("Text after"));
54         labelafter->setMargin(5);
55         setSizeHint(labelafter);
56         labelafter->setMaximumSize(labelafter->sizeHint());
57
58         add = new QPushButton(this); 
59         add->setText(_("&Add"));
60         setSizeHint(add); 
61         add->setMaximumSize(add->sizeHint());
62  
63         up = new QPushButton(this); 
64         up->setText(_("&Up"));
65         setSizeHint(up); 
66         up->setMaximumSize(up->sizeHint());
67  
68         down = new QPushButton(this); 
69         down->setText(_("&Down"));
70         setSizeHint(down); 
71         down->setMaximumSize(down->sizeHint());
72  
73         remove = new QPushButton(this); 
74         remove->setText(_("&Remove"));
75         setSizeHint(remove); 
76         remove->setMaximumSize(remove->sizeHint());
77
78         buttonOk = new QPushButton(this);
79         buttonOk->setText(_("&OK"));
80         buttonOk->setDefault(true);
81         setSizeHint(buttonOk); 
82         buttonOk->setMaximumSize(buttonOk->sizeHint());
83
84         buttonCancel = new QPushButton(this);
85         buttonCancel->setText(_("&Cancel"));
86         setSizeHint(buttonCancel); 
87         buttonCancel->setMaximumSize(buttonCancel->sizeHint());
88
89         // tooltips
90
91         QToolTip::add(chosen,_("Keys currently selected"));
92         QToolTip::add(keys,_("Reference keys available"));
93         QToolTip::add(entry,_("Reference entry text"));
94         QToolTip::add(after,_("Text to place after citation"));
95
96         // layouts
97
98         topLayout = new QHBoxLayout(this,10);
99
100         layout = new QVBoxLayout();
101         topLayout->addLayout(layout);
102         layout->addSpacing(10);
103
104         browserLayout = new QHBoxLayout();
105         layout->addLayout(browserLayout,1);
106
107         chosenLayout = new QVBoxLayout();
108         browserLayout->addLayout(chosenLayout,1); 
109         iconLayout = new QVBoxLayout();
110         browserLayout->addLayout(iconLayout,0);
111         keysLayout = new QVBoxLayout();
112         browserLayout->addLayout(keysLayout,1);
113  
114         chosenLayout->addWidget(labelchosen, 0, AlignLeft);
115         chosenLayout->addWidget(chosen, 1);
116  
117         iconLayout->addStretch(1);
118         iconLayout->addWidget(add,1);
119         iconLayout->addStretch(1);
120         iconLayout->addWidget(up,1);
121         iconLayout->addStretch(1);
122         iconLayout->addWidget(down,1);
123         iconLayout->addStretch(1);
124         iconLayout->addWidget(remove,1);
125         iconLayout->addStretch(1);
126  
127         keysLayout->addWidget(labelkeys, 0, AlignLeft);
128         keysLayout->addWidget(keys, 1);
129
130         entryLayout = new QVBoxLayout();
131         layout->addLayout(entryLayout);
132  
133         entryLayout->addWidget(labelentry, 0, AlignLeft);
134         entryLayout->addWidget(entry, 0);
135
136         afterLayout = new QHBoxLayout();
137         layout->addLayout(afterLayout);
138
139         afterLayout->addWidget(labelafter, 0, AlignLeft);
140         afterLayout->addWidget(after, 1);
141  
142         buttonLayout = new QHBoxLayout();
143         layout->addLayout(buttonLayout);
144  
145         buttonLayout->addStretch(1);
146         buttonLayout->addWidget(buttonOk, 1);
147         buttonLayout->addStretch(2);
148         buttonLayout->addWidget(buttonCancel, 1);
149         buttonLayout->addStretch(1);
150  
151         // connections
152
153         connect(keys, SIGNAL(selected(const char *)), this, SLOT(select_key_adaptor(const char *)));
154         connect(keys, SIGNAL(highlighted(const char *)), this, SLOT(highlight_key_adaptor(const char *)));
155         connect(chosen, SIGNAL(highlighted(const char *)), this, SLOT(highlight_chosen_adaptor(const char *)));
156         connect(add, SIGNAL(clicked()), this, SLOT(add_adaptor()));
157         connect(up, SIGNAL(clicked()), this, SLOT(up_adaptor()));
158         connect(down, SIGNAL(clicked()), this, SLOT(down_adaptor()));   
159         connect(remove, SIGNAL(clicked()), this, SLOT(remove_adaptor()));
160         connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply_adaptor()));
161         connect(buttonCancel, SIGNAL(clicked()), this, SLOT(close_adaptor()));
162         
163         resize(sizeHint());
164 }
165
166
167 CitationDialog::~CitationDialog()
168 {
169 }
170
171
172 void CitationDialog::closeEvent(QCloseEvent * e)
173 {
174         form_->close();
175         e->accept();
176 }