summaryrefslogtreecommitdiffstats
path: root/src/documentlistview.h
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2013-06-24 02:08:15 +0200
committerSlávek Banko <slavek.banko@axis.cz>2013-07-04 02:44:37 +0200
commit998f21e02a725cd553d7c278819f67cd81295af4 (patch)
tree4bd158018e9302c31367b00c01cd2b41eb228414 /src/documentlistview.h
downloadkbibtex-998f21e02a725cd553d7c278819f67cd81295af4.tar.gz
kbibtex-998f21e02a725cd553d7c278819f67cd81295af4.zip
Initial import
Diffstat (limited to 'src/documentlistview.h')
-rw-r--r--src/documentlistview.h127
1 files changed, 127 insertions, 0 deletions
diff --git a/src/documentlistview.h b/src/documentlistview.h
new file mode 100644
index 0000000..da2c6c5
--- /dev/null
+++ b/src/documentlistview.h
@@ -0,0 +1,127 @@
+/***************************************************************************
+* Copyright (C) 2004-2006 by Thomas Fischer *
+* fischer@unix-ag.uni-kl.de *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* 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. *
+***************************************************************************/
+#ifndef KBIBTEXDOCUMENTLISTVIEW_H
+#define KBIBTEXDOCUMENTLISTVIEW_H
+
+#include <klistview.h>
+#include <kxmlguifactory.h>
+
+#include <fileimporter.h>
+#include <settings.h>
+#include <file.h>
+
+class QString;
+class KURL;
+class KActionMenu;
+class KPopupMenu;
+
+namespace KBibTeX
+{
+ class DocumentWidget;
+ class DocumentListViewItem;
+
+ class DocumentListView : public KListView
+ {
+ Q_OBJECT
+ public:
+ DocumentListView( KBibTeX::DocumentWidget *docWidget, bool isReadOnly, QWidget *parent = 0, const char *name = 0 );
+ ~DocumentListView();
+
+ void setFactory( KXMLGUIFactory *factory, KXMLGUIClient *client );
+ void setViewShowColumnsMenu( KActionMenu *actionMenu );
+
+ bool setBibTeXFile( BibTeX::File *bibtexFile );
+ BibTeX::File* getBibTeXFile( );
+ KBibTeX::DocumentListViewItem *insertItem( BibTeX::Element *item, KBibTeX::DocumentListViewItem *after );
+
+ void deleteSelected();
+ const QValueList<BibTeX::Element*> selectedItems();
+// void sendSelectedToLyx();
+
+ void updateVisiblity();
+ void updateVisiblity( KBibTeX::DocumentListViewItem *item );
+
+ void deferredInitialization();
+ void restoreState();
+
+ signals:
+ void modified();
+ void executed( DocumentListViewItem* );
+
+ public slots:
+ void copy();
+ void copyReferences();
+ void cut();
+ bool paste();
+ bool paste( const QString& text, DocumentListViewItem *at );
+ void selectAll();
+ void filter( const QString& text, BibTeX::Element::FilterType filterType, BibTeX::EntryField::FieldType fieldType );
+ void setReadOnly( bool isReadOnly );
+ void activateShowColumnMenu( int id );
+
+ void insertItems( BibTeX::File *items, KBibTeX::DocumentListViewItem *after = NULL );
+ void insertItem( BibTeX::Element *item );
+
+ private slots:
+ void slotDoubleClick( QListViewItem * item = NULL );
+ void setSortingColumn( int column );
+ void showBibtexListContextMenu( KListView *, QListViewItem *, const QPoint &p );
+ void slotDropped( QDropEvent* event, QListViewItem* item );
+ void saveColumnIndex();
+ void restoreColumnIndex();
+ void saveColumnWidths( int col = -1 );
+ void restoreColumnWidths();
+ void restoreSortingColumn();
+ void makeNewItemsUnread();
+
+ protected:
+ bool acceptDrag( QDropEvent* e ) const;
+ void startDrag();
+
+ virtual bool eventFilter( QObject *watched, QEvent *e );
+
+ virtual void keyPressEvent( QKeyEvent *e );
+
+ private:
+ static const int maxColumns = 256;
+ KBibTeX::DocumentWidget *m_docWidget;
+ BibTeX::File *m_bibtexFile;
+ KPopupMenu *m_contextMenu;
+ KPopupMenu *m_headerMenu;
+ KActionMenu *m_columnVisibleAction;
+ bool m_isReadOnly;
+ QValueList<DocumentListViewItem*> m_unreadItems;
+
+ QString m_filter;
+ BibTeX::Element::FilterType m_filterType;
+ BibTeX::EntryField::FieldType m_filterFieldType;
+ int m_newElementCounter;
+
+ void setItems();
+ QString selectedToBibTeXText();
+ QString selectedToBibTeXRefs();
+
+ void showColumn( int col, int colWidth = 0xffff );
+ void hideColumn( int col );
+ void buildColumns();
+ };
+}
+
+#endif