[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/libkonq [POSSIBLY UNSAFE]
From: David Faure <faure () kde ! org>
Date: 2006-11-25 10:31:39
Message-ID: 1164450699.702219.21306.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 607598 by dfaure:
KNewMenu maintainance: move vars to d pointer and static vars to be file-static, move \
out private class to _p.h, fix extension etc. Fix favicontest for when the network is \
down.
M +1 -1 CMakeLists.txt
D knewmenu.cc
A knewmenu.cpp knewmenu.cc#607260 [POSSIBLY UNSAFE: KRun::runCommand] \
[License: LGPL (v2)] M +14 -120 knewmenu.h
A knewmenu_p.h knewmenu.h#607260 [License: LGPL (v2)]
M +4 -1 tests/favicontest.cpp
--- trunk/KDE/kdebase/libkonq/CMakeLists.txt #607597:607598
@@ -13,7 +13,7 @@
# Please use .cpp for new files
set(konq_LIB_SRCS
konq_popupmenu.cc
- knewmenu.cc
+ knewmenu.cpp
konq_xmlguiclient.cc
kfileivi.cc
konq_iconviewwidget.cc
--- trunk/KDE/kdebase/libkonq/knewmenu.h #607597:607598
@@ -1,5 +1,5 @@
/* This file is part of the KDE project
- Copyright (C) 1998-2000 David Faure <faure@kde.org>
+ Copyright (C) 1998-2006 David Faure <faure@kde.org>
2003 Sven Leiber <s.leiber@web.de>
This library is free software; you can redistribute it and/or
@@ -17,16 +17,10 @@
Boston, MA 02110-1301, USA.
*/
-#ifndef __knewmenu_h
-#define __knewmenu_h
+#ifndef KNEWMENU_H
+#define KNEWMENU_H
-#include <q3intdict.h>
-#include <QStringList>
-//Added by qt3to4:
-#include <QList>
#include <kactionmenu.h>
-#include <kactionmenu.h>
-#include <kdialog.h>
#include <kurl.h>
#include <libkonq_export.h>
@@ -34,19 +28,19 @@
namespace KIO { class Job; }
class KDirWatch;
-class KLineEdit;
-class KUrlRequester;
/**
* The 'New' submenu, both for the File menu and the RMB popup menu.
* (The same instance can be used by both).
- * Fills it with 'Folder' and one item per Template.
- * For this you need to connect aboutToShow() of the File menu with \
slotCheckUpToDate()
- * and to call slotCheckUpToDate() before showing the RMB popupmenu.
+ * It fills the menu with 'Folder' and one item per installed template.
*
- * KNewMenu automatically updates the list of templates if templates are
- * added/updated/deleted.
+ * To use this class, you need to connect aboutToShow() of the File menu
+ * with slotCheckUpToDate() and to call slotCheckUpToDate() before showing
+ * the RMB popupmenu.
*
+ * KNewMenu automatically updates the list of templates shown if installed templates
+ * are added/updated/deleted.
+ *
* @author David Faure <faure@kde.org>
* Ideas and code for the new template handling mechanism ('link' desktop files)
* from Christoph Pickart <pickart@iam.uni-bonn.de>
@@ -59,28 +53,22 @@
/**
* Constructor
*/
- KNewMenu( KActionCollection * _collec, const char *name=0L );
- KNewMenu( KActionCollection * _collec, QWidget *parentWidget, const char \
*name=0L ); + KNewMenu( KActionCollection * parent, QWidget* parentWidget, const \
QString& name ); virtual ~KNewMenu();
/**
* Set the files the popup is shown for
* Call this before showing up the menu
*/
- void setPopupFiles(KUrl::List & _files) {
- popupFiles = _files;
- }
- void setPopupFiles(const KUrl & _file) {
- popupFiles.clear();
- popupFiles.append( _file );
- }
+ void setPopupFiles(const KUrl::List & _files);
+ void setPopupFiles(const KUrl & _file);
public Q_SLOTS:
/**
* Checks if updating the list is necessary
* IMPORTANT : Call this in the slot for aboutToShow.
*/
- void slotCheckUpToDate( );
+ void slotCheckUpToDate();
protected Q_SLOTS:
/**
@@ -129,102 +117,8 @@
*/
enum { LINKTOTEMPLATE = 1, TEMPLATE, SEPARATOR };
- struct Entry {
- QString text;
- QString filePath; // empty for SEPARATOR
- QString templatePath; // same as filePath for TEMPLATE
- QString icon;
- int entryType;
- QString comment;
- };
- // NOTE: only filePath is known before we call parseFiles
-
- /**
- * List of all template files. It is important that they are in
- * the same order as the 'New' menu.
- */
- static QList<Entry> * s_templatesList;
-
class KNewMenuPrivate;
KNewMenuPrivate* d;
-
- /**
- * Is increased when templatesList has been updated and
- * menu needs to be re-filled. Menus have their own version and compare it
- * to templatesVersion before showing up
- */
- static int s_templatesVersion;
-
- /**
- * Set back to false each time new templates are found,
- * and to true on the first call to parseFiles
- */
- static bool s_filesParsed;
-
- int menuItemsVersion;
-
- /**
- * When the user pressed the right mouse button over an URL a popup menu
- * is displayed. The URL belonging to this popup menu is stored here.
- */
- KUrl::List popupFiles;
-
- /**
- * True when a desktop file with Type=URL is being copied
- */
- bool m_isURLDesktopFile;
- KUrl m_linkURL; // the url to put in the file
-
- static KDirWatch * s_pDirWatch;
-
- /**
- * The action group that our actions belong to
- */
- QActionGroup* m_newMenuGroup;
};
-/**
- * @internal
- * Dialog to ask for a filename and a URL, when creating a link to a URL.
- * Basically a merge of KLineEditDlg and KUrlRequesterDlg ;)
- * @author David Faure <faure@kde.org>
- */
-class KUrlDesktopFileDlg : public KDialog
-{
- Q_OBJECT
-public:
- KUrlDesktopFileDlg( const QString& textFileName, const QString& textUrl, QWidget \
*parent = 0 );
- virtual ~KUrlDesktopFileDlg() {}
-
- /**
- * @return the filename the user entered (no path)
- */
- QString fileName() const;
- /**
- * @return the URL the user entered
- */
- KUrl url() const;
-
-protected Q_SLOTS:
- void slotClear();
- void slotNameTextChanged( const QString& );
- void slotURLTextChanged( const QString& );
-private:
- void initDialog( const QString& textFileName, const QString& defaultName, const \
QString& textUrl, const QString& defaultUrl );
-
- /**
- * The line edit widget for the fileName
- */
- KLineEdit *m_leFileName;
- /**
- * The URL requester for the URL :)
- */
- KUrlRequester *m_urlRequester;
-
- /**
- * True if the filename was manually edited.
- */
- bool m_fileNameEdited;
-};
-
#endif
--- trunk/KDE/kdebase/libkonq/tests/favicontest.cpp #607597:607598
@@ -49,7 +49,7 @@
s_networkAccess = No;
}
}
- return s_networkAccess;
+ return s_networkAccess == Yes;
}
class TestFavIconMgr : public KonqFavIconMgr
@@ -126,6 +126,9 @@
void FavIconTest::testIconForURL()
{
QString icon = KMimeType::favIconForUrl( KUrl( s_hostUrl ) );
+ if ( icon.isEmpty() && !checkNetworkAccess() )
+ QSKIP( "no network access", SkipAll );
+
QCOMPARE( icon, QString( "favicons/www.kde.org" ) );
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic