Re: [PATCH] BUG 167388 inconsistency in ~/.kde4/share/config/trashrc
David Faure 写道: [Too much cross-posting, removing kde-devel from the CC list] On Wednesday 02 September 2009, 潘卫平(Peter Pan) wrote: === --- trashimpl.cpp (revision 1018673) +++ trashimpl.cpp (working copy) @@ -771,6 +771,7 @@ void TrashImpl::fileAdded() { +m_config.reparseConfiguration(); KConfigGroup group = m_config.group( Status ); if ( group.readEntry( Empty, true) == true ) { group.writeEntry( Empty, false ); This one makes sense indeed. Before reading we have to re-read from disk. Well, ideally only if it changed, so another fix would be to use KDirWatch on ktrashrc. r1023611 | peterpan | 2009-09-15 09:38:35 +0800 (二, 2009-09-15) | 3 行 call m_config.reparseConfiguration() when adding a file. BUG:167388 Looking forward to your code using KDirWatch on ktrashrc. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 202473 no sound on emptying trash widget although sound is configured in systemsettings
潘卫平(Peter Pan) 写道: Aaron J. Seigo 写道: On September 1, 2009, 潘卫平(Peter Pan) wrote: How about the patch followed? the applet would need to follow the contents of trash:/ then, so when a file is trashed in dolphin, konqueror or some other app it would become enabled. That has been already done in trash applet using KDirLister. Regards r1023617 | peterpan | 2009-09-15 10:41:17 +0800 (二, 2009-09-15) | 3 行 send a KNotification event when emptying trash. BUG:202473 Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 202473 no sound on emptying trash widget although sound is configured in systemsettings
Aaron J. Seigo 写道: On September 1, 2009, 潘卫平(Peter Pan) wrote: How about the patch followed? the applet would need to follow the contents of trash:/ then, so when a file is trashed in dolphin, konqueror or some other app it would become enabled. That has been already done in trash applet using KDirLister. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
[PATCH] BUG 167388 inconsistency in ~/.kde4/share/config/trashrc
Hi, all When look into BUG 167388, I find that plasma-desktop and dolphin use kio_trash to deal with trash, and class TrashImpl is responsible to keep trashrc consistent. But if more than one kio_trash are created, inconsistency may occur, because TrashImpl doesn't make sure whether the config file is the latest before reading or writing. ReparseConfiguration is expensive, but I can't find better way now. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: trashimpl.cpp === --- trashimpl.cpp (revision 1018673) +++ trashimpl.cpp (working copy) @@ -771,6 +771,7 @@ void TrashImpl::fileAdded() { +m_config.reparseConfiguration(); KConfigGroup group = m_config.group( Status ); if ( group.readEntry( Empty, true) == true ) { group.writeEntry( Empty, false ); @@ -784,6 +785,7 @@ void TrashImpl::fileRemoved() { if ( isEmpty() ) { +m_config.reparseConfiguration(); KConfigGroup group = m_config.group( Status ); group.writeEntry( Empty, true ); m_config.sync(); ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
[PATCH] BUG 202473 no sound on emptying trash widget although sound is configured in systemsettings
Hi, all The plasma trash applet doesn't emit a KNotification when the trash is emptied, so there is no sound. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: trash.cpp === --- trash.cpp (revision 1018113) +++ trash.cpp (working copy) @@ -35,6 +35,7 @@ #include KUrl #include KProcess #include KStandardDirs +#include KNotification #include kfileplacesmodel.h @@ -213,7 +214,6 @@ // we can simply call ktrash. //KonqOperations::emptyTrash(m_menu); emptyTrash-setEnabled(false); -emptyTrash-setText(i18n(Emptying Trashcan...)); m_emptyProcess = new KProcess(this); connect(m_emptyProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(emptyFinished(int,QProcess::ExitStatus))); @@ -226,11 +226,13 @@ { Q_UNUSED(exitCode) Q_UNUSED(exitStatus) + +KNotification::event(Trash: emptied, QString() , QPixmap() , 0l, KNotification::DefaultEvent ); + //TODO: check the exit status and let the user know if it fails delete m_emptyProcess; m_emptyProcess = 0; -emptyTrash-setEnabled(true); -emptyTrash-setText(i18n(Empty Trashcan)); +emptyTrash-setEnabled(false); } void Trash::updateIcon() ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 202473 no sound on emptying trash widget although sound is configured in systemsettings
Alessandro Diaferia 写道: 2009/9/1 潘卫平(Peter Pan) wp...@redflag-linux.com mailto:wp...@redflag-linux.com Hi, all The plasma trash applet doesn't emit a KNotification when the trash is emptied, so there is no sound. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org mailto:Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel +1 for committing this patch from my side Just one little side note: is it really needed to do emptyTrash-setEnabled(false); again in the emptyFinished slot? -- Alessandro Diaferia KDE Developer ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel yes, no need. I think emptyTrash-setEnabled() and emptyTrash-setText() are not necessary. The modified patch is followed. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: trash.cpp === --- trash.cpp (revision 1018141) +++ trash.cpp (working copy) @@ -35,6 +35,7 @@ #include KUrl #include KProcess #include KStandardDirs +#include KNotification #include kfileplacesmodel.h @@ -213,7 +214,6 @@ // we can simply call ktrash. //KonqOperations::emptyTrash(m_menu); emptyTrash-setEnabled(false); -emptyTrash-setText(i18n(Emptying Trashcan...)); m_emptyProcess = new KProcess(this); connect(m_emptyProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(emptyFinished(int,QProcess::ExitStatus))); @@ -226,11 +226,12 @@ { Q_UNUSED(exitCode) Q_UNUSED(exitStatus) + +KNotification::event(Trash: emptied, QString() , QPixmap() , 0l, KNotification::DefaultEvent ); + //TODO: check the exit status and let the user know if it fails delete m_emptyProcess; m_emptyProcess = 0; -emptyTrash-setEnabled(true); -emptyTrash-setText(i18n(Empty Trashcan)); } void Trash::updateIcon() ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 202473 no sound on emptying trash widget although sound is configured in systemsettings
Aaron J. Seigo 写道: On September 1, 2009, 潘卫平(Peter Pan) wrote: yes, no need. the point of that code was to prevent people from emptying the trash while the trash was already emptying. as this can take quite a while, this is a nice feature. it let the user know that their action was successful and prevents people from selecting it over and over. we had this exact problem in 4.0. Although emptyTrash-setEnabled(m_count 0) works well in updateIcon() function, I'd like to do emptyTrash-setEnabled(false) after emptying trash. How about the patch followed? the KNotification bit looks correct, however. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: trash.cpp === --- trash.cpp (revision 1018644) +++ trash.cpp (working copy) @@ -35,6 +35,7 @@ #include KUrl #include KProcess #include KStandardDirs +#include KNotification #include kfileplacesmodel.h @@ -226,10 +227,13 @@ { Q_UNUSED(exitCode) Q_UNUSED(exitStatus) + +KNotification::event(Trash: emptied, QString() , QPixmap() , 0l, KNotification::DefaultEvent ); + //TODO: check the exit status and let the user know if it fails delete m_emptyProcess; m_emptyProcess = 0; -emptyTrash-setEnabled(true); +emptyTrash-setEnabled(false); emptyTrash-setText(i18n(Empty Trashcan)); } ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 203716 give user a hint when adding same application into quicklaunch
Lukas Appelhans 写道: Am Donnerstag 20 August 2009 04:44:29 schrieb 潘卫平(Peter Pan): Lukas Appelhans 写道: Am Mittwoch 19 August 2009 15:51:18 schrieb 潘卫平(Peter Pan): Lukas Appelhans 写道: Am Mittwoch 19 August 2009 14:25:09 schrieb 潘卫平(Peter Pan): Lukas Appelhans 写道: Am Mittwoch 19 August 2009 05:50:08 schrieb 潘卫平(Peter Pan): 潘卫平(Peter Pan) 写道: Aaron J. Seigo 写道: On Friday 14 August 2009, 潘卫平(Peter Pan) wrote: svn r 1011382 there are a couple issues with this patch, unfortunately. first, it introduces a modal dialog. that will block the rest of plasma. not good. :/ That's really not good. second, the button names are just Ok and Cancel, they should be changed to having meaningful labels that say _what_ will happen if Ok or Cancel is pressed. but that's a moot point, because we really can't have a modal dialog here. is there any use case where it makes sense to have more than one icon for the _same_ application or file? i can't think of one. so i'd suggest just silently dropping duplicates. I prefer to show user a warning message rather than drop it silently. -- -- -- -- ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Every time you want to add an application, call checkDuplicateUrls() first.In this function, I give user a hint when we find duplicate URLs, then ignore them. And setModal(false) for KMessageBox. Regards Mmh, I don't like that we iterate through the list 2 times, we should just remove the iteration for checkin duplicates in the addProgram() method imo... I prefer to make the applications in quicklaunch unique, not allow duplicating. Because I don't like that quicklaunch is too wide. Yeah, sure, but why do we iterate through the list 2 times? One time to show the dialog and one time to remove duplicates? that doesn't make much sense to me... :/ oh, because KDialog-show() will return immediately, so first time, I prepare a message for KMessageBox. If we checkin duplicates in addProgram()'s iteration, only the last duplicate application will be shown. And second time iteration, remove duplicates. Well why not let checkDuplicates() return a cleared KUrl::List where all duplicates are removed? I got it. :) This patch looks nice to me... although I think a native english speaker should have a look at the string used in the dialog... but ok, from coding side this patch is ready to go into trunk I think... Thank you for your help. Lukas Lukas Also the KDialog way seems a bit too much to me, isn't there a way to just get a KMessageBox like the command we got before? KMessageBox needs a KDialog parameter. I can't find another way if we use KMessageBox. Okee then leave it that way :) Lukas Lukas ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 203716 give user a hint when adding same application into quicklaunch
Lukas Appelhans 写道: Am Mittwoch 19 August 2009 05:50:08 schrieb 潘卫平(Peter Pan): 潘卫平(Peter Pan) 写道: Aaron J. Seigo 写道: On Friday 14 August 2009, 潘卫平(Peter Pan) wrote: svn r 1011382 there are a couple issues with this patch, unfortunately. first, it introduces a modal dialog. that will block the rest of plasma. not good. :/ That's really not good. second, the button names are just Ok and Cancel, they should be changed to having meaningful labels that say _what_ will happen if Ok or Cancel is pressed. but that's a moot point, because we really can't have a modal dialog here. is there any use case where it makes sense to have more than one icon for the _same_ application or file? i can't think of one. so i'd suggest just silently dropping duplicates. I prefer to show user a warning message rather than drop it silently. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Every time you want to add an application, call checkDuplicateUrls() first.In this function, I give user a hint when we find duplicate URLs, then ignore them. And setModal(false) for KMessageBox. Regards Mmh, I don't like that we iterate through the list 2 times, we should just remove the iteration for checkin duplicates in the addProgram() method imo... I prefer to make the applications in quicklaunch unique, not allow duplicating. Because I don't like that quicklaunch is too wide. Also the KDialog way seems a bit too much to me, isn't there a way to just get a KMessageBox like the command we got before? KMessageBox needs a KDialog parameter. I can't find another way if we use KMessageBox. Lukas ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 203716 give user a hint when adding same application into quicklaunch
Lukas Appelhans 写道: Am Mittwoch 19 August 2009 15:51:18 schrieb 潘卫平(Peter Pan): Lukas Appelhans 写道: Am Mittwoch 19 August 2009 14:25:09 schrieb 潘卫平(Peter Pan): Lukas Appelhans 写道: Am Mittwoch 19 August 2009 05:50:08 schrieb 潘卫平(Peter Pan): 潘卫平(Peter Pan) 写道: Aaron J. Seigo 写道: On Friday 14 August 2009, 潘卫平(Peter Pan) wrote: svn r 1011382 there are a couple issues with this patch, unfortunately. first, it introduces a modal dialog. that will block the rest of plasma. not good. :/ That's really not good. second, the button names are just Ok and Cancel, they should be changed to having meaningful labels that say _what_ will happen if Ok or Cancel is pressed. but that's a moot point, because we really can't have a modal dialog here. is there any use case where it makes sense to have more than one icon for the _same_ application or file? i can't think of one. so i'd suggest just silently dropping duplicates. I prefer to show user a warning message rather than drop it silently. -- -- ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Every time you want to add an application, call checkDuplicateUrls() first.In this function, I give user a hint when we find duplicate URLs, then ignore them. And setModal(false) for KMessageBox. Regards Mmh, I don't like that we iterate through the list 2 times, we should just remove the iteration for checkin duplicates in the addProgram() method imo... I prefer to make the applications in quicklaunch unique, not allow duplicating. Because I don't like that quicklaunch is too wide. Yeah, sure, but why do we iterate through the list 2 times? One time to show the dialog and one time to remove duplicates? that doesn't make much sense to me... :/ oh, because KDialog-show() will return immediately, so first time, I prepare a message for KMessageBox. If we checkin duplicates in addProgram()'s iteration, only the last duplicate application will be shown. And second time iteration, remove duplicates. Well why not let checkDuplicates() return a cleared KUrl::List where all duplicates are removed? I got it. Lukas Also the KDialog way seems a bit too much to me, isn't there a way to just get a KMessageBox like the command we got before? KMessageBox needs a KDialog parameter. I can't find another way if we use KMessageBox. Okee then leave it that way :) Lukas Lukas ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: quicklaunchApplet.h === --- quicklaunchApplet.h ï¼çæ¬ 1013469ï¼ +++ quicklaunchApplet.h ï¼å·¥ä½å¯æ¬ï¼ @@ -149,6 +149,13 @@ void addProgram(int index, const QString desktopFile, bool isNewIcon = false); /** + * Remove duplicate KUrls + * @param urls The urls to be inserted into quicklaunch + * @return the KUrl::List which arleady removed duplications + */ +KUrl::List removeDuplicateUrls(const KUrl::List urls); + +/** * Removes all items from a BoxLayout * @param layout Layout to clear */ Index: quicklaunchApplet.cpp === --- quicklaunchApplet.cpp ï¼çæ¬ 1013469ï¼ +++ quicklaunchApplet.cpp ï¼å·¥ä½å¯æ¬ï¼ @@ -610,29 +610,7 @@ 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()); @@ -694,18 +672,20 @@ if (urls.isEmpty()) { return false; } - -//if there are more than one the last is junk -if (urls.count() 1) { -urls.removeLast(); + +KUrl::List
Re: [PATCH] BUG 203716 give user a hint when adding same application into quicklaunch
潘卫平(Peter Pan) 写道: Aaron J. Seigo 写道: On Friday 14 August 2009, 潘卫平(Peter Pan) wrote: svn r 1011382 there are a couple issues with this patch, unfortunately. first, it introduces a modal dialog. that will block the rest of plasma. not good. :/ That's really not good. second, the button names are just Ok and Cancel, they should be changed to having meaningful labels that say _what_ will happen if Ok or Cancel is pressed. but that's a moot point, because we really can't have a modal dialog here. is there any use case where it makes sense to have more than one icon for the _same_ application or file? i can't think of one. so i'd suggest just silently dropping duplicates. I prefer to show user a warning message rather than drop it silently. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Every time you want to add an application, call checkDuplicateUrls() first.In this function, I give user a hint when we find duplicate URLs, then ignore them. And setModal(false) for KMessageBox. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: quicklaunchApplet.h === --- quicklaunchApplet.h (revision 1013166) +++ quicklaunchApplet.h (working copy) @@ -149,6 +149,12 @@ void addProgram(int index, const QString desktopFile, bool isNewIcon = false); /** + * Check duplicate KUrls + * @param urls The urls to be inserted into quicklaunch + */ +void checkDuplicateUrls(const KUrl::List urls); + +/** * Removes all items from a BoxLayout * @param layout Layout to clear */ Index: quicklaunchApplet.cpp === --- quicklaunchApplet.cpp (revision 1013166) +++ quicklaunchApplet.cpp (working copy) @@ -610,29 +610,15 @@ 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; -} +return; } } } -if (!do_add_program) { -return; -} - if (appUrl.isLocalFile() KDesktopFile::isDesktopFile(appUrl.toLocalFile())) { KDesktopFile *f = new KDesktopFile(appUrl.toLocalFile()); @@ -694,17 +680,15 @@ if (urls.isEmpty()) { return false; } - -//if there are more than one the last is junk -if (urls.count() 1) { -urls.removeLast(); -} - + +checkDuplicateUrls(urls); + foreach (const KUrl url, urls) { if (KDesktopFile::isDesktopFile(url.toLocalFile())) { addProgram(pos, url.toLocalFile(), true); } } + return true; } @@ -728,11 +712,55 @@ void QuicklaunchApplet::addAccepted() { +checkDuplicateUrls(KUrl::List(addUi.urlIcon-url().url())); int insertplace = m_rightClickedIcon ? m_icons.indexOf(m_rightClickedIcon) : m_icons.size(); addProgram(insertplace, addUi.urlIcon-url().url(), true); performUiRefactor(); } +void QuicklaunchApplet::checkDuplicateUrls(const KUrl::List urls) +{ +QStringList duplicateWarningMessage; +duplicateWarningMessage.clear(); + +foreach (const KUrl url, urls) { +foreach (QuicklaunchIcon *icon, m_icons) { +if (icon-url().url() == url.url()) { +duplicateWarningMessage url.pathOrUrl(); +break; +} +} +} + +if (!duplicateWarningMessage.isEmpty()) { +KDialog *warningDialog = new KDialog; +warningDialog-setButtons(KDialog::Ok); +warningDialog-setModal(false); +warningDialog-setDefaultButton(KDialog::Ok); + +QString warningMessage; +int count = duplicateWarningMessage.count(); + +foreach (QString str, duplicateWarningMessage) { +warningMessage += str + \n; +} + +KMessageBox::createKMessageBox(warningDialog, +QMessageBox::Warning, +i18np(%2is already in quicklaunch, ignore it!, + %2are already in quicklaunch, ignore them!, + count, + warningMessage), +QStringList(), +QString(), +NULL, +KMessageBox::NoExec); + +warningDialog-resize(400, 300
[PATCH] BUG 204118 only one dolphin left in quicklaunch after sorting if there are more than one dolphins in quicklaunch before sorting
Hi, all Maybe we should use QMultiHash instead of QHash when sorting. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 204118 only one dolphin left in quicklaunch after sorting if there are more than one dolphins in quicklaunch before sorting
潘卫平(Peter Pan) 写道: Hi, all Maybe we should use QMultiHash instead of QHash when sorting. Regards patch is followed. -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: quicklaunchApplet.cpp === --- quicklaunchApplet.cpp (revision 1012182) +++ quicklaunchApplet.cpp (working copy) @@ -415,7 +415,7 @@ void QuicklaunchApplet::sortQuicklaunch(SortingOrder sortingorder) { -QHash QString,QString quicklaunchHash; +QMultiHash QString,QString quicklaunchHash; KUrl::List urls; QListQString sortedList; QListQString saveSortedUrlList; ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 204118 only one dolphin left in quicklaunch after sorting if there are more than one dolphins in quicklaunch before sorting
潘卫平(Peter Pan) 写道: Hi, all Maybe we should use QMultiHash instead of QHash when sorting. Regards patch is followed. -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: quicklaunchApplet.cpp === --- quicklaunchApplet.cpp (revision 1012182) +++ quicklaunchApplet.cpp (working copy) @@ -415,7 +415,7 @@ void QuicklaunchApplet::sortQuicklaunch(SortingOrder sortingorder) { -QHash QString,QString quicklaunchHash; +QMultiHash QString,QString quicklaunchHash; KUrl::List urls; QListQString sortedList; QListQString saveSortedUrlList; ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
[PATCH] BUG 203716 give user a hint when adding same application into quicklaunch
Hi,all I think we should give user a hint when he/she adds a application which already exists in quicklaunch, so I made this patch. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: quicklaunchApplet.cpp === --- quicklaunchApplet.cpp (revision 1010790) +++ quicklaunchApplet.cpp (working copy) @@ -21,6 +21,7 @@ #include KConfigDialog #include KDesktopFile +#include KMessageBox #include QGraphicsSceneDragDropEvent #include QGraphicsWidget #include QDrag @@ -670,10 +671,32 @@ } foreach (const KUrl url, urls) { -if (KDesktopFile::isDesktopFile(url.toLocalFile())) { -addProgram(pos, url.toLocalFile(), true); +bool found = false; +foreach (QuicklaunchIcon *icon, m_icons) { +if (icon-url().url() == url.url()) { +found = true; +if (KMessageBox::warningContinueCancel( +0, +i18n(\%1\ is already in quicklaunch!\nCancel or Continue?, icon-url().pathOrUrl()), +i18n(Warning) +) == KMessageBox::Continue) { +if (KDesktopFile::isDesktopFile(url.toLocalFile())) { +addProgram(pos, url.toLocalFile(), true); +break; +} +} else { +break; +} +} } + +if (!found) { +if (KDesktopFile::isDesktopFile(url.toLocalFile())) { +addProgram(pos, url.toLocalFile(), true); +} +} } + return true; } @@ -697,6 +720,21 @@ void QuicklaunchApplet::addAccepted() { +foreach (QuicklaunchIcon *icon, m_icons) { +if (icon-url().url() == addUi.urlIcon-url().url()) { +if (KMessageBox::warningContinueCancel( +0, +i18n(\%1\ is already in quicklaunch!\nCancel or Continue?, icon-url().pathOrUrl()), +i18n(Warning)) == KMessageBox::Continue) { +int insertplace = m_rightClickedIcon ? m_icons.indexOf(m_rightClickedIcon) : m_icons.size(); +addProgram(insertplace, addUi.urlIcon-url().url(), true); +performUiRefactor(); +} + +return; +} +} + int insertplace = m_rightClickedIcon ? m_icons.indexOf(m_rightClickedIcon) : m_icons.size(); addProgram(insertplace, addUi.urlIcon-url().url(), true); performUiRefactor(); ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
[PATCH] Bug 203782 missing the last item when you drag more than one desktop files from dolphin into quicklaunch
Hi, all when you drag more than one desktop files from dolphin into quicklaunch, the last desktop will not be inserted into quicklaunch. And the author comments if there are more than one the last is junk. I don't understand it, so I delete it. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: quicklaunchApplet.cpp === --- quicklaunchApplet.cpp (revision 1010790) +++ quicklaunchApplet.cpp (working copy) @@ -664,11 +664,6 @@ return false; } -//if there are more than one the last is junk -if (urls.count() 1) { -urls.removeLast(); -} - foreach (const KUrl url, urls) { if (KDesktopFile::isDesktopFile(url.toLocalFile())) { addProgram(pos, url.toLocalFile(), true); ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 203716 give user a hint when adding same application into quicklaunch
Lukas Appelhans 写道: Am Freitag 14 August 2009 11:10:42 schrieb 潘卫平(Peter Pan): Hi,all I think we should give user a hint when he/she adds a application which already exists in quicklaunch, so I made this patch. Regards Hey! Good thing! But 2 things: I'm not 100% into the code currently, but why not implementing the loop inside addProgram()? In the beginning, I want to quit as soon as possible, to save CPU cycles. But I agree that addProgram() is a more elegant place, but we should pay attention to initializing and sorting. And the second one: Cancel or Continue? is not needed as words inside the MessageBox imo, as the buttons are named like it... \%1\ is already in quicklaunch! should be enough! agree with you. And I modify my patch. Regards, Lukas ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: quicklaunchApplet.h === --- quicklaunchApplet.h (revision 1010790) +++ quicklaunchApplet.h (working copy) @@ -178,6 +178,8 @@ Ui::quicklaunchAdd addUi; QuicklaunchIcon *m_rightClickedIcon; QPointF m_mousePressPos; +bool m_isInitializing; +bool m_isSorting; QAction* m_addAction; QAction* m_removeAction; Index: quicklaunchApplet.cpp === --- quicklaunchApplet.cpp (revision 1010790) +++ quicklaunchApplet.cpp (working copy) @@ -21,6 +21,7 @@ #include KConfigDialog #include KDesktopFile +#include KMessageBox #include QGraphicsSceneDragDropEvent #include QGraphicsWidget #include QDrag @@ -61,7 +62,9 @@ m_addAction(0), m_removeAction(0), m_sortappAscending(0), -m_sortappDescending(0) +m_sortappDescending(0), +m_isInitializing(false), +m_isSorting(false) { setHasConfigurationInterface(true); setAcceptDrops(true); @@ -97,6 +100,7 @@ void QuicklaunchApplet::init() { +m_isInitializing = 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 +152,8 @@ if (firstStart) { resize(sizeHint(Qt::PreferredSize)); } + +m_isInitializing = false; } QSizeF QuicklaunchApplet::sizeHint(Qt::SizeHint which, const QSizeF constraint) const @@ -396,12 +402,16 @@ void QuicklaunchApplet::ascendingSort() { +m_isSorting = true; sortQuicklaunch(AscendingSort); +m_isSorting = false; } void QuicklaunchApplet::descendingSort() { +m_isSorting = true; sortQuicklaunch(DescendingSort); +m_isSorting = false; } void QuicklaunchApplet::sortQuicklaunch(SortingOrder sortingorder) @@ -601,7 +611,29 @@ KIcon icon; QString text; QString genericName; +bool do_add_program = true; +if (!m_isInitializing !m_isSorting) { +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()); ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 203716 give user a hint when adding same application into quicklaunch
Lukas Appelhans 写道: Am Freitag 14 August 2009 14:00:40 schrieb 潘卫平(Peter Pan): Lukas Appelhans 写道: Am Freitag 14 August 2009 11:10:42 schrieb 潘卫平(Peter Pan): Hi,all I think we should give user a hint when he/she adds a application which already exists in quicklaunch, so I made this patch. Regards Hey! Good thing! But 2 things: I'm not 100% into the code currently, but why not implementing the loop inside addProgram()? In the beginning, I want to quit as soon as possible, to save CPU cycles. But I agree that addProgram() is a more elegant place, but we should pay attention to initializing and sorting. And the second one: Cancel or Continue? is not needed as words inside the MessageBox imo, as the buttons are named like it... \%1\ is already in quicklaunch! should be enough! agree with you. And I modify my patch. Ok that looks much nicer... :) Now I think we can merge m_isSorting and m_isInitializing to m_isBusy or m_notAdding or sth like this... done. I use m_isBusy. Thanks a lot. Lukas Regards, Lukas ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: quicklaunchApplet.h === --- quicklaunchApplet.h (revision 1011354) +++ quicklaunchApplet.h (working copy) @@ -178,6 +178,7 @@ Ui::quicklaunchAdd addUi; QuicklaunchIcon *m_rightClickedIcon; QPointF m_mousePressPos; +bool m_isBusy; QAction* m_addAction; QAction* m_removeAction; Index: quicklaunchApplet.cpp === --- quicklaunchApplet.cpp (revision 1011354) +++ quicklaunchApplet.cpp (working copy) @@ -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()); ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 203716 give user a hint when adding same application into quicklaunch
Lukas Appelhans 写道: Am Freitag 14 August 2009 15:11:51 schrieb 潘卫平(Peter Pan): Lukas Appelhans 写道: Am Freitag 14 August 2009 14:00:40 schrieb 潘卫平(Peter Pan): Lukas Appelhans 写道: Am Freitag 14 August 2009 11:10:42 schrieb 潘卫平(Peter Pan): Hi,all I think we should give user a hint when he/she adds a application which already exists in quicklaunch, so I made this patch. Regards Hey! Good thing! But 2 things: I'm not 100% into the code currently, but why not implementing the loop inside addProgram()? In the beginning, I want to quit as soon as possible, to save CPU cycles. But I agree that addProgram() is a more elegant place, but we should pay attention to initializing and sorting. And the second one: Cancel or Continue? is not needed as words inside the MessageBox imo, as the buttons are named like it... \%1\ is already in quicklaunch! should be enough! agree with you. And I modify my patch. Ok that looks much nicer... :) Now I think we can merge m_isSorting and m_isInitializing to m_isBusy or m_notAdding or sth like this... done. I use m_isBusy. Thanks a lot. That looks nice to me! Thanks for your patch! If you have an SVN-Account you can commit it, else I will do it :) Let me do it my self. Many thanks. Lukas Lukas Regards, Lukas ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 203716 give user a hint when adding same application into quicklaunch
潘卫平(Peter Pan) 写道: Lukas Appelhans 写道: Am Freitag 14 August 2009 15:11:51 schrieb 潘卫平(Peter Pan): Lukas Appelhans 写道: Am Freitag 14 August 2009 14:00:40 schrieb 潘卫平(Peter Pan): Lukas Appelhans 写道: Am Freitag 14 August 2009 11:10:42 schrieb 潘卫平(Peter Pan): Hi,all I think we should give user a hint when he/she adds a application which already exists in quicklaunch, so I made this patch. Regards Hey! Good thing! But 2 things: I'm not 100% into the code currently, but why not implementing the loop inside addProgram()? In the beginning, I want to quit as soon as possible, to save CPU cycles. But I agree that addProgram() is a more elegant place, but we should pay attention to initializing and sorting. And the second one: Cancel or Continue? is not needed as words inside the MessageBox imo, as the buttons are named like it... \%1\ is already in quicklaunch! should be enough! agree with you. And I modify my patch. Ok that looks much nicer... :) Now I think we can merge m_isSorting and m_isInitializing to m_isBusy or m_notAdding or sth like this... done. I use m_isBusy. Thanks a lot. That looks nice to me! Thanks for your patch! If you have an SVN-Account you can commit it, else I will do it :) Let me do it my self. Many thanks. svn r 1011382 Lukas Lukas Regards, Lukas ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Regards Reards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
[PATCH] BUG167947 pick a picture and set it as wallpaper in dolphin and konqueror
Hi, all In KDE 3 , it was possible to set a wallpaper by dragging a picture from konqueror. And I implement this feature in Plasma::Containment. Note: When you use this function, the plugin of wallpaper will be set as image, and the mode will be set as SingleImage. I think this is what most people want to do. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: containment.h === --- containment.h (revision 1007852) +++ containment.h (working copy) @@ -540,6 +540,12 @@ */ const QGraphicsItem *toolBoxItem() const; +/** + * set the url as wallpaper + * set the wallpaper plugin as image, and set the mode as SingleImage + */ +void setAsWallpaper(const KUrl url); + private: Q_PRIVATE_SLOT(d, void appletDestroyed(Plasma::Applet*)) Q_PRIVATE_SLOT(d, void containmentAppletAnimationComplete(QGraphicsItem *item, Index: containment.cpp === --- containment.cpp (revision 1007852) +++ containment.cpp (working copy) @@ -24,6 +24,7 @@ #include QApplication #include QClipboard #include QFile +#include QFileInfo #include QGraphicsSceneContextMenuEvent #include QGraphicsView #include QMimeData @@ -1117,7 +1118,22 @@ //TODO: collect the mimetypes of available script engines and offer // to create widgets out of the matching URLs, if any const KUrl::List urls = KUrl::List::fromMimeData(mimeData); + foreach (const KUrl url, urls) { +QMenu choices; +QHashQAction *, QString actionsToPlugins; + +if (urls.count() == 1) { +QFileInfo fileInfo(urls[0].pathOrUrl()); +QString suffix = fileInfo.suffix(); +if (suffix == png || suffix == jpg || suffix == jpeg || suffix == xcf +|| suffix == svg || suffix == svgz) +{ +QIcon icon = KIcon(configure); +actionsToPlugins.insert(choices.addAction(icon, i18n(Set as Wallpaper)), setAsWallpaper); +} +} + KMimeType::Ptr mime = KMimeType::findByUrl(url); QString mimeName = mime-name(); QRectF geom(pos, QSize()); @@ -1129,8 +1145,6 @@ if (!appletList.isEmpty()) { //TODO: should we show a dialog here to choose which plasmoid load if //!appletList.isEmpty() -QMenu choices; -QHashQAction *, QString actionsToPlugins; foreach (const KPluginInfo info, appletList) { QAction *action; if (!info.icon().isEmpty()) { @@ -1143,15 +1157,20 @@ } actionsToPlugins.insert(choices.addAction(i18n(Icon)), icon); -QAction *choice = choices.exec(screenPos); -if (choice) { -q-addApplet(actionsToPlugins[choice], args, geom); -} } else if (url.protocol() != data) { // We don't try to do anything with data: URIs // no special applet associated with this mimetype, let's -q-addApplet(icon, args, geom); +actionsToPlugins.insert(choices.addAction(i18n(Icon)), icon); } + +QAction *choice = choices.exec(screenPos); +if (choice) { +if (actionsToPlugins[choice] == setAsWallpaper) { +q-setAsWallpaper(url); +return; +} +q-addApplet(actionsToPlugins[choice], args, geom); +} } if (dropEvent) { @@ -2043,6 +2062,38 @@ } } +void Containment::setAsWallpaper(const KUrl url) +{ +QString pluginName = image; +QString mode = SingleImage; + +KConfigGroup cfg = config(); + +if (d-drawWallpaper) { +if (d-wallpaper) { +if (d-wallpaper-pluginName() != pluginName) { +delete d-wallpaper; +d-wallpaper = 0; +} +} + +if (!d-wallpaper) { +d-wallpaper = Plasma::Wallpaper::load(pluginName); +} + +if (d-wallpaper) { +cfg.writeEntry(wallpaperplugin, pluginName); +cfg.writeEntry(wallpaperpluginmode, mode); +KConfigGroup wallpaperConfig = KConfigGroup(cfg, Wallpaper); +wallpaperConfig = KConfigGroup(wallpaperConfig, pluginName); +wallpaperConfig.writeEntry(wallpaper, url.pathOrUrl()); +} +} + +emit configNeedsSaving(); +setWallpaper(pluginName, mode); +} + } // Plasma namespace #include containment.moc ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org
Re: [PATCH] BUG167947 pick a picture and set it as wallpaper in dolphin and konqueror
Chani 写道: On August 6, 2009 03:53:10 Aaron J. Seigo wrote: On Thursday 06 August 2009, 潘卫平(Peter Pan) wrote: In KDE 3 , it was possible to set a wallpaper by dragging a picture from konqueror. And I implement this feature in Plasma::Containment. i don't think this is really the right place for this code (in Containment); rather, i think this would be better implemented as an extension to Chani's containment actions project. not all libplasma based applications will want to have images dropped on them setting the background, so this is really something that needs to be done per- application. being able to define the default actions for dropped data therefore seems to make more sense. :/ I guess it'd be possible to move all the dragdrop code into the paste plugin and add a hack to store that plugin under some special key and call it with the drag event... if it ever gets a config UI, though, you'd have trouble. right now they'd share the same config, which might be surprising. if I fix that then there'd be no way to configure dragdrop, unless you stick a button for it somewhere... Where can I get some inforamtion about the paste plugin and your containment actions project? also, 潘, would you be able to put your patches on reviewboard.kde.org instead of emailing them? it's easier to track them there. :) Sure. I'm new to KDE, and I didn't know where is the proper place to send my patch. I thought if the patch is mature, reviewboard is the proper place, if not, mailing list is the proper place. Am I right? Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 184905 Size of the panel changes when the plasma theme changes
Aaron J. Seigo 写道: On Sunday 02 August 2009, 潘卫平(Peter Pan) wrote: The reason is that the margins of panel's layout isn't equal to the margins of panel's background. (kdebase/workspace/plasma/containments/panel/panel.cpp line 678-684) yes, i think your patch is correct. nice one :) ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel svn commit r1006608 Don't change the size of panel when we change the plasma theme or enable/disable window effects. BUG:184905 Many thanks. -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
[PATCH] BUG 184905 Size of the panel changes when the plasma theme changes
Hi, all These days I've been working on BUG 184905. I found that the size of panel changes when it receives a thememChanged signal from Plasma::Theme::defaultTheme(). And this signal is sended when we change the plasma theme or enable/disable window effects. The reason is that the margins of panel's layout isn't equal to the margins of panel's background. (kdebase/workspace/plasma/containments/panel/panel.cpp line 678-684) And I found that it is not necessary to adjust margins for toolBoxItem, (kdebase/workspace/plasma/containments/panel/panel.cpp line 553-568) because the geometry of toolBoxItem is controlled by Plasma::Containment. I'm not sure whether my understanding is correct. ): Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: panel.cpp === --- panel.cpp ï¼çæ¬ 1006104ï¼ +++ panel.cpp ï¼å·¥ä½å¯æ¬ï¼ @@ -550,23 +550,6 @@ //invalidate the layout and set again if (layout()) { -switch (location()) { -case LeftEdge: -rightWidth = qMin(rightWidth, qMax(qreal(1), size().width() - KIconLoader::SizeMedium)); -break; -case RightEdge: -leftWidth = qMin(leftWidth, qMax(qreal(1), size().width() - KIconLoader::SizeMedium)); -break; -case TopEdge: -bottomHeight = qMin(bottomHeight, qMax(qreal(1), size().height() - KIconLoader::SizeMedium)); -break; -case BottomEdge: -topHeight = qMin(topHeight, qMax(qreal(1), size().height() - KIconLoader::SizeMedium)); -break; -default: -break; -} - qreal oldLeft = leftWidth; qreal oldTop = topHeight; qreal oldRight = rightWidth; ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 189643 Taskbar should be animated while program is starting
Aaron J. Seigo 写道: On Wednesday 29 July 2009, 潘卫平 wrote: Third, I set the BusyWidgest's geometry in AbstractTaskItem::drawTask(), so it can get the proper geometry. patch looks good; i only wonder if there's a better place to put the setGeometry for the busy widget than in a paintEvent, but this seems like it should be alright and probably as good as any other. thanks for the patch, please commit :) ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel SVN commit 1004385 by peterpan: Thank you very much. -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 199107 make the popup dialog of group hide automatically on taskbar
Aaron J. Seigo 写道: On Sunday 26 July 2009, 潘卫平(Peter Pan) wrote: Any idea to improve it? i think the last patch you posted can be committed to trunk ... ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel svn commit r 1001921 reject showing tooltips when the popup dialog is showing. BUG:199107 regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 199107 make the popup dialog of group hide automatically on taskbar
潘卫平(Peter Pan) 写道: Aaron J. Seigo 写道: On Thursday 16 July 2009, 潘卫平(Peter Pan) wrote: For tooltips, I agree that they are less important than the popup dialog, so I made another patch to reject showing tooltips when a popup dialog is showing. looks good :) Thanks for your comments. Shall I commit it, or wait some time for reviews ? Any comments are welcomed! Regards Hi, all Has anybody tried this patch? Any idea to improve it? Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 189643 Taskbar should be animated while program is starting
Aaron J. Seigo 写道: On Wednesday 22 July 2009, Aaron J. Seigo wrote: On Tuesday 21 July 2009, 潘卫平(Peter Pan) wrote: Do you mean that I should use Plasma::BusyWidget ? yes I made a patch using Plasma::BusyWidget, It looks fine. i wonder if it wouldn't make more sense to show it in place of the icon or perhaps over top of the icon... Taht will cover the icon and looks mussy. I prefer to let it over the text. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel I make the animation over the text and next to the icon. Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: windowtaskitem.cpp === --- windowtaskitem.cpp (revision 1001421) +++ windowtaskitem.cpp (working copy) @@ -21,6 +21,7 @@ // Own #include windowtaskitem.h #include taskgroupitem.h +#include taskitemlayout.h // Qt #include QGraphicsSceneContextMenuEvent @@ -60,7 +61,9 @@ WindowTaskItem::WindowTaskItem(QGraphicsWidget *parent, Tasks *applet) : AbstractTaskItem(parent, applet), - m_task(0) + m_task(0), + m_startupTimer(0), + m_busyWidget(0) { } @@ -219,6 +222,7 @@ connect(task, SIGNAL(gotTaskPointer()), this, SLOT(gotTaskPointer())); setText(task-startup()-text()); setIcon(KIcon(task-startup()-icon())); +startStartupAnimation(8000); } void WindowTaskItem::gotTaskPointer() @@ -226,6 +230,7 @@ //kDebug(); TaskManager::TaskItem *item = qobject_castTaskManager::TaskItem*(sender()); if (item) { +stopStartupAnimation(); setWindowTask(item); } } @@ -322,5 +327,35 @@ } } +void WindowTaskItem::startStartupAnimation(int duration) +{ +if (!m_startupTimer) { +m_startupTimer = new QTimer(this); +m_startupTimer-setSingleShot(true); +connect(m_startupTimer, SIGNAL(timeout()), this, SLOT(stopStartupAnimation())); +} + +QRectF rect = parentGroup()-tasksLayout()-contentsRect(); +int rowCount = parentGroup()-tasksLayout()-rowCount(); +qreal height = rect.height() / rowCount; +QSizeF size(height, height); + +if (!m_busyWidget) { +m_busyWidget = new Plasma::BusyWidget(this); +} + +QRectF animationRect(QPointF(height, 0), size); +m_busyWidget-setGeometry(animationRect); +m_startupTimer-start(duration); +} + +void WindowTaskItem::stopStartupAnimation() +{ +delete m_busyWidget; +m_busyWidget = 0; + +delete m_startupTimer; +m_startupTimer = 0; +} #include windowtaskitem.moc Index: windowtaskitem.h === --- windowtaskitem.h (revision 1001421) +++ windowtaskitem.h (working copy) @@ -27,6 +27,7 @@ #include taskmanager/taskmanager.h #include taskmanager/taskitem.h +#include Plasma/BusyWidget /** * A task item for a task which represents a window on the desktop. */ @@ -71,6 +72,7 @@ private slots: void updateTask(::TaskManager::TaskChanges changes); void gotTaskPointer(); +void stopStartupAnimation(); private: /** Sets the starting task represented by this item. */ @@ -79,7 +81,12 @@ /** Sets the window represented by this task. */ void setWindowTask(TaskManager::TaskItem* taskItem); +void startStartupAnimation(int duration); + TaskManager::TaskItem *m_task; +QTimer *m_startupTimer; + +Plasma::BusyWidget *m_busyWidget; }; #endif ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 189643 Taskbar should be animated while program is starting
Aaron J. Seigo 写道: On Saturday 18 July 2009, 潘卫平(Peter Pan) wrote: Any comments are warmly welcomed! how about using the standard plasma busy animation? no need for new icons and it will be consistent with everything else. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Do you mean that I should use Plasma::BusyWidget ? I made a patch using Plasma::BusyWidget, It looks fine. The patch should apply to kdebase/workspace/plasma/applets/tasks/. Regards! -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: windowtaskitem.cpp === --- windowtaskitem.cpp (revision 1000338) +++ windowtaskitem.cpp (working copy) @@ -21,6 +21,7 @@ // Own #include windowtaskitem.h #include taskgroupitem.h +#include taskitemlayout.h // Qt #include QGraphicsSceneContextMenuEvent @@ -60,7 +61,9 @@ WindowTaskItem::WindowTaskItem(QGraphicsWidget *parent, Tasks *applet) : AbstractTaskItem(parent, applet), - m_task(0) + m_task(0), + m_startupTimer(0), + m_busyWidget(0) { } @@ -219,6 +222,7 @@ connect(task, SIGNAL(gotTaskPointer()), this, SLOT(gotTaskPointer())); setText(task-startup()-text()); setIcon(KIcon(task-startup()-icon())); +startStartupAnimation(8000); } void WindowTaskItem::gotTaskPointer() @@ -226,6 +230,7 @@ //kDebug(); TaskManager::TaskItem *item = qobject_castTaskManager::TaskItem*(sender()); if (item) { +stopStartupAnimation(); setWindowTask(item); } } @@ -322,5 +327,36 @@ } } +void WindowTaskItem::startStartupAnimation(int duration) +{ +if (!m_startupTimer) { +m_startupTimer = new QTimer(this); +m_startupTimer-setSingleShot(true); +connect(m_startupTimer, SIGNAL(timeout()), this, SLOT(stopStartupAnimation())); +} + +QRectF rect = parentGroup()-tasksLayout()-contentsRect(); +int rowCount = parentGroup()-tasksLayout()-rowCount(); +qreal height = rect.height() / rowCount; +QSizeF size(height, height); + +if (!m_busyWidget) { +m_busyWidget = new Plasma::BusyWidget(this); +} + +m_busyWidget-resize(size); +m_startupTimer-start(duration); +} + +void WindowTaskItem::stopStartupAnimation() +{ +if (m_busyWidget) { +delete m_busyWidget; +} + +if (m_startupTimer) { +delete m_startupTimer; +} +} #include windowtaskitem.moc Index: windowtaskitem.h === --- windowtaskitem.h (revision 1000338) +++ windowtaskitem.h (working copy) @@ -27,6 +27,7 @@ #include taskmanager/taskmanager.h #include taskmanager/taskitem.h +#include Plasma/BusyWidget /** * A task item for a task which represents a window on the desktop. */ @@ -71,6 +72,7 @@ private slots: void updateTask(::TaskManager::TaskChanges changes); void gotTaskPointer(); +void stopStartupAnimation(); private: /** Sets the starting task represented by this item. */ @@ -79,7 +81,12 @@ /** Sets the window represented by this task. */ void setWindowTask(TaskManager::TaskItem* taskItem); +void startStartupAnimation(int duration); + TaskManager::TaskItem *m_task; +QTimer *m_startupTimer; + +Plasma::BusyWidget *m_busyWidget; }; #endif ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
[PATCH] BUG 189643 Taskbar should be animated while program is starting
Hi, all In KDE3, when I start a programm, the taskbar-panel shows a turning-sand-clock while the programm starts. I would like that back in KDE4. I try to make a patch to fix this BUG, but I don't known how to realize a turning-sand-clock effect, so I choose icons like go-up, go-next, go-down and go-previous to test my code. I really want to realize a turning-sand-clock effect, but I don't known how to do it. Maybe some icons should be added? Any comments are warmly welcomed! Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: windowtaskitem.cpp === --- windowtaskitem.cpp (revision 998718) +++ windowtaskitem.cpp (working copy) @@ -60,7 +60,8 @@ WindowTaskItem::WindowTaskItem(QGraphicsWidget *parent, Tasks *applet) : AbstractTaskItem(parent, applet), - m_task(0) + m_task(0), + m_startupTimerId(0) { } @@ -219,6 +220,7 @@ connect(task, SIGNAL(gotTaskPointer()), this, SLOT(gotTaskPointer())); setText(task-startup()-text()); setIcon(KIcon(task-startup()-icon())); +startStartupAnimation(5000); } void WindowTaskItem::gotTaskPointer() @@ -226,6 +228,7 @@ //kDebug(); TaskManager::TaskItem *item = qobject_castTaskManager::TaskItem*(sender()); if (item) { +stopStartupAnimation(); setWindowTask(item); } } @@ -322,5 +325,35 @@ } } +void WindowTaskItem::startStartupAnimation(int duration) +{ +m_startupTimerId = Plasma::Animator::self()-customAnimation(100, duration, Plasma::Animator::EaseInCurve, this, startupAnimationUpdate); +} + +void WindowTaskItem::startupAnimationUpdate(qreal progress) +{ +// choose some icons to test +static int n = 0; +if (n % 4 == 0) { +n = 0; +m_icon = KIcon(go-up); +} else if (n % 4 == 1){ +m_icon = KIcon(go-next); +} else if (n % 4 == 2){ +m_icon = KIcon(go-down); +} else if (n % 4 == 3){ +m_icon = KIcon(go-previous); +} + +n++; +update(); +} + +void WindowTaskItem::stopStartupAnimation() +{ +if (m_startupTimerId) { +Plasma::Animator::self()-stopCustomAnimation(m_startupTimerId); +} +} #include windowtaskitem.moc Index: windowtaskitem.h === --- windowtaskitem.h (revision 998718) +++ windowtaskitem.h (working copy) @@ -71,6 +71,7 @@ private slots: void updateTask(::TaskManager::TaskChanges changes); void gotTaskPointer(); +void startupAnimationUpdate(qreal progress); private: /** Sets the starting task represented by this item. */ @@ -79,7 +80,11 @@ /** Sets the window represented by this task. */ void setWindowTask(TaskManager::TaskItem* taskItem); +void startStartupAnimation(int duration); +void stopStartupAnimation(); + TaskManager::TaskItem *m_task; +int m_startupTimerId; }; #endif ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 199107 make the popup dialog of group hide automatically on taskbar
Aaron J. Seigo 写道: On Friday 10 July 2009, 潘卫平(Peter Pan) wrote: I still think that hiding the popup automatically is more convenient than rejecting showing tooltip and context menu. for context menus, i agree. if a context menu i shown, the task group popup should also go away. that's a general issues, though (any right click menu on any widget will not hide the group popup). so looks like there's a bug in the code that decides when to hide the group popup in those cases. this is probably made a bit trickier because you can pull up a context menu on items _inside_ the group popup! however, for tooltips, i really don't think they are important enough to be shown when a group is already open. ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel Since the problem is too complicated, maybe we should divide and conquer it. For context menus, maybe it's a bug in Qt? I'll look into it later. For tooltips, I agree that they are less important than the popup dialog, so I made another patch to reject showing tooltips when a popup dialog is showing. Regards! -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd Index: taskgroupitem.cpp === --- taskgroupitem.cpp (revision 997661) +++ taskgroupitem.cpp (working copy) @@ -188,6 +188,7 @@ //close the popup if the group is removed if (m_popupDialog) { m_popupDialog-hide(); +disconnect(m_popupDialog, 0, 0, 0); m_popupDialog-deleteLater(); m_popupDialog = 0; } @@ -263,6 +264,13 @@ return; } +QWidget * dialog = m_applet-popupDialog(); + +if (dialog dialog-isVisible()) { +Plasma::ToolTipManager::self()-clearContent(this); +return; +} + Plasma::ToolTipContent data(m_group-name(), i18nc(Which virtual desktop a window is currently on, On %1, KWindowSystem::desktopName(m_group-desktop(; @@ -598,6 +606,7 @@ if (!m_popupDialog) { // Initialize popup dialog m_popupDialog = new Plasma::Dialog(); +connect(m_popupDialog, SIGNAL(dialogVisible(bool)), m_applet, SLOT(setPopupDialog(bool))); KWindowSystem::setState(m_popupDialog-winId(), NET::SkipTaskbar| NET::SkipPager); m_popupDialog-setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); //TODO in the future it may be possible to use the Qt::Popup flag instead of the eventFilter, but for now the focus works better with the eventFilter Index: windowtaskitem.cpp === --- windowtaskitem.cpp (revision 997661) +++ windowtaskitem.cpp (working copy) @@ -185,21 +185,41 @@ { if (!m_task) { return; -} +} + +bool showToolTip = true; +TaskGroupItem *group = parentGroup(); -QPixmap p = m_task-task()-icon(KIconLoader::SizeLarge, KIconLoader::SizeLarge, false); -if (p.height() KIconLoader::SizeLarge) { -p = p.scaled(QSize(KIconLoader::SizeLarge, KIconLoader::SizeLarge), - Qt::KeepAspectRatio, Qt::SmoothTransformation); -} +if (group) { +QWidget *groupPopupDialog = parentGroup()-popupDialog(); +QWidget *dialog = m_applet-popupDialog(); -Plasma::ToolTipContent data(m_task-name(), -i18nc(Which virtual desktop a window is currently on, On %1, - KWindowSystem::desktopName(m_task-desktop())), p); -data.setWindowToPreview(m_task-task()-window()); -data.setClickable(true); +if (dialog dialog-isVisible()) { +if (groupPopupDialog groupPopupDialog == dialog) { +showToolTip = true; +} else { +showToolTip = false; +} +} +} + +if (showToolTip) { +QPixmap p = m_task-task()-icon(KIconLoader::SizeLarge, KIconLoader::SizeLarge, false); +if (p.height() KIconLoader::SizeLarge) { +p = p.scaled(QSize(KIconLoader::SizeLarge, KIconLoader::SizeLarge), +Qt::KeepAspectRatio, Qt::SmoothTransformation); +} -Plasma::ToolTipManager::self()-setContent(this, data); +Plasma::ToolTipContent data(m_task-name(), +i18nc(Which virtual desktop a window is currently on, On %1, +KWindowSystem::desktopName(m_task-desktop())), p); +data.setWindowToPreview(m_task-task()-window()); +data.setClickable(true); + +Plasma::ToolTipManager::self()-setContent(this, data); +} else { +Plasma::ToolTipManager::self()-clearContent(this); +} } void WindowTaskItem::setStartupTask(TaskItem
Re: [PATCH] BUG 199107 make the popup dialog of group hide automatically on taskbar
Aaron J. Seigo 写道: On Thursday 16 July 2009, 潘卫平(Peter Pan) wrote: For tooltips, I agree that they are less important than the popup dialog, so I made another patch to reject showing tooltips when a popup dialog is showing. looks good :) Thanks for your comments. Shall I commit it, or wait some time for reviews ? Any comments are welcomed! Regards -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
Re: [PATCH] BUG 198888 BUG 198890 about icon and text on plasma tooltip
Hi, Today I get my KDE svn account, and commit the above two patches by myself. BUG 19, svn r 993309 BUG 198890, svn r 993317 Thank you for your help and encouragement. -- 潘卫平(Peter Pan) Red Flag Software Co., Ltd ___ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel
[PATCH] BUG 199107 make the popup dialog of group hide au tomatically on taskbar
Hi, all The patch is related to grouping of tasks on taskbar. I think that we should make the popup dialog of group hide automatically, seem to be more intelligent. When the mouse move out of the popup dialog of the group, and it isn't hovering on the group, I let the dialog hide automically. regards -- 潘卫平(Peter Pan) Index: taskgroupitem.cpp === --- taskgroupitem.cpp (revision 992092) +++ taskgroupitem.cpp (working copy) @@ -59,6 +59,7 @@ m_group(0), m_tasksLayout(0), m_popupMenuTimer(0), + m_hidePopupMenuTimer(0), m_lastActivated(-1), m_activeTaskIndex(0), m_maximumRows(1), @@ -69,6 +70,7 @@ m_offscreenWidget(0), m_offscreenLayout(0), m_collapsed(true), + m_windowItemContextMenuIsShown(false), m_mainLayout(0), m_popupDialog(0), m_popupLostFocus(false) @@ -475,6 +477,7 @@ if (isNew) { connect(item, SIGNAL(activated(AbstractTaskItem*)), this, SLOT(updateActive(AbstractTaskItem*))); +connect(item, SIGNAL(contextMenuIsShown(bool)), this, SLOT(setWindowPopupMenuIsShown(bool))); TaskGroupItem *group = qobject_castTaskGroupItem*(item); if (group) { @@ -591,6 +594,13 @@ m_popupDialog-getContentsMargins(left, top, right, bottom); m_offscreenWidget-setMinimumWidth(size().width() - left - right); m_popupDialog-setGraphicsWidget(m_offscreenWidget); + +if (!m_hidePopupMenuTimer) { +m_hidePopupMenuTimer = new QTimer(this); +m_hidePopupMenuTimer-setSingleShot(true); +m_hidePopupMenuTimer-setInterval(500); +connect(m_hidePopupMenuTimer, SIGNAL(timeout()), this, SLOT(hidePopupMenu())); +} } if (m_popupDialog-isVisible()) { @@ -621,6 +631,14 @@ bool TaskGroupItem::eventFilter(QObject *watched, QEvent *event) { +if (watched == m_popupDialog event-type() == QEvent::Enter) { +m_hidePopupMenuTimer-stop(); +} + +if (watched == m_popupDialog event-type() == QEvent::Leave !m_windowItemContextMenuIsShown) { +m_hidePopupMenuTimer-start(500); +} + if (watched == m_popupDialog event-type() == QEvent::WindowDeactivate) { Q_ASSERT(m_popupDialog); m_popupLostFocus = true; //avoid opening it again when clicking on the group @@ -1267,5 +1285,46 @@ return m_popupDialog; } +void TaskGroupItem::hidePopupMenu() +{ +if (m_popupDialog) { +if (m_applet-location() != Plasma::Floating) { +m_popupDialog-animatedHide(Plasma::locationToInverseDirection(m_applet-location())); +} else { +m_popupDialog-hide(); +} +} +} + +void TaskGroupItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) +{ +if (m_hidePopupMenuTimer) { +m_hidePopupMenuTimer-stop(); +} + +AbstractTaskItem::hoverEnterEvent(event); +} + +void TaskGroupItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) +{ +if (m_hidePopupMenuTimer) { +m_hidePopupMenuTimer-start(500); +} + +AbstractTaskItem::hoverLeaveEvent(event); +} + +void TaskGroupItem::setWindowPopupMenuIsShown(bool isShown) +{ +m_windowItemContextMenuIsShown = isShown; + +if (m_hidePopupMenuTimer) { +if (m_windowItemContextMenuIsShown) { +m_hidePopupMenuTimer-stop(); +} else { +m_hidePopupMenuTimer-start(500); +} +} +} #include taskgroupitem.moc Index: taskgroupitem.h === --- taskgroupitem.h (revision 992092) +++ taskgroupitem.h (working copy) @@ -143,6 +143,8 @@ void handleDroppedId(WId id, AbstractTaskItem *targetTask, QGraphicsSceneDragDropEvent *event); +void hoverEnterEvent(QGraphicsSceneHoverEvent *event); +void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event); @@ -169,6 +171,8 @@ void itemPositionChanged(AbstractGroupableItem *); void popupMenu(); +void hidePopupMenu(); +void setWindowPopupMenuIsShown(bool isShown); /** force a relayout of all items */ void relayoutItems(); @@ -193,6 +197,7 @@ TaskItemLayout *m_tasksLayout; QTimer *m_popupMenuTimer; +QTimer *m_hidePopupMenuTimer; QHashint, Order m_taskOrder; int m_lastActivated; int m_activeTaskIndex; @@ -205,6 +210,7 @@ QGraphicsWidget *m_offscreenWidget; QGraphicsLinearLayout *m_offscreenLayout; bool m_collapsed; +bool m_windowItemContextMenuIsShown; QGraphicsLinearLayout *m_mainLayout; Plasma::Dialog *m_popupDialog; bool m_popupLostFocus; Index: windowtaskitem.cpp === --- windowtaskitem.cpp