00001 /*************************************************************************** 00002 * * 00003 * authorlinklistbox.cpp * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * Read the file COPYING for details. * 00011 * * 00012 * copyright: (C) 2003 by Jan Mueller * 00013 * email: janmueller7@hotmail.com * 00014 * * 00015 ***************************************************************************/ 00016 00017 #include "authorlinklistbox.h" 00018 #include <qlistview.h> 00019 #include "liturl.h" 00020 #include "linklistboxitem.h" 00021 00022 AuthorLinkListBox::AuthorLinkListBox(QWidget *parent, const char *name ) : 00023 LinkListBox(parent,name) { 00024 00025 pop.insertItem("Move Author Up", this, SLOT(slotUp())); 00026 pop.insertItem("Move Author Down", this, SLOT(slotDown())); 00027 setSorting(-1); 00028 } 00029 00030 void AuthorLinkListBox::slotUp() { 00031 if(!currentItem() || !currentItem()->itemAbove()) return; 00032 order_modified=true; 00033 if(currentItem()->itemAbove()->itemAbove()) 00034 currentItem()->moveItem(currentItem()->itemAbove()->itemAbove()); 00035 else 00036 currentItem()->itemAbove()->moveItem(currentItem()); 00037 } 00038 00039 void AuthorLinkListBox::slotDown() { 00040 if(!currentItem() || !currentItem()->itemBelow()) return; 00041 order_modified=true; 00042 // takeItem(currentItem()); 00043 currentItem()->moveItem(currentItem()->itemBelow()); 00044 } 00045 00046 QValueList<LitUrl> AuthorLinkListBox::authorPos() { 00047 QValueList<LitUrl> l; 00048 QListViewItem *i=firstChild(); 00049 while(i) { 00050 LinkListBoxItem *item=dynamic_cast<LinkListBoxItem*>(i); 00051 if(item) 00052 l.append(item->url()); 00053 i=i->nextSibling(); 00054 } 00055 return l; 00056 } 00057 00058 bool AuthorLinkListBox::modified() { 00059 return order_modified; 00060 }