* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "infosidebarpage.h"
***************************************************************************/
#include "infosidebarpage.h"
- const KFileItemList* selectedItems = view->selectedItems();
- if ((selectedItems != 0) && selectedItems->count() > 1) {
+ const KFileItemList selectedItems = view->selectedItems();
+ if (selectedItems.count() > 1) {
connect(job, SIGNAL(gotPreview(const KFileItem*, const QPixmap&)),
this, SLOT(gotPreview(const KFileItem*, const QPixmap&)));
connect(job, SIGNAL(failed(const KFileItem*)),
connect(job, SIGNAL(gotPreview(const KFileItem*, const QPixmap&)),
this, SLOT(gotPreview(const KFileItem*, const QPixmap&)));
connect(job, SIGNAL(failed(const KFileItem*)),
this, SLOT(requestItemInfo(const KUrl&)));
m_shownUrl = view->url();
this, SLOT(requestItemInfo(const KUrl&)));
m_shownUrl = view->url();
QLabel* info = new QLabel(infoText, m_infoGrid);
info->setTextFormat(Qt::RichText);
QLabel* info = new QLabel(infoText, m_infoGrid);
info->setTextFormat(Qt::RichText);
// of KFileItems. If no selection is given, a temporary KFileItem
// by the given Url 'url' is created and added to the list.
KFileItem fileItem(S_IFDIR, KFileItem::Unknown, m_shownUrl);
// of KFileItems. If no selection is given, a temporary KFileItem
// by the given Url 'url' is created and added to the list.
KFileItem fileItem(S_IFDIR, KFileItem::Unknown, m_shownUrl);
- KFileItemList localList;
- const KFileItemList* itemList = mainWindow()->activeView()->selectedItems();
- if ((itemList == 0) || itemList->isEmpty()) {
+ KFileItemList itemList = mainWindow()->activeView()->selectedItems();
+ if (itemList.isEmpty()) {
QStringList dirs = KGlobal::dirs()->findDirs("data", "dolphin/servicemenus/");
for (QStringList::ConstIterator dirIt = dirs.begin(); dirIt != dirs.end(); ++dirIt) {
QDir dir(*dirIt);
QStringList dirs = KGlobal::dirs()->findDirs("data", "dolphin/servicemenus/");
for (QStringList::ConstIterator dirIt = dirs.begin(); dirIt != dirs.end(); ++dirIt) {
QDir dir(*dirIt);
for (QStringList::ConstIterator entryIt = entries.begin(); entryIt != entries.end(); ++entryIt) {
KSimpleConfig cfg(*dirIt + *entryIt, true);
cfg.setDesktopGroup();
if ((cfg.hasKey("Actions") || cfg.hasKey("X-KDE-GetActionMenu")) && cfg.hasKey("ServiceTypes")) {
for (QStringList::ConstIterator entryIt = entries.begin(); entryIt != entries.end(); ++entryIt) {
KSimpleConfig cfg(*dirIt + *entryIt, true);
cfg.setDesktopGroup();
if ((cfg.hasKey("Actions") || cfg.hasKey("X-KDE-GetActionMenu")) && cfg.hasKey("ServiceTypes")) {
for (QStringList::ConstIterator it = types.begin(); it != types.end(); ++it) {
// check whether the mime type is equal or whether the
// mimegroup (e. g. image/*) is supported
for (QStringList::ConstIterator it = types.begin(); it != types.end(); ++it) {
// check whether the mime type is equal or whether the
// mimegroup (e. g. image/*) is supported
if ((*it) == "all/allfiles") {
// The service type is valid for all files, but not for directories.
// Check whether the selected items only consist of files...
if ((*it) == "all/allfiles") {
// The service type is valid for all files, but not for directories.
// Check whether the selected items only consist of files...
// Check whether the MIME types of all selected files match
// to the mimetype of the service action. As soon as one MIME
// type does not match, no service menu is shown at all.
// Check whether the MIME types of all selected files match
// to the mimetype of the service action. As soon as one MIME
// type does not match, no service menu is shown at all.
insert = true;
while (insert && mimeIt.hasNext()) {
KFileItem* item = mimeIt.next();
const QString mimeType(item->mimetype());
insert = true;
while (insert && mimeIt.hasNext()) {
KFileItem* item = mimeIt.next();
const QString mimeType(item->mimetype());
for (serviceIt = userServices.begin(); serviceIt != userServices.end(); ++serviceIt) {
KDEDesktopMimeType::Service service = (*serviceIt);
if (popup == 0) {
for (serviceIt = userServices.begin(); serviceIt != userServices.end(); ++serviceIt) {
KDEDesktopMimeType::Service service = (*serviceIt);
if (popup == 0) {
setFocusPolicy(Qt::NoFocus);
connect(this, SIGNAL(released()),
this, SLOT(slotReleased()));
setFocusPolicy(Qt::NoFocus);
connect(this, SIGNAL(released()),
this, SLOT(slotReleased()));
- const QIcon* set = iconSet();
- if (set != 0) {
- painter.drawPixmap(x, y, set->pixmap(QIcon::Small, QIcon::Normal));
+ const QIcon &set = icon();
+ if (!set.isNull()) {
+ painter.drawPixmap(x, y, set.pixmap(QIcon::Small, QIcon::Normal));