filecreate_filedialog.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
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 & ) {
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"
This file is part of the documentation for KDevelop Version 3.1.2.