KDevelop API Documentation

addfilesdialog.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2003 Alexander Dymo <cloudtemple@mksat.net>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 #include <klocale.h>
00020 #include <kapplication.h>
00021 
00022 #include <qcombobox.h>
00023 
00024 #include "addfilesdialog.h"
00025 #include "addfilesdialog.moc"
00026 
00027 AddFilesDialog::AddFilesDialog(const QString& startDir, const QString& filter,
00028     QWidget *parent, const char *name, bool modal):
00029     KFileDialog(startDir, filter, parent, name, modal)
00030 {
00031     KConfig *config = kapp->config();
00032     config->setGroup("Add Files Dialog");
00033 
00034     m_extraWidget = new QComboBox(false, this);
00035     m_extraWidget->insertItem(i18n("Copy File(s)"), 0);
00036     m_extraWidget->insertItem(i18n("Create Symbolic Link(s)"), 1);
00037     m_extraWidget->insertItem(i18n("Add Relative Path(s)"), 2);
00038     m_extraWidget->setCurrentItem(config->readNumEntry("Mode"));
00039     connect(m_extraWidget, SIGNAL(activated(int)), this, SLOT(storePreferred(int)));
00040 
00041     setPreviewWidget(m_extraWidget);
00042 
00043     setOperationMode(Opening);
00044 }
00045 
00046 #if KDE_VERSION >= 310
00047 AddFilesDialog::AddFilesDialog(const QString& startDir, const QString& filter,
00048     QWidget *parent, const char *name, bool modal, QComboBox *extraWidget):
00049     KFileDialog(startDir, filter, parent, name, modal, extraWidget), m_extraWidget(extraWidget)
00050 {
00051     KConfig *config = kapp->config();
00052     config->setGroup("Add Files Dialog");
00053 
00054     m_extraWidget->insertItem(i18n("Copy File(s)"), 0);
00055     m_extraWidget->insertItem(i18n("Create Symbolic Link(s)"), 1);
00056     m_extraWidget->insertItem(i18n("Add Relative Path(s)"), 2);
00057     m_extraWidget->setCurrentItem(config->readNumEntry("Mode"));
00058     connect(m_extraWidget, SIGNAL(activated(int)), this, SLOT(storePreferred(int)));
00059 
00060     setOperationMode(Opening);
00061 }
00062 #endif
00063 
00064 AddFilesDialog::~AddFilesDialog()
00065 {
00066 }
00067 
00068 AddFilesDialog::Mode AddFilesDialog::mode( )
00069 {
00070     return (AddFilesDialog::Mode)m_extraWidget->currentItem();
00071 }
00072 
00073 void AddFilesDialog::storePreferred( int index )
00074 {
00075     KConfig *config = kapp->config();
00076     config->setGroup("Add Files Dialog");
00077     config->writeEntry("Mode", index);
00078 }
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:36 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003