3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
11 #include "dlg/helpers.h"
12 #include "citationdlg.h"
14 #ifdef CXX_WORKING_NAMESPACES
15 using kde_helpers::setSizeHint;
18 CitationDialog::CitationDialog(FormCitation *form, QWidget *parent, char const * name, bool, WFlags)
19 : QDialog(parent,name,0), form_(form)
26 labelchosen = new QLabel(this);
27 labelchosen->setText(_("Selected keys"));
28 setSizeHint(labelchosen);
29 labelchosen->setMaximumSize(labelchosen->sizeHint());
31 chosen = new QListBox(this);
33 labelkeys = new QLabel(this);
34 labelkeys->setText(_("Available keys"));
35 setSizeHint(labelkeys);
36 labelkeys->setMaximumSize(labelkeys->sizeHint());
38 keys = new QListBox(this);
40 labelentry = new QLabel(this);
41 labelentry->setText(_("Reference entry"));
42 setSizeHint(labelentry);
43 labelentry->setMaximumSize(labelentry->sizeHint());
45 after = new QLineEdit(this);
48 entry = new QMultiLineEdit(this);
49 entry->setReadOnly(true);
50 entry->setFixedVisibleLines(2);
52 labelafter = new QLabel(this);
53 labelafter->setText(_("Text after"));
54 labelafter->setMargin(5);
55 setSizeHint(labelafter);
56 labelafter->setMaximumSize(labelafter->sizeHint());
58 add = new QPushButton(this);
59 add->setText(_("&Add"));
61 add->setMaximumSize(add->sizeHint());
63 up = new QPushButton(this);
64 up->setText(_("&Up"));
66 up->setMaximumSize(up->sizeHint());
68 down = new QPushButton(this);
69 down->setText(_("&Down"));
71 down->setMaximumSize(down->sizeHint());
73 remove = new QPushButton(this);
74 remove->setText(_("&Remove"));
76 remove->setMaximumSize(remove->sizeHint());
78 buttonOk = new QPushButton(this);
79 buttonOk->setText(_("&OK"));
80 buttonOk->setDefault(true);
81 setSizeHint(buttonOk);
82 buttonOk->setMaximumSize(buttonOk->sizeHint());
84 buttonCancel = new QPushButton(this);
85 buttonCancel->setText(_("&Cancel"));
86 setSizeHint(buttonCancel);
87 buttonCancel->setMaximumSize(buttonCancel->sizeHint());
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"));
98 topLayout = new QHBoxLayout(this,10);
100 layout = new QVBoxLayout();
101 topLayout->addLayout(layout);
102 layout->addSpacing(10);
104 browserLayout = new QHBoxLayout();
105 layout->addLayout(browserLayout,1);
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);
114 chosenLayout->addWidget(labelchosen, 0, AlignLeft);
115 chosenLayout->addWidget(chosen, 1);
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);
127 keysLayout->addWidget(labelkeys, 0, AlignLeft);
128 keysLayout->addWidget(keys, 1);
130 entryLayout = new QVBoxLayout();
131 layout->addLayout(entryLayout);
133 entryLayout->addWidget(labelentry, 0, AlignLeft);
134 entryLayout->addWidget(entry, 0);
136 afterLayout = new QHBoxLayout();
137 layout->addLayout(afterLayout);
139 afterLayout->addWidget(labelafter, 0, AlignLeft);
140 afterLayout->addWidget(after, 1);
142 buttonLayout = new QHBoxLayout();
143 layout->addLayout(buttonLayout);
145 buttonLayout->addStretch(1);
146 buttonLayout->addWidget(buttonOk, 1);
147 buttonLayout->addStretch(2);
148 buttonLayout->addWidget(buttonCancel, 1);
149 buttonLayout->addStretch(1);
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()));
167 CitationDialog::~CitationDialog()
172 void CitationDialog::closeEvent(QCloseEvent * e)