A view widget to display a library resource's contents. More...
#include <klflibview.h>
Public Slots | |
virtual void | updateResourceEngine ()=0 |
virtual void | updateResourceProp (int propId)=0 |
virtual void | updateResourceData (const QString &subres, int modifyType, const QList< KLFLib::entryId > &entryIdList)=0 |
virtual void | updateResourceDefaultSubResourceChanged (const QString &newSubResource) |
virtual bool | selectEntries (const QList< KLFLib::entryId > &idList)=0 |
virtual void | restore (uint restoreFlags=KLFLib::RestoreLatexAndStyle)=0 |
virtual void | restoreWithStyle () |
virtual void | restoreLatexOnly () |
virtual void | wantMoreCategorySuggestions () |
Signals | |
void | requestRestore (const KLFLibEntry &entry, uint restoreflags=KLFLib::RestoreLatexAndStyle) |
void | requestRestoreStyle (const KLFStyle &style) |
void | resourceDataChanged (const QList< KLFLib::entryId > &entryIdList) |
void | entriesSelected (const KLFLibEntryList &entries) |
void | moreCategorySuggestions (const QStringList &categorylist) |
void | operationStartReportingProgress (KLFProgressReporter *progressReporter, const QString &descriptiveText) |
Public Member Functions | |
KLFAbstractLibView (QWidget *parent) | |
virtual | ~KLFAbstractLibView () |
virtual KLFLibResourceEngine * | resourceEngine () const |
virtual QUrl | url () const =0 |
Display Resource URL. NOT exactly like KLFLibResourceEngine::url() ! | |
virtual uint | compareUrlTo (const QUrl &other, uint interestFlags=0xFFFFFFFF) const =0 |
Compare this resource view's URL to another URL. | |
bool | validResourceEngine () const |
Returns TRUE if a non-NULL resource engine has been set. | |
virtual void | setResourceEngine (KLFLibResourceEngine *resource) |
virtual KLFLibEntryList | selectedEntries () const =0 |
virtual QList< KLFLib::entryId > | selectedEntryIds () const =0 |
virtual QList< QAction * > | addContextMenuActions (const QPoint &pos) |
virtual QVariantMap | saveGuiState () const =0 |
virtual bool | restoreGuiState (const QVariantMap &state)=0 |
virtual QStringList | getCategorySuggestions ()=0 |
virtual KLFSearchable * | searchable () |
A view widget to display a library resource's contents.
A base API for a widget that will display a KLFLibResourceEngine's contents. For example one could create a QTreeView and display the contents in there (that's what KLFLibDefaultView does...).
Note: The operationStartReportingProgress() signal is purposed for when long update operations are necessary. It is to be used by subclasses exactly like in KLFLibResourceEngine.
If the reimplementation of this view can be searched with a KLFSearchBar, reimplement searchable() to return a KLFSearchable object for this view.
Definition at line 82 of file klflibview.h.
KLFAbstractLibView::KLFAbstractLibView | ( | QWidget * | parent | ) |
Definition at line 171 of file klflibview.cpp.
virtual KLFAbstractLibView::~KLFAbstractLibView | ( | ) | [inline, virtual] |
Definition at line 87 of file klflibview.h.
Subclasses may add items to the context menu by returning them in this function.
pos | is the position relative to widget where the menu was requested. |
The default implementation returns an empty list.
Reimplemented in KLFLibDefaultView.
Definition at line 200 of file klflibview.cpp.
Referenced by KLFLibBrowser::slotShowContextMenu().
virtual uint KLFAbstractLibView::compareUrlTo | ( | const QUrl & | other, |
uint | interestFlags = 0xFFFFFFFF |
||
) | const [pure virtual] |
Compare this resource view's URL to another URL.
Compares the URL of the resource we are viewing with the URL other
, and returns an OR-ed combination of enum KlfUrlCompareFlag values of URL-comparision tests that have turned out to be true (see KlfUrlCompareFlag for a list of tests).
This function is supposed to answer to the following questions, each a condition as whether to return a URL comparation flag or not:
KlfUrlCompareEqual:
does this view show the same information as a view whose URL would be other
?KlfUrlCompareLessSpecific:
does this view show _MORE_ information than the other
view ("less specific information" <=> "shows more") ?KLFUrlCompareMoreSpecific:
does this view show _LESS_ information than the other
view ?KLFUrlComapreBaseEqual:
does this view show the same resource as the other
view, but possibly does not the same specific information, eg. not the same sub-resource.The interestFlags
is a binary OR'ed value of KlfUrlCompareFlag values of tests to be performed. Any flag that is set in interestFlags
indicates that the return value of this function, when binary-AND'ed with that flag, is the result (T or F) of the test the flag stands for. However, if a flag is not set in interestFlags
, its state in the return value by this function is undefined.
See also klfUrlCompare().
Implemented in KLFLibDefaultView.
void KLFAbstractLibView::entriesSelected | ( | const KLFLibEntryList & | entries | ) | [signal] |
Emitted when the selection has changed, eg. user selected or deselected some entries.
Referenced by KLFLibDefaultView::slotSelectAll(), and KLFLibDefaultView::slotViewSelectionChanged().
virtual QStringList KLFAbstractLibView::getCategorySuggestions | ( | ) | [pure virtual] |
Subclasses should reimplement this function to return a list of all known categories to suggest to the user, eg. in a completion list for an editable combo box to edit categories.
Implemented in KLFLibDefaultView.
Referenced by wantMoreCategorySuggestions().
void KLFAbstractLibView::moreCategorySuggestions | ( | const QStringList & | categorylist | ) | [signal] |
Subclasses should emit this signal with lists of categories they come accross, so that the editor can suggest these as completions upon editing category
Referenced by wantMoreCategorySuggestions().
void KLFAbstractLibView::operationStartReportingProgress | ( | KLFProgressReporter * | progressReporter, |
const QString & | descriptiveText | ||
) | [signal] |
Emitted by subclasses to announce the beginning of a long operation during which progress will be reported through the given progressReporter
.
Should be used in the same way as KLFLibResourceEngine::operationStartReportingProgress().
Referenced by KLFLibDefaultView::updateResourceEngine().
void KLFAbstractLibView::requestRestore | ( | const KLFLibEntry & | entry, |
uint | restoreflags = KLFLib::RestoreLatexAndStyle |
||
) | [signal] |
Is emitted (by subclasses) when a latex entry is selected to be restored (eg. the entry was double-clicked).
entry | is the data to restore |
restoreflags | provides information on which part of entry to restore. See the possible flags in KLFLib::RestoreMode. |
Referenced by KLFLibDefaultView::restore(), and KLFLibDefaultView::slotEntryDoubleClicked().
void KLFAbstractLibView::requestRestoreStyle | ( | const KLFStyle & | style | ) | [signal] |
Is emitted (by subclasses) when the view wants the main application (or the framework that uses this class) to restore the given style style
. No latex is to be restored.
void KLFAbstractLibView::resourceDataChanged | ( | const QList< KLFLib::entryId > & | entryIdList | ) | [signal] |
Subclasses must emit this signal AFTER they have refreshed.
Referenced by KLFLibDefaultView::slotResourceDataChanged().
virtual KLFLibResourceEngine* KLFAbstractLibView::resourceEngine | ( | ) | const [inline, virtual] |
Definition at line 89 of file klflibview.h.
Referenced by KLFLibDefaultView::compareUrlTo(), KLFLibDefaultView::showColumns(), KLFLibBrowser::slotCopyMoveToResource(), KLFLibBrowser::slotCut(), KLFLibBrowser::slotDeleteSelected(), KLFLibBrowser::slotEntriesSelected(), KLFLibBrowser::slotMetaInfoChanged(), KLFLibBrowser::slotPaste(), KLFLibBrowser::slotResourceNewSubRes(), KLFLibBrowser::slotShowContextMenu(), KLFLibDefaultView::sortBy(), KLFLibDefaultView::updateResourceData(), KLFLibDefaultView::updateResourceEngine(), and KLFLibDefaultView::updateResourceProp().
virtual void KLFAbstractLibView::restore | ( | uint | restoreFlags = KLFLib::RestoreLatexAndStyle | ) | [pure virtual, slot] |
Collects the necessary information and emits requestRestore()
Implemented in KLFLibDefaultView.
virtual bool KLFAbstractLibView::restoreGuiState | ( | const QVariantMap & | state | ) | [pure virtual] |
Restores the state described in state
(which was previously, possibly in another session, returned by saveGuiState())
Implemented in KLFLibDefaultView.
Referenced by KLFLibBrowserViewContainer::loadGuiState(), and KLFLibBrowserViewContainer::openView().
virtual void KLFAbstractLibView::restoreLatexOnly | ( | ) | [inline, virtual, slot] |
Provides a reasonable default implementation that should suit for most purposes.
Definition at line 245 of file klflibview.h.
References KLFLib::RestoreLatex.
Referenced by KLFLibBrowser::slotRestoreLatexOnly().
virtual void KLFAbstractLibView::restoreWithStyle | ( | ) | [inline, virtual, slot] |
Provides a reasonable default implementation that should suit for most purposes.
Definition at line 243 of file klflibview.h.
References KLFLib::RestoreLatexAndStyle.
Referenced by KLFLibBrowser::slotRestoreWithStyle().
virtual QVariantMap KLFAbstractLibView::saveGuiState | ( | ) | const [pure virtual] |
Saves the current GUI state (eg. column widths and order, etc.)
Implemented in KLFLibDefaultView.
Referenced by KLFLibBrowserViewContainer::saveGuiState().
virtual KLFSearchable* KLFAbstractLibView::searchable | ( | ) | [inline, virtual] |
Reimplemented in KLFLibDefaultView.
Definition at line 167 of file klflibview.h.
Referenced by KLFLibBrowserViewContainer::slotCurrentChanged().
virtual KLFLibEntryList KLFAbstractLibView::selectedEntries | ( | ) | const [pure virtual] |
Subclasses should return a list of entries that have been selected by the user.
Implemented in KLFLibDefaultView.
Referenced by KLFLibBrowser::slotCopy(), KLFLibBrowser::slotCopyMoveToResource(), KLFLibBrowserViewContainer::slotCurrentChanged(), KLFLibBrowser::slotCut(), KLFLibBrowser::slotExportSelection(), KLFLibBrowser::slotMetaInfoChanged(), KLFLibBrowser::slotResourceDataChanged(), KLFLibBrowser::slotShowContextMenu(), KLFLibBrowser::slotTabResourceShown(), and KLFLibBrowser::slotUpdateForResourceProperty().
virtual QList<KLFLib::entryId> KLFAbstractLibView::selectedEntryIds | ( | ) | const [pure virtual] |
Subclasses should return a list of resource-entry-IDs that have been selected by the user.
Implemented in KLFLibDefaultView.
Referenced by KLFLibBrowser::slotCopyMoveToResource(), KLFLibBrowser::slotCut(), KLFLibBrowser::slotDeleteSelected(), and KLFLibBrowser::slotMetaInfoChanged().
virtual bool KLFAbstractLibView::selectEntries | ( | const QList< KLFLib::entryId > & | idList | ) | [pure virtual, slot] |
Subclasses should reimplement to update the given property to the given value on all library entries that are selected by the user. (They have to actually perform the change in the resource, eg with KLFLibResourceEngine::changeEntries()).
Implemented in KLFLibDefaultView.
Referenced by KLFLibBrowser::slotMetaInfoChanged().
void KLFAbstractLibView::setResourceEngine | ( | KLFLibResourceEngine * | resource | ) | [virtual] |
Definition at line 176 of file klflibview.cpp.
References updateResourceData(), updateResourceDefaultSubResourceChanged(), updateResourceEngine(), and updateResourceProp().
Referenced by KLFLibDefaultViewFactory::createLibView().
virtual void KLFAbstractLibView::updateResourceData | ( | const QString & | subres, |
int | modifyType, | ||
const QList< KLFLib::entryId > & | entryIdList | ||
) | [pure virtual, slot] |
Implemented in KLFLibDefaultView.
Referenced by setResourceEngine().
void KLFAbstractLibView::updateResourceDefaultSubResourceChanged | ( | const QString & | newSubResource | ) | [virtual, slot] |
Default implementation calls updateResourceEngine()
Definition at line 190 of file klflibview.cpp.
References updateResourceEngine().
Referenced by setResourceEngine().
virtual void KLFAbstractLibView::updateResourceEngine | ( | ) | [pure virtual, slot] |
Implemented in KLFLibDefaultView.
Referenced by setResourceEngine(), and updateResourceDefaultSubResourceChanged().
virtual void KLFAbstractLibView::updateResourceProp | ( | int | propId | ) | [pure virtual, slot] |
Implemented in KLFLibDefaultView.
Referenced by setResourceEngine().
virtual QUrl KLFAbstractLibView::url | ( | ) | const [pure virtual] |
Display Resource URL. NOT exactly like KLFLibResourceEngine::url() !
Returns an URL describing exactly what is shown to user, based on the resource engine's URL.
resourceEngine()->url()
. It returns in the URL exactly the information that is displayed to user. For example, a view that can handle displaying all sub-resources will NOT include the default sub-resource in its URL, however a view displaying only the default sub-resource will include a "klfDefaultSubResource" query item to distinguish it from another view acting on the same base URL but displaying a different sub-resource. Implemented in KLFLibDefaultView.
Referenced by KLFLibBrowser::slotCopy(), KLFLibBrowser::slotShowContextMenu(), and KLFLibBrowserViewContainer::url().
bool KLFAbstractLibView::validResourceEngine | ( | ) | const [inline] |
Returns TRUE if a non-NULL
resource engine has been set.
Definition at line 134 of file klflibview.h.
void KLFAbstractLibView::wantMoreCategorySuggestions | ( | ) | [virtual, slot] |
Called by the owner of the view. This function fetches category suggestions (by calling the virtual getCategorySuggestions() reimplemented by subclasses) and emits the signal moreCategorySuggestions().
Subclasses need not reimplement this function.
Definition at line 195 of file klflibview.cpp.
References getCategorySuggestions(), and moreCategorySuggestions().
Referenced by KLFLibBrowser::openResource(), and KLFLibDefaultView::updateResourceEngine().