4 * John Levon, moz@compsoc.man.ac.uk
7 /***************************************************************************
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. *
14 ***************************************************************************/
16 #include "formcitationdialog.h"
18 FormCitationDialog::FormCitationDialog(FormCitation *form, QWidget *parent, const char *name, bool, WFlags)
19 : QDialog(parent,name,false), form_(form)
26 labelchosen = new QLabel(this);
27 labelchosen->setText(_("Selected keys"));
28 labelchosen->setMinimumSize(labelchosen->sizeHint());
29 labelchosen->setMaximumSize(labelchosen->sizeHint());
31 chosen = new QListBox(this);
33 labelkeys = new QLabel(this);
34 labelkeys->setText(_("Available keys"));
35 labelkeys->setMinimumSize(labelkeys->sizeHint());
36 labelkeys->setMaximumSize(labelkeys->sizeHint());
38 keys = new QListBox(this);
40 labelentry = new QLabel(this);
41 labelentry->setText(_("Reference entry"));
42 labelentry->setMinimumSize(labelentry->sizeHint());
43 labelentry->setMaximumSize(labelentry->sizeHint());
45 after = new QLineEdit(this);
46 after->setMinimumSize(after->sizeHint());
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 labelafter->setMinimumSize(labelafter->sizeHint());
56 labelafter->setMaximumSize(labelafter->sizeHint());
59 add = new QPushButton(this);
60 add->setText(_("&Add"));
61 add->setMinimumSize(add->sizeHint());
62 add->setMaximumSize(add->sizeHint());
64 up = new QPushButton(this);
65 up->setText(_("&Up"));
66 up->setMinimumSize(up->sizeHint());
67 up->setMaximumSize(up->sizeHint());
69 down = new QPushButton(this);
70 down->setText(_("&Down"));
71 down->setMinimumSize(down->sizeHint());
72 down->setMaximumSize(down->sizeHint());
74 remove = new QPushButton(this);
75 remove->setText(_("&Remove"));
76 remove->setMinimumSize(remove->sizeHint());
77 remove->setMaximumSize(remove->sizeHint());
79 buttonOk = new QPushButton(this);
80 buttonOk->setText(_("&OK"));
81 buttonOk->setDefault(true);
82 buttonOk->setMinimumSize(buttonOk->sizeHint());
83 buttonOk->setMaximumSize(buttonOk->sizeHint());
85 buttonCancel = new QPushButton(this);
86 buttonCancel->setText(_("&Cancel"));
87 buttonCancel->setMinimumSize(buttonCancel->sizeHint());
88 buttonCancel->setMaximumSize(buttonCancel->sizeHint());
92 QToolTip::add(chosen,_("Keys currently selected"));
93 QToolTip::add(keys,_("Reference keys available"));
94 QToolTip::add(entry,_("Reference entry text"));
95 QToolTip::add(after,_("Text to place after citation"));
99 topLayout = new QHBoxLayout(this,10);
101 layout = new QVBoxLayout();
102 topLayout->addLayout(layout);
103 layout->addSpacing(10);
105 browserLayout = new QHBoxLayout();
106 layout->addLayout(browserLayout,1);
108 chosenLayout = new QVBoxLayout();
109 browserLayout->addLayout(chosenLayout,1);
110 iconLayout = new QVBoxLayout();
111 browserLayout->addLayout(iconLayout,0);
112 keysLayout = new QVBoxLayout();
113 browserLayout->addLayout(keysLayout,1);
115 chosenLayout->addWidget(labelchosen, 0, AlignLeft);
116 chosenLayout->addWidget(chosen, 1);
118 iconLayout->addStretch(1);
119 iconLayout->addWidget(add,1);
120 iconLayout->addStretch(1);
121 iconLayout->addWidget(up,1);
122 iconLayout->addStretch(1);
123 iconLayout->addWidget(down,1);
124 iconLayout->addStretch(1);
125 iconLayout->addWidget(remove,1);
126 iconLayout->addStretch(1);
128 keysLayout->addWidget(labelkeys, 0, AlignLeft);
129 keysLayout->addWidget(keys, 1);
131 entryLayout = new QVBoxLayout();
132 layout->addLayout(entryLayout);
134 entryLayout->addWidget(labelentry, 0, AlignLeft);
135 entryLayout->addWidget(entry, 0);
137 afterLayout = new QHBoxLayout();
138 layout->addLayout(afterLayout);
140 afterLayout->addWidget(labelafter, 0, AlignLeft);
141 afterLayout->addWidget(after, 1);
143 buttonLayout = new QHBoxLayout();
144 layout->addLayout(buttonLayout);
146 buttonLayout->addStretch(1);
147 buttonLayout->addWidget(buttonOk, 1);
148 buttonLayout->addStretch(2);
149 buttonLayout->addWidget(buttonCancel, 1);
150 buttonLayout->addStretch(1);
154 connect(keys, SIGNAL(selected(const char *)), this, SLOT(select_key_adaptor(const char *)));
155 connect(keys, SIGNAL(highlighted(const char *)), this, SLOT(highlight_key_adaptor(const char *)));
156 connect(chosen, SIGNAL(highlighted(const char *)), this, SLOT(highlight_chosen_adaptor(const char *)));
157 connect(add, SIGNAL(clicked()), this, SLOT(add_adaptor()));
158 connect(up, SIGNAL(clicked()), this, SLOT(up_adaptor()));
159 connect(down, SIGNAL(clicked()), this, SLOT(down_adaptor()));
160 connect(remove, SIGNAL(clicked()), this, SLOT(remove_adaptor()));
161 connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply_adaptor()));
162 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(close_adaptor()));
165 void FormCitationDialog::closeEvent(QCloseEvent *e)
171 FormCitationDialog::~FormCitationDialog()