summaryrefslogtreecommitdiffstats
path: root/buildtools/script/scriptoptionswidget.cpp
blob: d80cd50159d5f1284a02e6b1e307b817a24b7f51 (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
/***************************************************************************
 *   Copyright (C) 2002 by Bernd Gehrmann                                  *
 *   bernd@kdevelop.org                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "scriptoptionswidget.h"

#include <tqcheckbox.h>
#include <klineedit.h>
#include <tqradiobutton.h>
#include <tqtabwidget.h>
#include "domutil.h"
#include "kdevlanguagesupport.h"


ScriptOptionsWidget::ScriptOptionsWidget(KDevPlugin *part,
                                         TQWidget *parent, const char *name)
    : ScriptOptionsWidgetBase(parent, name)
{
    m_part = part;
    
    TQDomDocument &dom = *m_part->projectDom();

    TQString includepatterns
        = DomUtil::readEntry(dom, "/kdevscriptproject/general/includepatterns");
    
    if (includepatterns.isNull() && part->languageSupport()){
	TQStringList includepatternList; 
	KMimeType::List list = part->languageSupport()->mimeTypes();
	KMimeType::List::Iterator it = list.begin();
	while( it != list.end() ){
	    includepatternList += (*it)->patterns();
	    ++it;
	}
	includepatterns = includepatternList.join( "," );
    }
    
    TQString excludepatterns
        = DomUtil::readEntry(dom, "/kdevscriptproject/general/excludepatterns");
    if (excludepatterns.isNull())
        excludepatterns = "*~";
    
    includepatterns_edit->setText(includepatterns);
    excludepatterns_edit->setText(excludepatterns);
}


ScriptOptionsWidget::~ScriptOptionsWidget()
{}


void ScriptOptionsWidget::accept()
{
    TQDomDocument &dom = *m_part->projectDom();

    TQString includepatterns = includepatterns_edit->text();
    TQString excludepatterns = excludepatterns_edit->text();
    
    DomUtil::writeEntry(dom, "/kdevscriptproject/general/includepatterns", includepatterns);
    DomUtil::writeEntry(dom, "/kdevscriptproject/general/excludepatterns", excludepatterns);
}

#include "scriptoptionswidget.moc"