diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
commit | bf7f88413be3831a9372d323d02fc0335b9f9188 (patch) | |
tree | 516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/app/bookmarkviewcontroller.cpp | |
parent | e238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff) | |
download | gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip |
TQt4 port Gwenview
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/app/bookmarkviewcontroller.cpp')
-rw-r--r-- | src/app/bookmarkviewcontroller.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/src/app/bookmarkviewcontroller.cpp b/src/app/bookmarkviewcontroller.cpp index 159de18..664688b 100644 --- a/src/app/bookmarkviewcontroller.cpp +++ b/src/app/bookmarkviewcontroller.cpp @@ -23,12 +23,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include <memory> -// Qt -#include <qcursor.h> -#include <qheader.h> -#include <qpopupmenu.h> -#include <qtooltip.h> -#include <qvbox.h> +// TQt +#include <tqcursor.h> +#include <tqheader.h> +#include <tqpopupmenu.h> +#include <tqtooltip.h> +#include <tqvbox.h> // KDE #include <kaction.h> @@ -52,13 +52,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. namespace Gwenview { // URLDropListView -URLDropListView::URLDropListView(QWidget* parent) -: KListView(parent) { +URLDropListView::URLDropListView(TQWidget* tqparent) +: KListView(tqparent) { setAcceptDrops(true); } -void URLDropListView::contentsDragMoveEvent(QDragMoveEvent* event) { +void URLDropListView::contentsDragMoveEvent(TQDragMoveEvent* event) { if (KURLDrag::canDecode(event)) { event->accept(); } else { @@ -71,8 +71,8 @@ void URLDropListView::contentsDragMoveEvent(QDragMoveEvent* event) { struct BookmarkItem : public KListViewItem { template <class ItemParent> - BookmarkItem(ItemParent* parent, const KBookmark& bookmark) - : KListViewItem(parent) + BookmarkItem(ItemParent* tqparent, const KBookmark& bookmark) + : KListViewItem(tqparent) , mBookmark(bookmark) { refresh(); @@ -87,18 +87,18 @@ struct BookmarkItem : public KListViewItem { }; -class BookmarkToolTip : public QToolTip { +class BookmarkToolTip : public TQToolTip { public: BookmarkToolTip(KListView* lv) - : QToolTip(lv->viewport()) + : TQToolTip(lv->viewport()) , mListView(lv) {} - void maybeTip(const QPoint& pos) { + void maybeTip(const TQPoint& pos) { BookmarkItem *item = static_cast<BookmarkItem*>( mListView->itemAt(pos) ); if ( !item) return; if (item->mBookmark.isGroup()) return; - QRect rect=mListView->itemRect(item); + TQRect rect=mListView->tqitemRect(item); tip(rect, item->mBookmark.url().prettyURL()); }; @@ -107,7 +107,7 @@ public: struct BookmarkViewController::Private { - QVBox* mBox; + TQVBox* mBox; KListView* mListView; KBookmarkManager* mManager; KURL mCurrentURL; @@ -157,7 +157,7 @@ struct BookmarkViewController::Private { dialog.setTitle(url.fileName()); dialog.setURL(url.prettyURL()); dialog.setIcon(KMimeType::iconForURL(url)); - if (dialog.exec()==QDialog::Rejected) return; + if (dialog.exec()==TQDialog::Rejected) return; KBookmarkGroup parentGroup=findBestParentGroup(); parentGroup.addBookmark(mManager, dialog.title(), dialog.url(), dialog.icon()); @@ -166,20 +166,20 @@ struct BookmarkViewController::Private { }; -void URLDropListView::contentsDropEvent(QDropEvent* event) { +void URLDropListView::contentsDropEvent(TQDropEvent* event) { KURL::List urls; if (!KURLDrag::decode(event, urls)) return; emit urlDropped(event, urls); } -BookmarkViewController::BookmarkViewController(QWidget* parent) -: QObject(parent) +BookmarkViewController::BookmarkViewController(TQWidget* tqparent) +: TQObject(tqparent) { d=new Private; d->mManager=0; - d->mBox=new QVBox(parent); + d->mBox=new TQVBox(tqparent); // Init listview d->mListView=new URLDropListView(d->mBox); @@ -188,29 +188,29 @@ BookmarkViewController::BookmarkViewController(QWidget* parent) d->mListView->header()->hide(); d->mListView->setRootIsDecorated(true); - d->mListView->addColumn(QString::null); + d->mListView->addColumn(TQString()); d->mListView->setSorting(-1); d->mListView->setShowToolTips(false); d->mListView->setFullWidth(true); - connect(d->mListView, SIGNAL(clicked(QListViewItem*)), - this, SLOT(slotOpenBookmark(QListViewItem*)) ); - connect(d->mListView, SIGNAL(returnPressed(QListViewItem*)), - this, SLOT(slotOpenBookmark(QListViewItem*)) ); - connect(d->mListView, SIGNAL(contextMenuRequested(QListViewItem*, const QPoint&, int)), - this, SLOT(slotContextMenu(QListViewItem*)) ); - connect(d->mListView, SIGNAL(urlDropped(QDropEvent*, const KURL::List&)), - this, SLOT(slotURLDropped(QDropEvent*, const KURL::List&)) ); + connect(d->mListView, TQT_SIGNAL(clicked(TQListViewItem*)), + this, TQT_SLOT(slotOpenBookmark(TQListViewItem*)) ); + connect(d->mListView, TQT_SIGNAL(returnPressed(TQListViewItem*)), + this, TQT_SLOT(slotOpenBookmark(TQListViewItem*)) ); + connect(d->mListView, TQT_SIGNAL(contextMenuRequested(TQListViewItem*, const TQPoint&, int)), + this, TQT_SLOT(slotContextMenu(TQListViewItem*)) ); + connect(d->mListView, TQT_SIGNAL(urlDropped(TQDropEvent*, const KURL::List&)), + this, TQT_SLOT(slotURLDropped(TQDropEvent*, const KURL::List&)) ); // Init toolbar KToolBar* toolbar=new KToolBar(d->mBox, "", true); KAction* action; toolbar->setIconText(KToolBar::IconTextRight); action=new KAction(i18n("Add a bookmark (keep it short)", "Add"), "bookmark_add", 0, - this, SLOT(bookmarkCurrentURL()), d->mActionCollection); + this, TQT_SLOT(bookmarkCurrentURL()), d->mActionCollection); action->plug(toolbar); action=new KAction(i18n("Remove a bookmark (keep it short)", "Remove"), "editdelete", 0, - this, SLOT(deleteCurrentBookmark()), d->mActionCollection); + this, TQT_SLOT(deleteCurrentBookmark()), d->mActionCollection); action->plug(toolbar); } @@ -226,8 +226,8 @@ void BookmarkViewController::init(KBookmarkManager* manager) { d->mManager=manager; // For now, we ignore the caller parameter and just refresh the full list on update - connect(d->mManager, SIGNAL(changed(const QString&, const QString&)), - this, SLOT(fill()) ); + connect(d->mManager, TQT_SIGNAL(changed(const TQString&, const TQString&)), + this, TQT_SLOT(fill()) ); fill(); } @@ -237,7 +237,7 @@ void BookmarkViewController::setURL(const KURL& url) { } -QWidget* BookmarkViewController::widget() const { +TQWidget* BookmarkViewController::widget() const { return d->mBox; } @@ -249,15 +249,15 @@ void BookmarkViewController::fill() { } -void BookmarkViewController::slotURLDropped(QDropEvent* event, const KURL::List& urls) { +void BookmarkViewController::slotURLDropped(TQDropEvent* event, const KURL::List& urls) { // Get a pointer to the drop item - QPoint point(0,event->pos().y()); + TQPoint point(0,event->pos().y()); KListView* lst=d->mListView; BookmarkItem* item=static_cast<BookmarkItem*>( lst->itemAt(lst->contentsToViewport(point)) ); - QPopupMenu menu(lst); + TQPopupMenu menu(lst); int addBookmarkID=menu.insertItem( SmallIcon("bookmark_add"), i18n("&Add Bookmark"), - this, SLOT(slotBookmarkDroppedURL()) ); + this, TQT_SLOT(slotBookmarkDroppedURL()) ); if (urls.count()==1) { d->mDroppedURL=*urls.begin(); } else { @@ -272,7 +272,7 @@ void BookmarkViewController::slotURLDropped(QDropEvent* event, const KURL::List& menu.insertSeparator(); menu.insertItem( SmallIcon("cancel"), i18n("Cancel") ); - menu.exec(QCursor::pos()); + menu.exec(TQCursor::pos()); } @@ -281,7 +281,7 @@ void BookmarkViewController::slotBookmarkDroppedURL() { } -void BookmarkViewController::slotOpenBookmark(QListViewItem* item_) { +void BookmarkViewController::slotOpenBookmark(TQListViewItem* item_) { if (!item_) return; BookmarkItem* item=static_cast<BookmarkItem*>(item_); const KURL& url=item->mBookmark.url(); @@ -290,22 +290,22 @@ void BookmarkViewController::slotOpenBookmark(QListViewItem* item_) { } -void BookmarkViewController::slotContextMenu(QListViewItem* item_) { +void BookmarkViewController::slotContextMenu(TQListViewItem* item_) { BookmarkItem* item=static_cast<BookmarkItem*>(item_); - QPopupMenu menu(d->mListView); + TQPopupMenu menu(d->mListView); menu.insertItem(SmallIcon("bookmark_add"), i18n("Add Bookmark..."), - this, SLOT(bookmarkCurrentURL())); + this, TQT_SLOT(bookmarkCurrentURL())); menu.insertItem(SmallIcon("bookmark_folder"), i18n("Add Bookmark Folder..."), - this, SLOT(addBookmarkGroup())); + this, TQT_SLOT(addBookmarkGroup())); if (item) { menu.insertSeparator(); menu.insertItem(SmallIcon("edit"), i18n("Edit..."), - this, SLOT(editCurrentBookmark())); + this, TQT_SLOT(editCurrentBookmark())); menu.insertItem(SmallIcon("editdelete"), i18n("Delete"), - this, SLOT(deleteCurrentBookmark())); + this, TQT_SLOT(deleteCurrentBookmark())); } - menu.exec(QCursor::pos()); + menu.exec(TQCursor::pos()); } @@ -316,13 +316,13 @@ void BookmarkViewController::bookmarkCurrentURL() { void BookmarkViewController::addBookmarkGroup() { BookmarkDialog dialog(d->mListView, BookmarkDialog::BOOKMARK_GROUP); - if (dialog.exec()==QDialog::Rejected) return; + if (dialog.exec()==TQDialog::Rejected) return; KBookmarkGroup parentGroup=d->findBestParentGroup(); KBookmarkGroup newGroup=parentGroup.createNewFolder(d->mManager, dialog.title()); newGroup.internalElement().setAttribute("icon", dialog.icon()); d->mManager->emitChanged(parentGroup); - QListViewItem* item=d->mListView->currentItem(); + TQListViewItem* item=d->mListView->currentItem(); if (item) { item->setOpen(true); } @@ -344,17 +344,17 @@ void BookmarkViewController::editCurrentBookmark() { if (!isGroup) { dialog.setURL(bookmark.url().prettyURL()); } - if (dialog.exec()==QDialog::Rejected) return; + if (dialog.exec()==TQDialog::Rejected) return; - QDomElement element=bookmark.internalElement(); + TQDomElement element=bookmark.internalElement(); element.setAttribute("icon", dialog.icon()); if (!isGroup) { element.setAttribute("href", dialog.url()); } // Find title element (or create it if it does not exist) - QDomElement titleElement; - QDomNode tmp=element.namedItem("title"); + TQDomElement titleElement; + TQDomNode tmp=element.namedItem("title"); if (tmp.isNull()) { titleElement=element.ownerDocument().createElement("title"); element.appendChild(titleElement); @@ -364,7 +364,7 @@ void BookmarkViewController::editCurrentBookmark() { Q_ASSERT(!titleElement.isNull()); // Get title element content (or create) - QDomText titleText; + TQDomText titleText; tmp=titleElement.firstChild(); if (tmp.isNull()) { titleText=element.ownerDocument().createTextNode(""); @@ -388,15 +388,15 @@ void BookmarkViewController::deleteCurrentBookmark() { if (!item) return; KBookmark bookmark=item->mBookmark; - QString msg; - QString title; + TQString msg; + TQString title; if (bookmark.isGroup()) { msg=i18n("Are you sure you want to delete the bookmark folder <b>%1</b>?<br>This will delete the folder and all the bookmarks in it.") - .arg(bookmark.text()); + .tqarg(bookmark.text()); title=i18n("Delete Bookmark &Folder"); } else { msg=i18n("Are you sure you want to delete the bookmark <b>%1</b>?") - .arg(bookmark.text()); + .tqarg(bookmark.text()); title=i18n("Delete &Bookmark"); } |