SVN commit 489312 by jahrens: Added copy/paste to AlbumIconView. Now its possible to copy images from outside digikam (like konqi) or between albums via copy/paste. Todo: cut CCMAIL: [hidden email] M +97 -3 albumiconview.cpp M +3 -0 albumiconview.h --- trunk/extragear/graphics/digikam/digikam/albumiconview.cpp #489311:489312 @@ -48,6 +48,7 @@ #include <qdict.h> #include <qdatastream.h> #include <qtimer.h> +#include <qclipboard.h> // KDE includes. @@ -211,6 +212,9 @@ connect(this, SIGNAL(signalRightButtonClicked(IconItem*, const QPoint &)), this, SLOT(slotRightButtonClicked(IconItem*, const QPoint &))); + connect(this, SIGNAL(signalRightButtonClicked(const QPoint &)), + this, SLOT(slotRightButtonClicked(const QPoint &))); + connect(this, SIGNAL(signalSelectionChanged()), this, SLOT(slotSelectionChanged())); @@ -415,14 +419,35 @@ slotDisplayItem(static_cast<AlbumIconItem *>(item)); } +void AlbumIconView::slotRightButtonClicked(const QPoint& pos) +{ + if(d->currentAlbum->isRoot() || + ( d->currentAlbum->type() != Album::PHYSICAL + && d->currentAlbum->type() != Album::TAG)) + { + return; + } + + QPopupMenu popmenu(this); + KAction *paste = KStdAction::paste(this, SLOT(slotPaste()), 0); + QMimeSource *data = kapp->clipboard()->data(QClipboard::Clipboard); + if(!data || !QUriDrag::canDecode(data)) + { + paste->setEnabled(false); + } + paste->plug(&popmenu); + popmenu.exec(pos); + delete paste; +} + void AlbumIconView::slotRightButtonClicked(IconItem *item, const QPoint& pos) { - if (!item) return; - + if (!item) + return; + AlbumIconItem* iconItem = static_cast<AlbumIconItem *>(item); - // -------------------------------------------------------- KMimeType::Ptr mimePtr = KMimeType::findByURL(iconItem->imageInfo()->kurl(), @@ -464,6 +489,18 @@ } popmenu.insertSeparator(); + + KAction *copy = KStdAction::copy(this, SLOT(slotCopy()), 0); + KAction *paste = KStdAction::paste(this, SLOT(slotPaste()), 0); + QMimeSource *data = kapp->clipboard()->data(QClipboard::Clipboard); + if(!data || !QUriDrag::canDecode(data)) + { + paste->setEnabled(false); + } + copy->plug(&popmenu); + paste->plug(&popmenu); + + popmenu.insertSeparator(); // Bulk assignment/removal of tags -------------------------- @@ -612,8 +649,65 @@ serviceVector.clear(); delete assignTagsPopup; delete removeTagsPopup; + delete copy; + delete paste; } +void AlbumIconView::slotCopy() +{ + if (!d->currentAlbum) + return; + + KURL::List urls; + KURL::List kioURLs; + QValueList<int> albumIDs; + QValueList<int> imageIDs; + + for (IconItem *it = firstItem(); it; it=it->nextItem()) + { + if (it->isSelected()) + { + AlbumIconItem *albumItem = static_cast<AlbumIconItem *>(it); + urls.append(albumItem->imageInfo()->kurl()); + kioURLs.append(albumItem->imageInfo()->kurlForKIO()); + imageIDs.append(albumItem->imageInfo()->id()); + } + } + albumIDs.append(d->currentAlbum->id()); + + if (urls.isEmpty()) + return; + + QDragObject* drag = 0; + + drag = new ItemDrag(urls, kioURLs, albumIDs, imageIDs, this); + kapp->clipboard()->setData(drag); +} + +void AlbumIconView::slotPaste() +{ + QMimeSource *data = kapp->clipboard()->data(QClipboard::Clipboard); + if(!data || !QUriDrag::canDecode(data)) + return; + + if(d->currentAlbum->type() == Album::PHYSICAL) + { + if (QUriDrag::canDecode(data) && + d->currentAlbum->type() == Album::PHYSICAL) + { + PAlbum* palbum = (PAlbum*)d->currentAlbum; + KURL destURL(palbum->kurl()); + + KURL::List srcURLs; + KURLDrag::decode(data, srcURLs); + + KIO::Job* job = DIO::copy(srcURLs, destURL); + connect(job, SIGNAL(result(KIO::Job*)), + SLOT(slotDIOResult(KIO::Job*))); + } + } +} + void AlbumIconView::slotSetAlbumThumbnail(AlbumIconItem *iconItem) { if(!d->currentAlbum) --- trunk/extragear/graphics/digikam/digikam/albumiconview.h #489311:489312 @@ -135,6 +135,7 @@ void slotImageListerClear(); void slotDoubleClicked(IconItem *item); + void slotRightButtonClicked(const QPoint& pos); void slotRightButtonClicked(IconItem *item, const QPoint& pos); void slotGotThumbnail(const KURL& url); @@ -162,6 +163,8 @@ void slotDisplayItem(AlbumIconItem *item=0); void slotAlbumModified(); void slotSetAlbumThumbnail(AlbumIconItem *iconItem); + void slotCopy(); + void slotPaste(); signals: _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Evening!
I dont feel comfortable with this change... Gilles, Joern, what do you think? Tom Op vrijdag 23 december 2005 19:11, schreef İsmail Dönmez: > SVN commit 490924 by cartman: > > Missing i18n > > > M +1 -1 digikamfirstrun.cpp > > > --- trunk/extragear/graphics/digikam/digikam/digikamfirstrun.cpp > #490923:490924 @@ -78,7 +78,7 @@ > config_ = config; > ui = new DigikamFirstFirstRunWidget(this); > setMainWidget(ui); > - ui->path->setURL(QDir::homeDirPath() + "/Pictures"); > + ui->path->setURL(QDir::homeDirPath() + i18n("/Pictures")); > ui->path->setMode(KFile::Directory | KFile::LocalOnly); > > KIconLoader* iconLoader = KApplication::kApplication()->iconLoader(); _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel smime.p7s (2K) Download Attachment |
Le Vendredi 23 Décembre 2005 19:19, Tom Albers a écrit :
> Evening! > > I dont feel comfortable with this change... Gilles, Joern, what do you > think? I will trying to take a look. Gilles _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |