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 ***************************************************************************/
18 #include "dlg/helpers.h"
19 #include "citationdlg.h"
21 #ifdef CXX_WORKING_NAMESPACES
22 using kde_helpers::setSizeHint;
25 CitationDialog::CitationDialog(FormCitation *form, QWidget *parent, const char *name, bool, WFlags)
26 : QWidget(parent,name,0), form_(form)
33 labelchosen = new QLabel(this);
34 labelchosen->setText(_("Selected keys"));
35 setSizeHint(labelchosen);
36 labelchosen->setMaximumSize(labelchosen->sizeHint());
38 chosen = new QListBox(this);
40 labelkeys = new QLabel(this);
41 labelkeys->setText(_("Available keys"));
42 setSizeHint(labelkeys);
43 labelkeys->setMaximumSize(labelkeys->sizeHint());
45 keys = new QListBox(this);
47 labelentry = new QLabel(this);
48 labelentry->setText(_("Reference entry"));
49 setSizeHint(labelentry);
50 labelentry->setMaximumSize(labelentry->sizeHint());
52 after = new QLineEdit(this);
55 entry = new QMultiLineEdit(this);
56 entry->setReadOnly(true);
57 entry->setFixedVisibleLines(2);
59 labelafter = new QLabel(this);
60 labelafter->setText(_("Text after"));
61 labelafter->setMargin(5);
62 setSizeHint(labelafter);
63 labelafter->setMaximumSize(labelafter->sizeHint());
66 add = new QPushButton(this);
67 add->setText(_("&Add"));
69 add->setMaximumSize(add->sizeHint());
71 up = new QPushButton(this);
72 up->setText(_("&Up"));
74 up->setMaximumSize(up->sizeHint());
76 down = new QPushButton(this);
77 down->setText(_("&Down"));
79 down->setMaximumSize(down->sizeHint());
81 remove = new QPushButton(this);
82 remove->setText(_("&Remove"));
84 remove->setMaximumSize(remove->sizeHint());
86 buttonOk = new QPushButton(this);
87 buttonOk->setText(_("&OK"));
88 buttonOk->setDefault(true);
89 setSizeHint(buttonOk);
90 buttonOk->setMaximumSize(buttonOk->sizeHint());
92 buttonCancel = new QPushButton(this);
93 buttonCancel->setText(_("&Cancel"));
94 setSizeHint(buttonCancel);
95 buttonCancel->setMaximumSize(buttonCancel->sizeHint());
99 QToolTip::add(chosen,_("Keys currently selected"));
100 QToolTip::add(keys,_("Reference keys available"));
101 QToolTip::add(entry,_("Reference entry text"));
102 QToolTip::add(after,_("Text to place after citation"));
106 topLayout = new QHBoxLayout(this,10);
108 layout = new QVBoxLayout();
109 topLayout->addLayout(layout);
110 layout->addSpacing(10);
112 browserLayout = new QHBoxLayout();
113 layout->addLayout(browserLayout,1);
115 chosenLayout = new QVBoxLayout();
116 browserLayout->addLayout(chosenLayout,1);
117 iconLayout = new QVBoxLayout();
118 browserLayout->addLayout(iconLayout,0);
119 keysLayout = new QVBoxLayout();
120 browserLayout->addLayout(keysLayout,1);
122 chosenLayout->addWidget(labelchosen, 0, AlignLeft);
123 chosenLayout->addWidget(chosen, 1);
125 iconLayout->addStretch(1);
126 iconLayout->addWidget(add,1);
127 iconLayout->addStretch(1);
128 iconLayout->addWidget(up,1);
129 iconLayout->addStretch(1);
130 iconLayout->addWidget(down,1);
131 iconLayout->addStretch(1);
132 iconLayout->addWidget(remove,1);
133 iconLayout->addStretch(1);
135 keysLayout->addWidget(labelkeys, 0, AlignLeft);
136 keysLayout->addWidget(keys, 1);
138 entryLayout = new QVBoxLayout();
139 layout->addLayout(entryLayout);
141 entryLayout->addWidget(labelentry, 0, AlignLeft);
142 entryLayout->addWidget(entry, 0);
144 afterLayout = new QHBoxLayout();
145 layout->addLayout(afterLayout);
147 afterLayout->addWidget(labelafter, 0, AlignLeft);
148 afterLayout->addWidget(after, 1);
150 buttonLayout = new QHBoxLayout();
151 layout->addLayout(buttonLayout);
153 buttonLayout->addStretch(1);
154 buttonLayout->addWidget(buttonOk, 1);
155 buttonLayout->addStretch(2);
156 buttonLayout->addWidget(buttonCancel, 1);
157 buttonLayout->addStretch(1);
161 connect(keys, SIGNAL(selected(const char *)), this, SLOT(select_key_adaptor(const char *)));
162 connect(keys, SIGNAL(highlighted(const char *)), this, SLOT(highlight_key_adaptor(const char *)));
163 connect(chosen, SIGNAL(highlighted(const char *)), this, SLOT(highlight_chosen_adaptor(const char *)));
164 connect(add, SIGNAL(clicked()), this, SLOT(add_adaptor()));
165 connect(up, SIGNAL(clicked()), this, SLOT(up_adaptor()));
166 connect(down, SIGNAL(clicked()), this, SLOT(down_adaptor()));
167 connect(remove, SIGNAL(clicked()), this, SLOT(remove_adaptor()));
168 connect(buttonOk, SIGNAL(clicked()), this, SLOT(apply_adaptor()));
169 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(close_adaptor()));
174 CitationDialog::~CitationDialog()
178 void CitationDialog::closeEvent(QCloseEvent *e)