summaryrefslogtreecommitdiffstats
path: root/ksquirrel/sq_selectdeselectgroup.ui.h
blob: d7fcb073f6c6e2989e3b28f1f9a0498a10eb8250 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** TQt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#ifdef SQ_HAVE_KREGEXP
#include <kregexpeditorinterface.h>
#include <kparts/componentfactory.h>
#include <ktrader.h>
#endif

void SQ_SelectDeselectGroup::init()
{
    SQ_Config::instance()->setGroup("Fileview");
    comboMask->insertStringList(SQ_Config::instance()->readListEntry("selectdeselecthistory"));

#ifdef SQ_HAVE_KREGEXP
    // not installed
    if(KTrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty())
	pushEdit->setEnabled(false);
#else
    pushEdit->setEnabled(false);
#endif
}

int SQ_SelectDeselectGroup::exec(TQString &tqmask)
{
    int result = TQDialog::exec();

    if(result == TQDialog::Accepted)
    {
        TQStringList list;
        int cc = comboMask->count();

        for(int i = 0;i < cc;i++)
            list.append(comboMask->text(i));

        // save history
        SQ_Config::instance()->setGroup("Fileview");
        SQ_Config::instance()->writeEntry("selectdeselecthistory", list);

        // save tqmask
        tqmask = comboMask->currentText();
    }

    return tqmask.isEmpty() ? TQDialog::Rejected : result;
}

void SQ_SelectDeselectGroup::slotEdit()
{
#ifdef SQ_HAVE_KREGEXP
    TQDialog *editorDialog = KParts::ComponentFactory::createInstanceFromQuery<TQDialog>("KRegExpEditor/KRegExpEditor");

    if(editorDialog)
    {
	KRegExpEditorInterface *editor = static_cast<KRegExpEditorInterface *>(editorDialog->qt_cast("KRegExpEditorInterface"));

	Q_ASSERT(editor);
	editor->setRegExp(comboMask->currentText());

	if(editorDialog->exec())
        {
	    comboMask->insertItem(editor->regExp());
            comboMask->setCurrentText(editor->regExp());
        }
    }
#endif
}