Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

mtpfilterssettings.ui.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** ui.h extension file, included from the uic-generated form implementation.
00003 **
00004 ** If you wish to add, delete or rename functions or slots use
00005 ** Qt Designer which will update this file, preserving your code. Create an
00006 ** init() function in place of a constructor, and a destroy() function in
00007 ** place of a destructor.
00008 *****************************************************************************/
00009 
00010 #include "domutil.h"
00011 
00012 void MtpFiltersSettings::displayGlobal( const QString & name)
00013 {
00014     global_name->setText(name);
00015     global_result->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/result"));
00016     global_active_check->setChecked(DomUtil::readBoolEntry(*m_dom,"/filters/" + name + "/active"));
00017     global_subrules_check->setChecked(!DomUtil::readIntEntry(*m_dom,"/filters/" + name + "/policy"));    
00018 }
00019 
00020 
00021 void MtpFiltersSettings::displayBlock( const QString & name)
00022 {
00023     block_name->setText(name);
00024     block_result->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/result"));
00025     block_begin->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/begin"));
00026     block_end->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/end"));
00027     block_input->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/depend",""));
00028     block_active_check->setChecked(DomUtil::readBoolEntry(*m_dom,"/filters/" + name + "/active"));
00029     block_subrules_check->setChecked(!DomUtil::readIntEntry(*m_dom,"/filters/" + name + "/policy"));
00030 }
00031 
00032 
00033 void MtpFiltersSettings::displayLine( const QString & name)
00034 {
00035     line_name->setText(name);
00036     line_result->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/result"));
00037     line_regexp->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/regexp"));
00038     line_active_check->setChecked(DomUtil::readBoolEntry(*m_dom,"/filters/" + name + "/active"));
00039     line_subrules_check->setChecked(!DomUtil::readIntEntry(*m_dom,"/filters/" + name + "/policy"));
00040 }
00041 
00042 
00043 void MtpFiltersSettings::displayItem( const QString & name)
00044 {
00045     item_name->setText(name);
00046     item_result->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/result"));
00047     item_regexp->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/regexp"));
00048     item_active_check->setChecked(DomUtil::readBoolEntry(*m_dom,"/filters/" + name + "/active"));
00049 }
00050 
00051 
00052 void MtpFiltersSettings::displayInput( const QString & name)
00053 {
00054     input_name->setText(name);
00055     input_result->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/result"));
00056     input_regexp->setText(DomUtil::readEntry(*m_dom,"/filters/" + name + "/regexp"));
00057     input_active_check->setChecked(DomUtil::readBoolEntry(*m_dom,"/filters/" + name + "/active"));
00058 }
00059 
00060 
00061 void MtpFiltersSettings::setDom( QDomDocument * dom)
00062 {
00063     global_rules->insertStringList(DomUtil::readListEntry(*dom,"/general/filters/global","filter"));
00064     block_rules->insertStringList(DomUtil::readListEntry(*dom,"/general/filters/block","filter"));
00065     line_rules->insertStringList(DomUtil::readListEntry(*dom,"/general/filters/line","filter"));
00066     item_rules->insertStringList(DomUtil::readListEntry(*dom,"/general/filters/item","filter"));
00067     input_rules->insertStringList(DomUtil::readListEntry(*dom,"/general/filters/input","filter"));
00068     m_dom = dom;
00069 }
00070 
00071 
00072 
00073 
00074 void MtpFiltersSettings::changedBlock()
00075 {
00076     DomUtil::writeEntry(*m_dom,"/filters/" + block_rules->currentText() + "/result",block_result->text());
00077     DomUtil::writeEntry(*m_dom,"/filters/" + block_rules->currentText() + "/begin",block_begin->text());
00078     DomUtil::writeEntry(*m_dom,"/filters/" + block_rules->currentText() + "/end",block_end->text());
00079     DomUtil::writeEntry(*m_dom,"/filters/" + block_rules->currentText() + "/depend",block_input->text());
00080     DomUtil::writeBoolEntry(*m_dom,"/filters/" + block_rules->currentText() + "/active",block_active_check->isChecked());
00081     DomUtil::writeIntEntry(*m_dom,"/filters/" + block_rules->currentText() + "/policy",(block_subrules_check->isChecked())?0:1);
00082 }
00083 
00084 
00085 void MtpFiltersSettings::changedItem()
00086 {
00087     DomUtil::writeEntry(*m_dom,"/filters/" + item_rules->currentText() + "/result",item_result->text());
00088     DomUtil::writeEntry(*m_dom,"/filters/" + item_rules->currentText() + "/regexp",item_regexp->text());
00089     DomUtil::writeBoolEntry(*m_dom,"/filters/" + item_rules->currentText() + "/active",item_active_check->isChecked());
00090 }
00091 
00092 
00093 void MtpFiltersSettings::changedGlobal()
00094 {
00095     DomUtil::writeEntry(*m_dom,"/filters/" + global_rules->currentText() + "/result",global_result->text());
00096     DomUtil::writeBoolEntry(*m_dom,"/filters/" + global_rules->currentText() + "/active",global_active_check->isChecked());
00097     DomUtil::writeIntEntry(*m_dom,"/filters/" + global_rules->currentText() + "/policy",(global_subrules_check->isChecked())?0:1);
00098 }
00099 
00100 
00101 void MtpFiltersSettings::changedLine()
00102 {
00103     DomUtil::writeEntry(*m_dom,"/filters/" + line_rules->currentText() + "/result",line_result->text());
00104     DomUtil::writeEntry(*m_dom,"/filters/" + line_rules->currentText() + "/regexp",line_regexp->text());
00105     DomUtil::writeBoolEntry(*m_dom,"/filters/" + line_rules->currentText() + "/active",line_active_check->isChecked());
00106     DomUtil::writeIntEntry(*m_dom,"/filters/" + line_rules->currentText() + "/policy",(line_subrules_check->isChecked())?0:1);
00107 }
00108 
00109 
00110 void MtpFiltersSettings::changedInput()
00111 {
00112     DomUtil::writeEntry(*m_dom,"/filters/" + input_rules->currentText() + "/result",input_result->text());
00113     DomUtil::writeEntry(*m_dom,"/filters/" + input_rules->currentText() + "/regexp",input_regexp->text());
00114     DomUtil::writeBoolEntry(*m_dom,"/filters/" + input_rules->currentText() + "/active",input_active_check->isChecked());
00115 }
00116 
00117 
00118 void MtpFiltersSettings::addGlobal()
00119 {
00120     global_rules->insertItem(global_name->text());
00121     global_rules->setSelected(global_rules->count()-1,true);
00122     changedGlobal();
00123 
00124     updateList(global_rules,"/general/filters/global"); 
00125 }
00126 
00127 
00128 void MtpFiltersSettings::addBlock()
00129 {
00130     block_rules->insertItem(block_name->text());
00131     block_rules->setSelected(block_rules->count()-1,true);
00132     changedBlock();
00133     updateList(block_rules,"/general/filters/block");
00134 }
00135 
00136 
00137 void MtpFiltersSettings::addLine()
00138 {
00139     line_rules->insertItem(line_name->text());
00140     line_rules->setSelected(line_rules->count()-1,true);
00141     changedLine();
00142     updateList(line_rules,"/general/filters/line");
00143 }
00144 
00145 
00146 void MtpFiltersSettings::addItem()
00147 {
00148     item_rules->insertItem(item_name->text());
00149     item_rules->setSelected(item_rules->count()-1,true);
00150     changedItem();
00151     updateList(item_rules,"/general/filters/item");
00152 }
00153 
00154 
00155 void MtpFiltersSettings::addInput()
00156 {
00157     input_rules->insertItem(input_name->text());
00158     input_rules->setSelected(input_rules->count()-1,true);
00159     changedInput();
00160     updateList(input_rules,"/general/filters/input");
00161 }
00162 
00163 
00164 void MtpFiltersSettings::delGlobal()
00165 {
00166     QString name(global_rules->currentText());
00167     global_rules->removeItem(global_rules->currentItem());
00168     QDomElement child = DomUtil::elementByPath(*m_dom,"/filters/" + name);
00169     if(!child.isNull()) child.parentNode().removeChild(child);
00170     updateList(global_rules,"/general/filters/global");
00171 }
00172 
00173 
00174 void MtpFiltersSettings::delBlock()
00175 {
00176     QString name(block_rules->currentText());
00177     block_rules->removeItem(block_rules->currentItem());
00178     QDomElement child = DomUtil::elementByPath(*m_dom,"/filters/" + name);
00179     if(!child.isNull()) child.parentNode().removeChild(child);
00180     updateList(block_rules,"/general/filters/block");
00181 }
00182 
00183 
00184 void MtpFiltersSettings::delLine()
00185 {
00186     QString name(line_rules->currentText());
00187     line_rules->removeItem(line_rules->currentItem());
00188     QDomElement child = DomUtil::elementByPath(*m_dom,"/filters/" + name);
00189     if(!child.isNull()) child.parentNode().removeChild(child);
00190     updateList(line_rules,"/general/filters/line");
00191 }
00192 
00193 
00194 void MtpFiltersSettings::delItem()
00195 {
00196     QString name(item_rules->currentText());
00197     item_rules->removeItem(item_rules->currentItem());
00198     QDomElement child = DomUtil::elementByPath(*m_dom,"/filters/" + name);
00199     if(!child.isNull()) child.parentNode().removeChild(child);
00200     updateList(item_rules,"/general/filters/item");
00201 }
00202 
00203 
00204 void MtpFiltersSettings::delInput()
00205 {
00206     QString name(input_rules->currentText());
00207     input_rules->removeItem(input_rules->currentItem());
00208     QDomElement child = DomUtil::elementByPath(*m_dom,"/filters/" + name);
00209     if(!child.isNull()) child.parentNode().removeChild(child);
00210     updateList(input_rules,"/general/filters/input");
00211 }
00212 
00213 
00214 void MtpFiltersSettings::updateList( QListBox *box, const QString & path )
00215 {
00216     QStringList l;
00217     for(uint i = 0; i<box->count(); i++) l << box->text(i);
00218     DomUtil::writeListEntry(*m_dom,path,"filter",l);
00219 }
00220 
00221 
00222 void MtpFiltersSettings::upGlobal()
00223 {
00224     up(global_rules);
00225     updateList(global_rules,"/general/filters/global");
00226 }
00227 
00228 
00229 void MtpFiltersSettings::downGlobal()
00230 {
00231     down(global_rules);
00232     updateList(global_rules,"/general/filters/global");
00233 }
00234 
00235 
00236 void MtpFiltersSettings::upBlock()
00237 {
00238     up(block_rules);
00239     updateList(block_rules,"/general/filters/block");
00240 }
00241 
00242 
00243 void MtpFiltersSettings::downBlock()
00244 {
00245     down(block_rules);
00246     updateList(block_rules,"/general/filters/block");
00247 }
00248 
00249 
00250 void MtpFiltersSettings::upLine()
00251 {
00252     up(line_rules);
00253     updateList(line_rules,"/general/filters/line");
00254 }
00255 
00256 
00257 void MtpFiltersSettings::downLine()
00258 {
00259     down(line_rules);
00260     updateList(line_rules,"/general/filters/line");
00261 }
00262 
00263 
00264 void MtpFiltersSettings::upItem()
00265 {
00266     up(item_rules);
00267     updateList(item_rules,"/general/filters/item");
00268 }
00269 
00270 
00271 void MtpFiltersSettings::downItem()
00272 {
00273     down(item_rules);
00274     updateList(item_rules,"/general/filters/item");
00275 }
00276 
00277 
00278 void MtpFiltersSettings::upInput()
00279 {
00280     up(input_rules);
00281     updateList(input_rules,"/general/filters/input");
00282 }
00283 
00284 
00285 void MtpFiltersSettings::downInput()
00286 {
00287     down(input_rules);
00288     updateList(input_rules,"/general/filters/input");
00289 }
00290 
00291 
00292 void MtpFiltersSettings::up( QListBox * box)
00293 {
00294     int index = box->currentItem();
00295     if (index) {
00296         QString text = box->currentText();
00297         box->removeItem(index);
00298         box->insertItem(text,index - 1);
00299     }
00300 }
00301 
00302 
00303 void MtpFiltersSettings::down( QListBox * box)
00304 {
00305     uint index = box->currentItem();
00306 
00307     if (index < box->count()) {
00308         QString text = box->currentText();
00309         box->removeItem(index);
00310         box->insertItem(text,index + 1);
00311     }
00312 }

Generated on Sat May 10 15:09:27 2003 for qnet by doxygen1.3