Main Page | Class List | File List | Class Members | File Members | Related Pages

prefwww.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Bojan D.                                        *
00003  *   bojan_d@users.sourceforge.net                                         *
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  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00028 #include <kpushbutton.h>
00029 #include <klocale.h>
00030 #include <kfiledialog.h>
00031 #include <kiconloader.h>
00032 #include <kurl.h>
00033 #include <kmimetype.h>
00034  
00035 #include "prefwww.h"
00036 
00037 PrefWWW::PrefWWW(QWidget* parent, const char* name, WFlags fl)
00038 : PrefWWWLayout(parent,name,fl)
00039 {
00040         m_btnAdd->setText(i18n("Add..."));
00041         m_btnRemove->setText(i18n("Remove"));
00042         
00043         m_btnAdd->setIconSet(KGlobal::iconLoader()->loadIconSet("fileopen",KIcon::Small,0,false));
00044         m_btnRemove->setIconSet(KGlobal::iconLoader()->loadIconSet("remove",KIcon::Small,0,false));
00045 }
00046 
00047 PrefWWW::~PrefWWW()
00048 {
00049 }
00050 
00051 /*$SPECIALIZATION$*/
00052 void PrefWWW::slotRemoveFile()
00053 {
00054         int index = m_listFiles->currentItem();
00055         if(index != -1)
00056         {
00057                 m_listFiles->removeItem(index);
00058                 emit itemRemoved();
00059         }
00060 }
00061 
00062 void PrefWWW::slotAddFile()
00063 {
00064         QStringList files = KFileDialog::getOpenFileNames(QString::null, QString::null, this, i18n("Add file"));
00065         
00066         for ( QStringList::Iterator it = files.begin(); it != files.end(); ++it ) 
00067         {
00068                 KURL url;
00069                 url.setPath(*it);
00070         m_listFiles->insertItem(KMimeType::pixmapForURL(url, 0, KIcon::Small), *it);
00071     }
00072         
00073         if(!files.isEmpty()) emit itemsAdded();
00074                 
00075         //m_listFiles->insertStringList(files);
00076 }
00077 
00078 
00079 
00080 #include "prefwww.moc"
00081 

Generated on Mon Sep 5 12:52:34 2005 for kwebsnap.kdevelop by  doxygen 1.3.9.1