00001 /*************************************************************************** 00002 * Copyright (C) 2002 by Yann Hodique * 00003 * Yann.Hodique@lifl.fr * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 00011 #include "UrlSettings.h" 00012 00013 #include <qlistbox.h> 00014 #include <qlineedit.h> 00015 00016 UrlSettings::UrlSettings(QWidget *parent, const char *name) 00017 : UrlSettingsBase(parent, name) {} 00018 00019 00020 UrlSettings::~UrlSettings() {} 00021 00022 void UrlSettings::addUrlItem(UrlItem & it) { 00023 map.insert(it.name,it); 00024 urls_box->insertItem(it.name); 00025 } 00026 00027 void UrlSettings::delUrlItem(const QString& name) { 00028 map.remove(name); 00029 } 00030 00031 void UrlSettings::slotAdd() { 00032 if (name_edit->text().length() && prefix_edit->text().length() && command_edit->text().length()) { 00033 UrlItem it(name_edit->text(),prefix_edit->text(),command_edit->text()); 00034 addUrlItem(it); 00035 } 00036 } 00037 00038 void UrlSettings::slotDel() { 00039 delUrlItem(QString(urls_box->currentText())); 00040 urls_box->removeItem(urls_box->currentItem()); 00041 } 00042 00043 00044 void UrlSettings::slotUpdateInfo(const QString & name) { 00045 UrlItem it = *(map.find(name)); 00046 name_edit->setText(it.name); 00047 prefix_edit->setText(it.prefix); 00048 command_edit->setText(it.command); 00049 }