[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/applets/quicklaunch
From: Peter Pan <wppan () redflag-linux ! com>
Date: 2009-08-14 13:59:33
Message-ID: 1250258373.288573.22741.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1011382 by peterpan:
give user a hint when he/she adds an application which already exists in quicklaunch.
BUG:203716
M +31 -0 quicklaunchApplet.cpp
M +1 -0 quicklaunchApplet.h
--- trunk/KDE/kdebase/workspace/plasma/applets/quicklaunch/quicklaunchApplet.cpp \
#1011381:1011382 @@ -21,6 +21,7 @@
#include <KConfigDialog>
#include <KDesktopFile>
+#include <KMessageBox>
#include <QGraphicsSceneDragDropEvent>
#include <QGraphicsWidget>
#include <QDrag>
@@ -58,6 +59,7 @@
m_dialogLayout(0),
m_addDialog(0),
m_rightClickedIcon(0),
+ m_isBusy(false),
m_addAction(0),
m_removeAction(0),
m_sortappAscending(0),
@@ -97,6 +99,7 @@
void QuicklaunchApplet::init()
{
+ m_isBusy = true;
KConfigGroup cg = config();
m_preferredIconSize = m_iconSize = qMax(s_defaultIconSize, \
(int)cg.readEntry("iconSize", contentsRect().height() / 2));
m_visibleIcons = qMax(-1, cg.readEntry("visibleIcons", m_visibleIcons));
@@ -148,6 +151,8 @@
if (firstStart) {
resize(sizeHint(Qt::PreferredSize));
}
+
+ m_isBusy = false;
}
QSizeF QuicklaunchApplet::sizeHint(Qt::SizeHint which, const QSizeF & constraint) \
const @@ -396,12 +401,16 @@
void QuicklaunchApplet::ascendingSort()
{
+ m_isBusy = true;
sortQuicklaunch(AscendingSort);
+ m_isBusy = false;
}
void QuicklaunchApplet::descendingSort()
{
+ m_isBusy = true;
sortQuicklaunch(DescendingSort);
+ m_isBusy = false;
}
void QuicklaunchApplet::sortQuicklaunch(SortingOrder sortingorder)
@@ -601,7 +610,29 @@
KIcon icon;
QString text;
QString genericName;
+ bool do_add_program = true;
+ if (!m_isBusy) {
+ foreach (QuicklaunchIcon *icon, m_icons) {
+ if (icon->url().url() == appUrl.url()) {
+ if (KMessageBox::warningContinueCancel(
+ 0,
+ i18n("\"%1\" is already in quicklaunch!", \
icon->url().pathOrUrl()), + i18n("Warning")
+ ) == KMessageBox::Cancel) {
+ do_add_program = false;
+ break;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+
+ if (!do_add_program) {
+ return;
+ }
+
if (appUrl.isLocalFile() && KDesktopFile::isDesktopFile(appUrl.toLocalFile())) {
KDesktopFile *f = new KDesktopFile(appUrl.toLocalFile());
--- trunk/KDE/kdebase/workspace/plasma/applets/quicklaunch/quicklaunchApplet.h \
#1011381:1011382 @@ -178,6 +178,7 @@
Ui::quicklaunchAdd addUi;
QuicklaunchIcon *m_rightClickedIcon;
QPointF m_mousePressPos;
+ bool m_isBusy;
QAction* m_addAction;
QAction* m_removeAction;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic