]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QDocumentDialog.C
get rid of broken_header.h and some unneeded tests
[lyx.git] / src / frontends / qt2 / QDocumentDialog.C
1 /**
2  * \file QDocumentDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "QDocument.h"
14 #include "QDocumentDialog.h"
15
16 #include "floatplacement.h"
17 #include "lengthcombo.h"
18 #include "panelstack.h"
19 #include "qt_helpers.h"
20
21 #include "bufferparams.h"
22 #include "gettext.h"
23 #include "lyxrc.h"
24
25 #include "controllers/ControlDocument.h"
26
27 #include "support/lstrings.h"
28
29 #include <qlabel.h>
30 #include <qmultilineedit.h>
31 #include <qlineedit.h>
32 #include <qlistview.h>
33 #include <qpushbutton.h>
34 #include <qradiobutton.h>
35 #include <qcheckbox.h>
36 #include <qslider.h>
37 #include <qpixmap.h>
38 #include <qcolor.h>
39 #include <qcolordialog.h>
40
41 using lyx::support::token;
42
43 using std::string;
44
45 namespace lyx {
46 namespace frontend {
47
48 QDocumentDialog::QDocumentDialog(QDocument * form)
49         : QDocumentDialogBase(0, 0, false, 0), form_(form)
50 {
51         connect(okPB, SIGNAL(clicked()),
52                 form, SLOT(slotOK()));
53         connect(applyPB, SIGNAL(clicked()),
54                 form, SLOT(slotApply()));
55         connect(closePB, SIGNAL(clicked()),
56                 form, SLOT(slotClose()));
57         connect(restorePB, SIGNAL(clicked()),
58                 form, SLOT(slotRestore()));
59
60         textLayoutModule = new TextLayoutModuleBase(this);
61         pageLayoutModule = new PageLayoutModuleBase(this);
62         marginsModule = new MarginsModuleBase(this);
63         langModule = new LanguageModuleBase(this);
64         bulletsModule = new BulletsModule(this);
65         numberingModule = new NumberingModuleBase(this);
66         biblioModule = new BiblioModuleBase(this);
67         mathsModule = new MathsModuleBase(this);
68         floatModule = new FloatPlacement(this, "floatplacement");
69         latexModule = new LaTeXModuleBase(this);
70         branchesModule = new BranchesModuleBase(this);
71         preambleModule = new PreambleModuleBase(this);
72
73         docPS->addPanel(latexModule, _("Document Class"));
74         docPS->addPanel(textLayoutModule, _("Text Layout"));
75         docPS->addPanel(pageLayoutModule, _("Page Layout"));
76         docPS->addPanel(marginsModule, _("Page Margins"));
77         docPS->addPanel(langModule, _("Language"));
78         docPS->addPanel(numberingModule, _("Numbering & TOC"));
79         docPS->addPanel(biblioModule, _("Bibliography"));
80         docPS->addPanel(mathsModule, _("Math options"));
81         docPS->addPanel(floatModule, _("Float Placement"));
82         docPS->addPanel(bulletsModule, _("Bullets"));
83         docPS->addPanel(branchesModule, _("Branches"));
84         docPS->addPanel(preambleModule, _("LaTeX Preamble"));
85         docPS->setCurrentPanel(_("Document Class"));
86
87         // preamble
88         connect(preambleModule->preambleMLE, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
89         // biblio
90         connect(biblioModule->citeDefaultRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
91         connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
92         connect(biblioModule->citeStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
93         connect(biblioModule->citeJurabibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
94         connect(biblioModule->bibtopicCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
95         // language & quote
96         connect(langModule->languageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
97         connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
98         connect(langModule->encodingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
99         connect(langModule->quoteStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
100         // numbering
101         connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
102         connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
103         connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
104         connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
105         numberingModule->tocLV->setSorting(-1);
106         // maths
107         connect(mathsModule->amsCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
108         connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
109         // float
110         connect(floatModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
111         // latex class
112         connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
113         connect(latexModule->optionsLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
114         connect(latexModule->psdriverCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
115         connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(classChanged()));
116         // text layout
117         connect(textLayoutModule->fontsCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
118         connect(textLayoutModule->fontsizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
119         connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
120         connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(setLSpacing(int)));
121         connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
122         connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
123         connect(textLayoutModule->indentRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
124         connect(textLayoutModule->skipCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
125         connect(textLayoutModule->skipLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
126         connect(textLayoutModule->skipLengthCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
127         connect(textLayoutModule->skipCO, SIGNAL(activated(int)), this, SLOT(setSkip(int)));
128         connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(enableSkip(bool)));
129         connect(textLayoutModule->twoColumnCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
130
131         // margins
132         connect(marginsModule->marginCO, SIGNAL(activated(int)), this, SLOT(setCustomMargins(int)));
133         connect(marginsModule->marginCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
134         connect(marginsModule->topLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
135         connect(marginsModule->topUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
136         connect(marginsModule->bottomLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
137         connect(marginsModule->bottomUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
138         connect(marginsModule->innerLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
139         connect(marginsModule->innerUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
140         connect(marginsModule->outerLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
141         connect(marginsModule->outerUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
142         connect(marginsModule->headheightLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
143         connect(marginsModule->headheightUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
144         connect(marginsModule->headsepLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
145         connect(marginsModule->headsepUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
146         connect(marginsModule->footskipLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
147         connect(marginsModule->footskipUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
148
149         // page layout
150         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setMargins(int)));
151         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
152         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
153         connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(portraitChanged()));
154         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
155         connect(pageLayoutModule->paperheightLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
156         connect(pageLayoutModule->paperwidthLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
157         connect(pageLayoutModule->paperwidthUnitCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
158         connect(pageLayoutModule->paperheightUnitCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
159         connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
160         connect(pageLayoutModule->landscapeRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
161         connect(pageLayoutModule->facingPagesCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
162         connect(pageLayoutModule->pagestyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
163
164         // bullets
165         connect(bulletsModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
166
167         // branches
168         connect(branchesModule->addBranchPB, SIGNAL(pressed()), this, SLOT(addBranchPressed()));
169         connect(branchesModule->removePB, SIGNAL(pressed()), this, SLOT(deleteBranchPressed()));
170         connect(branchesModule->activatePB, SIGNAL(pressed()), this, SLOT(toggleBranchPressed()));
171         connect(branchesModule->branchesLV, SIGNAL(doubleClicked(QListViewItem *)), this,
172                 SLOT(branchDoubleClicked(QListViewItem *)));
173         connect(branchesModule->colorPB, SIGNAL(clicked()), this, SLOT(toggleBranchColor()));
174         branchesModule->branchesLV->setSorting(0);
175 }
176
177
178 QDocumentDialog::~QDocumentDialog()
179 {
180 }
181
182
183 void QDocumentDialog::showPreamble()
184 {
185         docPS->setCurrentPanel(_("LaTeX Preamble"));
186 }
187
188
189 void QDocumentDialog::saveDefaultClicked()
190 {
191         form_->saveDocDefault();
192 }
193
194
195 void QDocumentDialog::useDefaultsClicked()
196 {
197         form_->useClassDefaults();
198 }
199
200
201 void QDocumentDialog::change_adaptor()
202 {
203         form_->changed();
204 }
205
206
207 void QDocumentDialog::closeEvent(QCloseEvent * e)
208 {
209         form_->slotWMHide();
210         e->accept();
211 }
212
213
214 void QDocumentDialog::setLSpacing(int item)
215 {
216         textLayoutModule->lspacingLE->setEnabled(item == 3);
217 }
218
219
220 void QDocumentDialog::setSkip(int item)
221 {
222         bool const enable = (item == 3);
223         textLayoutModule->skipLE->setEnabled(enable);
224         textLayoutModule->skipLengthCO->setEnabled(enable);
225 }
226
227
228 void QDocumentDialog::enableSkip(bool skip)
229 {
230         textLayoutModule->skipCO->setEnabled(skip);
231         textLayoutModule->skipLE->setEnabled(skip);
232         textLayoutModule->skipLengthCO->setEnabled(skip);
233         if (skip)
234                 setSkip(textLayoutModule->skipCO->currentItem());
235 }
236
237 void QDocumentDialog::portraitChanged()
238 {
239         setMargins(pageLayoutModule->papersizeCO->currentItem());
240 }
241
242 void QDocumentDialog::setMargins(int papersize)
243 {
244         int olditem = marginsModule->marginCO->currentItem();
245         marginsModule->marginCO->clear();
246         marginsModule->marginCO->insertItem(qt_("Default"));
247         marginsModule->marginCO->insertItem(qt_("Custom"));
248         bool a4size = (papersize == 6 || papersize == 0
249                         && lyxrc.default_papersize == PAPER_A4PAPER);
250         if (a4size && pageLayoutModule->portraitRB->isChecked()) {
251                 marginsModule->marginCO->insertItem(qt_("Small margins"));
252                 marginsModule->marginCO->insertItem(qt_("Very small margins"));
253                 marginsModule->marginCO->insertItem(qt_("Very wide margins"));
254         } else if (olditem > 1) {
255                 olditem = 0;
256         }
257         marginsModule->marginCO->setCurrentItem(olditem);
258         setCustomMargins(olditem);
259 }
260
261
262 void QDocumentDialog::setCustomPapersize(int papersize)
263 {
264         bool const custom = (papersize == 1);
265
266         pageLayoutModule->paperwidthL->setEnabled(custom);
267         pageLayoutModule->paperwidthLE->setEnabled(custom);
268         pageLayoutModule->paperwidthUnitCO->setEnabled(custom);
269         pageLayoutModule->paperheightL->setEnabled(custom);
270         pageLayoutModule->paperheightLE->setEnabled(custom);
271         pageLayoutModule->paperheightLE->setFocus();
272         pageLayoutModule->paperheightUnitCO->setEnabled(custom);
273 }
274
275
276 void QDocumentDialog::setCustomMargins(int margin)
277 {
278         bool const custom = (margin == 1);
279
280         marginsModule->topL->setEnabled(custom);
281         marginsModule->topLE->setEnabled(custom);
282         marginsModule->topUnit->setEnabled(custom);
283
284         marginsModule->bottomL->setEnabled(custom);
285         marginsModule->bottomLE->setEnabled(custom);
286         marginsModule->bottomUnit->setEnabled(custom);
287
288         marginsModule->innerL->setEnabled(custom);
289         marginsModule->innerLE->setEnabled(custom);
290         marginsModule->innerUnit->setEnabled(custom);
291
292         marginsModule->outerL->setEnabled(custom);
293         marginsModule->outerLE->setEnabled(custom);
294         marginsModule->outerUnit->setEnabled(custom);
295
296         marginsModule->headheightL->setEnabled(custom);
297         marginsModule->headheightLE->setEnabled(custom);
298         marginsModule->headheightUnit->setEnabled(custom);
299
300         marginsModule->headsepL->setEnabled(custom);
301         marginsModule->headsepLE->setEnabled(custom);
302         marginsModule->headsepUnit->setEnabled(custom);
303
304         marginsModule->footskipL->setEnabled(custom);
305         marginsModule->footskipLE->setEnabled(custom);
306         marginsModule->footskipUnit->setEnabled(custom);
307 }
308
309
310 void QDocumentDialog::updateFontsize(string const & items, string const & sel)
311 {
312         textLayoutModule->fontsizeCO->clear();
313         textLayoutModule->fontsizeCO->insertItem("default");
314
315         for (int n = 0; !token(items,'|',n).empty(); ++n)
316                 textLayoutModule->fontsizeCO->
317                         insertItem(toqstr(token(items,'|',n)));
318
319         for (int n = 0; n<textLayoutModule->fontsizeCO->count(); ++n) {
320                 if (fromqstr(textLayoutModule->fontsizeCO->text(n)) == sel) {
321                         textLayoutModule->fontsizeCO->setCurrentItem(n);
322                         break;
323                 }
324         }
325 }
326
327
328 void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
329 {
330         pageLayoutModule->pagestyleCO->clear();
331         pageLayoutModule->pagestyleCO->insertItem("default");
332
333         for (int n=0; !token(items,'|',n).empty(); ++n)
334                 pageLayoutModule->pagestyleCO->
335                         insertItem(toqstr(token(items,'|',n)));
336
337         for (int n = 0; n<pageLayoutModule->pagestyleCO->count(); ++n) {
338                 if (fromqstr(pageLayoutModule->pagestyleCO->text(n))==sel) {
339                         pageLayoutModule->pagestyleCO->setCurrentItem(n);
340                         break;
341                 }
342         }
343 }
344
345
346 void QDocumentDialog::classChanged()
347 {
348         ControlDocument & cntrl = form_->controller();
349         BufferParams & params = cntrl.params();
350
351         lyx::textclass_type const tc = latexModule->classCO->currentItem();
352
353         if (form_->controller().loadTextclass(tc)) {
354                 params.textclass = tc;
355
356                 if (lyxrc.auto_reset_options) {
357                         params.useClassDefaults();
358                         form_->update_contents();
359                 } else {
360                         updateFontsize(cntrl.textClass().opt_fontsize(),
361                                        params.fontsize);
362
363                         updatePagestyle(cntrl.textClass().opt_pagestyle(),
364                                         params.pagestyle);
365                 }
366         } else {
367                 latexModule->classCO->setCurrentItem(params.textclass);
368         }
369 }
370
371
372 void QDocumentDialog::updateNumbering()
373 {
374         int const depth = numberingModule->depthSL->value();
375         int const toc = numberingModule->tocSL->value();
376         QListViewItem * partitem = numberingModule->tocLV->firstChild();
377         QListViewItem * chapteritem = partitem->nextSibling();
378         QListViewItem * sectionitem = chapteritem->nextSibling();
379         QListViewItem * subsectionitem = sectionitem->nextSibling();
380         QListViewItem * subsubsectionitem = subsectionitem->nextSibling();
381         QListViewItem * paragraphitem = subsubsectionitem->nextSibling();
382         QListViewItem * subparagraphitem = paragraphitem->nextSibling();
383
384         QString const no = qt_("No");
385         QString const yes = qt_("Yes");
386
387         //numberingModule->tocLV->setUpdatesEnabled(false);
388
389         partitem->setText(1, yes);
390         chapteritem->setText(1, yes);
391         sectionitem->setText(1, yes);
392         subsectionitem->setText(1, yes);
393         subsubsectionitem->setText(1, yes);
394         paragraphitem->setText(1, yes);
395         subparagraphitem->setText(1, yes);
396         partitem->setText(2, yes);
397         chapteritem->setText(2, yes);
398         sectionitem->setText(2, yes);
399         subsectionitem->setText(2, yes);
400         subsubsectionitem->setText(2, yes);
401         paragraphitem->setText(2, yes);
402         subparagraphitem->setText(2, yes);
403
404         // numbering
405         if (depth < -1) partitem->setText(1, no);
406         if (depth < 0) chapteritem->setText(1, no);
407         if (depth < 1) sectionitem->setText(1, no);
408         if (depth < 2) subsectionitem->setText(1, no);
409         if (depth < 3) subsubsectionitem->setText(1, no);
410         if (depth < 4) paragraphitem->setText(1, no);
411         if (depth < 5) subparagraphitem->setText(1, no);
412
413         // in toc
414         if (toc < 0) chapteritem->setText(2, no);
415         if (toc < 1) sectionitem->setText(2, no);
416         if (toc < 2) subsectionitem->setText(2, no);
417         if (toc < 3) subsubsectionitem->setText(2, no);
418         if (toc < 4) paragraphitem->setText(2, no);
419         if (toc < 5) subparagraphitem->setText(2, no);
420
421         //numberingModule->tocLV->setUpdatesEnabled(true);
422         //numberingModule->tocLV->update();
423 }
424
425
426 void QDocumentDialog::updateBranchView()
427 {
428         // store the selected branch
429         QListViewItem * selItem =
430                 branchesModule->branchesLV->selectedItem();
431         QString sel_branch;
432         if (selItem != 0)
433                 sel_branch = selItem->text(0);
434
435         branchesModule->branchesLV->clear();
436
437         BranchList::const_iterator it = form_->branchlist_.begin();
438         BranchList::const_iterator const end = form_->branchlist_.end();
439         for (; it != end; ++it) {
440                 QString const bname = toqstr(it->getBranch());
441                 QString const sel = it->getSelected() ? qt_("Yes") : qt_("No");
442                 QListViewItem * newItem =
443                         new QListViewItem(branchesModule->branchesLV, bname, sel);
444                 string const x11hexname = it->getColor();
445                 QColor itemcolor;
446                 if (x11hexname[0] == '#')
447                         itemcolor.setNamedColor(toqstr(x11hexname));
448                 if (itemcolor.isValid()) {
449                         QPixmap coloritem(30, 10);
450                         coloritem.fill(itemcolor);
451                         newItem->setPixmap(2, coloritem);
452                 }
453                 // restore selected branch
454                 if (bname == sel_branch)
455                         branchesModule->branchesLV->setSelected(newItem, true);
456         }
457         form_->changed();
458 }
459
460
461 void QDocumentDialog::addBranchPressed()
462 {
463         QString const new_branch = branchesModule->newBranchLE->text();
464         if (!new_branch.isEmpty()) {
465                 form_->branchlist_.add(fromqstr(new_branch));
466                 branchesModule->newBranchLE->clear();
467                 updateBranchView();
468         }
469 }
470
471
472 void QDocumentDialog::deleteBranchPressed()
473 {
474         QListViewItem * selItem =
475                 branchesModule->branchesLV->selectedItem();
476         QString sel_branch;
477         if (selItem != 0)
478                 sel_branch = selItem->text(0);
479         if (sel_branch) {
480                 form_->branchlist_.remove(fromqstr(sel_branch));
481                 branchesModule->newBranchLE->clear();
482                 updateBranchView();
483         }
484 }
485
486
487 void QDocumentDialog::toggleBranchPressed()
488 {
489         QListViewItem * selItem =
490                 branchesModule->branchesLV->selectedItem();
491         toggleBranch(selItem);
492 }
493
494
495 void QDocumentDialog::branchDoubleClicked(QListViewItem * selItem)
496 {
497         toggleBranch(selItem);
498 }
499
500
501 void QDocumentDialog::toggleBranch(QListViewItem * selItem)
502 {
503         if (selItem == 0)
504                 return;
505
506         QString sel_branch = selItem->text(0);
507         if (sel_branch) {
508                 bool const selected = selItem->text(1) == qt_("Yes");
509                 Branch * branch = form_->branchlist_.find(fromqstr(sel_branch));
510                 if (branch && branch->setSelected(!selected)) {
511                         branchesModule->newBranchLE->clear();
512                         updateBranchView();
513                 }
514         }
515 }
516
517
518 void QDocumentDialog::toggleBranchColor()
519 {
520         QListViewItem * selItem =
521                 branchesModule->branchesLV->selectedItem();
522         QString sel_branch;
523         if (selItem != 0)
524                 sel_branch = selItem->text(0);
525         if (sel_branch) {
526                 QColor initial;
527                 string current_branch = fromqstr(sel_branch);
528                 Branch * branch =
529                         form_->branchlist_.find(current_branch);
530                 if (!branch)
531                         return;
532
533                 string x11hexname = branch->getColor();
534                 if (x11hexname[0] == '#')
535                         initial.setNamedColor(toqstr(x11hexname));
536                 QColor ncol(QColorDialog::getColor(initial, qApp->focusWidget() ? qApp->focusWidget() : qApp->mainWidget()));
537                 if (ncol.isValid()){
538                         // add the color to the branchlist
539                         branch->setColor(fromqstr(ncol.name()));
540                         branchesModule->newBranchLE->clear();
541                         updateBranchView();
542                 }
543         }
544 }
545
546 } // namespace frontend
547 } // namespace lyx