KIO
kdirmodel.cpp
Go to the documentation of this file.
50 u.adjustPath(KUrl::RemoveTrailingSlash); // KDirLister does this too, so we remove the slash before comparing with the root node url.
98 // If we listed the directory, the child count is known. Otherwise it can be set via setChildCount.
188 // key = current known parent node (always a KDirModelDirNode but KDirModelNode is more convenient),
192 QStringList m_allCurrentDestUrls; //list of all dest urls that have jobs on them (e.g. copy, download)
195 KDirModelNode* KDirModelPrivate::nodeForUrl(const KUrl& _url) const // O(1), well, O(length of url as a string)
303 * The internal pointer of the QModelIndex for a given file is the node for that file in our own tree.
304 * E.g. index(2,0) returns a QModelIndex with row=2 internalPointer=<KDirModelNode for the 3rd child of the root>
395 q->beginInsertRows( index, newRowCount - newItemsCount, newRowCount - 1 ); // parent, first, last
398 //kDebug(7008) << "urlsBeingFetched for dir" << dirNode << directoryUrl << ":" << urlsBeingFetched;
534 for ( QList<QPair<KFileItem, KFileItem> >::const_iterator fit = items.begin(), fend = items.end() ; fit != fend ; ++fit ) {
539 KDirModelNode* node = nodeForUrl(oldUrl); // O(n); maybe we could look up to the parent only once
540 //kDebug(7008) << "in model for" << m_dirLister->url() << ":" << oldUrl << "->" << newUrl << "node=" << node;
543 if (node != m_rootNode) { // we never set an item in the rootnode, we use m_dirLister->rootItem instead.
762 //return whether or not there are job dest urls visible in the view, so the delegate knows which ones to paint.
785 if (newName.isEmpty() || newName == item.text() || (newName == QLatin1String(".")) || (newName == QLatin1String("..")))
789 KIO::Job * job = KIO::moveAs(item.url(), newurl, newurl.isLocalFile() ? KIO::HideProgressInfo : KIO::DefaultFlags);
792 KIO::FileUndoManager::self()->recordJob( KIO::FileUndoManager::Rename, item.url(), newurl, job );
864 connect(&JobUrlCache::instance(), SIGNAL(jobUrlsChanged(QStringList)), this, SLOT(_k_slotJobUrlsChanged(QStringList)), Qt::UniqueConnection);
984 KDirModelNode* childNode = static_cast<KDirModelDirNode *>(parentNode)->m_childNodes.value(row); // O(1)
1075 // But this wastes memory, and how often does someone open and re-open an empty dir in a treeview?
1103 bool KDirModel::dropMimeData( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent )
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Reimplemented from QAbstractItemModel.
Definition: kdirmodel.cpp:819
void adjustPath(AdjustPathOption trailing)
Definition: kdirmodel.h:125
Definition: kdirmodel.h:132
Type
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
Reimplemented from QAbstractItemModel.
Definition: kdirmodel.cpp:907
void itemChanged(const QModelIndex &index)
Notify the model that the item at this index has changed.
Definition: kdirmodel.cpp:629
Definition: kdirmodel.h:123
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Reimplemented from QAbstractItemModel.
Definition: kdirmodel.cpp:649
Previous directories aren't forgotten (they are still watched by kdirwatch and their items are kept f...
Definition: kdirlister.h:76
void cleanPath(const CleanPathOption &options=SimplifyDirSeparators)
bool isExecutable(const QString &file)
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Reimplemented from QAbstractItemModel.
Definition: kdirmodel.cpp:776
QModelIndex indexForUrl(const KUrl &url) const
Return the index for a given url.
Definition: kdirmodel.cpp:969
virtual QStringList mimeTypes() const
Reimplemented from QAbstractItemModel.
Definition: kdirmodel.cpp:902
void setRef(const QString &fragment)
bool jobTransfersVisible() const
Returns whether or not displaying job transfers has been enabled.
Definition: kdirmodel.cpp:873
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Reimplemented from QAbstractItemModel. O(1)
Definition: kdirmodel.cpp:979
returns whether or not there is a job on an item (file/directory)
Definition: kdirmodel.h:139
bool isReadable() const
Checks whether the file or directory is readable.
Definition: kfileitem.cpp:1075
KDirLister * dirLister() const
Return the directory lister used by this model.
Definition: kdirmodel.cpp:358
void setJobTransfersVisible(bool value)
Enable/Disable the displaying of an animated overlay that is shown for any destination urls (in the v...
Definition: kdirmodel.cpp:860
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
bool isParentOf(const KUrl &u) const
QModelIndex indexForItem(const KFileItem *) const
Return the index for a given kfileitem.
Definition: kdirmodel.cpp:953
allow drops on local executables, shell scripts and desktop files. Can be used with DropOnDirectory...
Definition: kdirmodel.h:146
void setQuery(const QString &query)
returns the number of items in a directory, or ChildCountUnknown
Definition: kdirmodel.h:138
QString i18nc(const char *ctxt, const char *text)
void requestSequenceIcon(const QModelIndex &index, int sequenceIndex)
This emits the needSequenceIcon signal, requesting another sequence icon.
Definition: kdirmodel.cpp:855
KFileItem itemForIndex(const QModelIndex &index) const
Return the fileitem for a given index.
Definition: kdirmodel.cpp:943
void setPath(const QString &path)
Show the progress info GUI, no Resume and no Overwrite.
Definition: jobclasses.h:46
virtual void fetchMore(const QModelIndex &parent)
Reimplemented from QAbstractItemModel. Lists the subdirectory.
Definition: kdirmodel.cpp:1084
virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
Reimplemented from QAbstractItemModel. Not implemented yet.
Definition: kdirmodel.cpp:1103
void setAutoErrorHandlingEnabled(bool enable)
Definition: kdirmodel.h:143
Definition: kfileitem.h:58
QString encodeFileName(const QString &str)
Encodes (from the text displayed to the real filename) This translates '/' into a "unicode fraction s...
Definition: global.cpp:146
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Reimplemented from QAbstractItemModel. Returns ColumnCount.
Definition: kdirmodel.cpp:644
QString protocol() const
QString localPath() const
Returns the local path if isLocalFile() == true or the KIO item has a UDS_LOCAL_PATH atom...
Definition: kfileitem.cpp:602
List of KFileItems, which adds a few helper methods to QList.
Definition: kfileitem.h:674
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
QString mimeComment() const
Returns the user-readable string representing the type of this file, like "OpenDocument Text File"...
Definition: kfileitem.cpp:823
QString path(AdjustPathOption trailing=LeaveTrailingSlash) const
QString iconName() const
Returns the full path name to the icon that represents this mime type.
Definition: kfileitem.cpp:879
QString permissionsString() const
Returns the access permissions for the file as a string.
Definition: kfileitem.cpp:1409
virtual bool hasChildren(const QModelIndex &parent=QModelIndex()) const
Reimplemented from QAbstractItemModel. Returns true for directories.
Definition: kdirmodel.cpp:1017
virtual void sort(int column, Qt::SortOrder order=Qt::AscendingOrder)
Reimplemented from QAbstractItemModel. Not implemented.
Definition: kdirmodel.cpp:770
Definition: kdirmodel.h:120
QString formatDateTime(const QDateTime &dateTime, DateFormat format=ShortDate, bool includeSecs=false) const
KMimeType::Ptr mimeTypePtr() const
Returns the currently known mimetype of the file item.
Definition: kfileitem.cpp:1655
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Reimplemented from QAbstractItemModel.
Definition: kdirmodel.cpp:1027
KLocale * locale()
CopyJob * moveAs(const KUrl &src, const KUrl &dest, JobFlags flags=DefaultFlags)
Moves a file or directory src to the given destination dest.
Definition: copyjob.cpp:2194
KDateTime time(FileTimes which) const
Requests the modification, access or creation time, depending on which.
Definition: kfileitem.cpp:655
QString dir(const QString &fileClass)
Returns the most recently used directory accociated with this file-class.
Definition: krecentdirs.cpp:68
void needSequenceIcon(const QModelIndex &index, int sequenceIndex)
Emitted when another icon sequence index is requested.
void setDirLister(KDirLister *dirLister)
Set the directory lister to use by this model, instead of the default KDirLister created internally...
Definition: kdirmodel.cpp:338
Definition: kdirmodel.h:122
virtual bool canFetchMore(const QModelIndex &parent) const
Reimplemented from QAbstractItemModel. Returns true for empty directories.
Definition: kdirmodel.cpp:1068
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
void expandToUrl(const KUrl &url)
Lists subdirectories using fetchMore() as needed until the given url exists in the model...
Definition: kdirmodel.cpp:1120
static QStringList mimeDataTypes()
void setDropsAllowed(DropsAllowed dropsAllowed)
Set whether dropping onto items should be allowed, and for which kind of item Drops are disabled by d...
Definition: kdirmodel.cpp:1115
static KUrl::List simplifiedUrlList(const KUrl::List &urls)
Remove urls from the list if an ancestor is present on the list.
Definition: kdirmodel.cpp:878
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
Helper class for the kiojob used to list and update a directory.
Definition: kdirlister.h:57
QString formatNumber(double num, int precision=-1) const
virtual QModelIndex parent(const QModelIndex &index) const
Reimplemented from QAbstractItemModel.
Definition: kdirmodel.cpp:839
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Reimplemented from QAbstractItemModel. Returns the column titles.
Definition: kdirmodel.cpp:991
bool isLocalFile() const
const KShortcut & end()
Definition: kdirmodel.h:121
Definition: kdirmodel.h:127
QStringList overlays() const
Returns the overlays (bitfield of KIconLoader::*Overlay flags) that are used for this item's pixmap...
Definition: kfileitem.cpp:952
Definition: kdirmodel.h:124
KUrl mostLocalUrl(bool &local) const
Tries to give a local URL for this file item if possible.
Definition: kfileitem.cpp:1476
A KFileItem is a generic class to handle a file, local or remote.
Definition: kfileitem.h:45
void recordJob(CommandType op, const KUrl::List &src, const KUrl &dst, KIO::Job *job)
Record this job while it's happening and add a command for it so that the user can undo it...
Definition: fileundomanager.cpp:247
QString number(KIO::filesize_t size)
Converts a size to a string representation Not unlike QString::number(...)
Definition: global.cpp:63
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.