libkonq Library API Documentation

knewmenu.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998-2000 David Faure <faure@kde.org>
00003                  2003      Sven Leiber <s.leiber@web.de>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License version 2 as published by the Free Software Foundation.
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 
00020 #ifndef __knewmenu_h
00021 #define __knewmenu_h
00022 
00023 #include <qintdict.h>
00024 #include <qstringlist.h>
00025 
00026 #include <kaction.h>
00027 #include <kdialogbase.h>
00028 #include <kurl.h>
00029 
00030 namespace KIO { class Job; }
00031 
00032 class KDirWatch;
00033 class KLineEdit;
00034 class KURLRequester;
00035 class QPopupMenu;
00036 
00051 class KNewMenu : public KActionMenu
00052 {
00053   Q_OBJECT
00054 public:
00055 
00059     KNewMenu( KActionCollection * _collec, const char *name=0L );
00060     KNewMenu( KActionCollection * _collec, QWidget *parentWidget, const char *name=0L );
00061     virtual ~KNewMenu();
00062 
00067     void setPopupFiles(KURL::List & _files) {
00068         popupFiles = _files;
00069     }
00070     void setPopupFiles(const KURL & _file) {
00071         popupFiles.clear();
00072         popupFiles.append( _file );
00073     }
00074 
00075 public slots:
00080     void slotCheckUpToDate( );
00081 
00082 protected slots:
00086     void slotNewDir();
00087 
00091     void slotNewFile();
00092 
00096     void slotFillTemplates();
00097 
00098     void slotResult( KIO::Job * );
00099     // Special case (filename conflict when creating a link=url file)
00100     void slotRenamed( KIO::Job *, const KURL&, const KURL& );
00101 
00102 private:
00103 
00107     void fillMenu();
00108 
00113     void parseFiles();
00114 
00118     void makeMenus();
00119 
00127     enum { LINKTOTEMPLATE = 1, TEMPLATE, SEPARATOR };
00128 
00129     struct Entry {
00130         QString text;
00131         QString filePath; // empty for SEPARATOR
00132         QString templatePath; // same as filePath for TEMPLATE
00133         QString icon;
00134         int entryType;
00135         QString comment;
00136     };
00137     // NOTE: only filePath is known before we call parseFiles
00138 
00143     static QValueList<Entry> * s_templatesList;
00144 
00145     class KNewMenuPrivate;
00146     KNewMenuPrivate* d;
00147 
00153     static int s_templatesVersion;
00154 
00159     static bool s_filesParsed;
00160 
00161     int menuItemsVersion;
00162 
00167     KURL::List popupFiles;
00168 
00172     bool m_isURLDesktopFile;
00173     QString m_linkURL; // the url to put in the file
00174 
00175     static KDirWatch * s_pDirWatch;
00176 };
00177 
00184 class KURLDesktopFileDlg : public KDialogBase
00185 {
00186     Q_OBJECT
00187 public:
00188     KURLDesktopFileDlg( const QString& textFileName, const QString& textUrl );
00189     KURLDesktopFileDlg( const QString& textFileName, const QString& textUrl, QWidget *parent );
00190     virtual ~KURLDesktopFileDlg() {}
00191 
00195     QString fileName() const;
00199     QString url() const;
00200 
00201 protected slots:
00202     void slotClear();
00203     void slotNameTextChanged( const QString& );
00204     void slotURLTextChanged( const QString& );
00205 private:
00206     void initDialog( const QString& textFileName, const QString& defaultName, const QString& textUrl, const QString& defaultUrl );
00207 
00211     KLineEdit *m_leFileName;
00215     KURLRequester *m_urlRequester;
00216 
00220     bool m_fileNameEdited;
00221 };
00222 
00223 #endif
KDE Logo
This file is part of the documentation for libkonq Library Version 3.2.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 5 04:41:08 2004 by doxygen 1.3.6-20040222 written by Dimitri van Heesch, © 1997-2003