KDevelop API Documentation

parts/filecreate/filecreate_filedialog.cpp

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2003 by Julian Rockey * 00003 * linux@jrockey.com * 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 "filecreate_filedialog.h" 00012 00013 #include <qfileinfo.h> 00014 #include <kdeversion.h> 00015 #include <kurlcombobox.h> 00016 #include <kdebug.h> 00017 00018 #include "filecreate_part.h" 00019 #include "filecreate_filetype.h" 00020 00021 namespace FileCreate { 00022 00023 FileDialog::FileDialog(const QString& startDir, const QString& filter, 00024 QWidget *parent, const char *name, 00025 bool modal, QWidget * extraWidget) : 00026 #if KDE_VERSION >= 310 00027 KFileDialog(startDir, filter, parent, name, modal, extraWidget) { 00028 #else 00029 KFileDialog(startDir, filter, parent, name, modal) { 00030 if (extraWidget) setPreviewWidget(extraWidget); 00031 #endif 00032 00033 setOperationMode(Saving); 00034 00035 m_extraWidget = extraWidget; 00036 m_typeChooser = dynamic_cast<TypeChooser*>(extraWidget); 00037 00038 connect(this, SIGNAL(filterChanged(const QString &)), this, SLOT(slotActionFilterChanged(const QString &)) ); 00039 connect(locationEdit, SIGNAL(textChanged(const QString &)), this, SLOT(slotActionTextChanged(const QString &)) ); 00040 00041 } 00042 00043 FileDialog::~FileDialog() { } 00044 00045 00046 void FileDialog::initGUI() 00047 { 00048 KFileDialog::initGUI(); 00049 } 00050 00051 void FileDialog::slotActionFilterChanged(const QString & /*filter*/) { 00052 } 00053 00054 void FileDialog::slotActionTextChanged(const QString & text) { 00055 kdDebug(9034) << "slotActionTextChanged - " << text << endl; 00056 if (!m_typeChooser) return; 00057 QString ext = QFileInfo(text).extension(); 00058 kdDebug(9034) << "Extension is: " << ext << endl; 00059 FileType * filetype = m_typeChooser->part()->getType(ext); 00060 if (!filetype) return; 00061 kdDebug(9034) << "found matching extension: " << ext << endl; 00062 kdDebug(9034) << "Description: " << filetype->descr() << endl; 00063 m_typeChooser->setCurrent(filetype); 00064 } 00065 00066 00067 00068 } 00069 00070 #include "filecreate_filedialog.moc"
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:39:11 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003