GCF LOGO VCL LOGO
GCF::IGDriveLiteContentModel Class Referenceabstract

This interface provides access to the content-structure of Google Drive

#include <GCF3/IGDriveLiteContentModel>
. More...

Public Types

enum  Field {
  Kind = Qt::UserRole, Id, ETag, SelfLink,
  WebContentLink, WebViewLink, AlternateLink, EmbedLink,
  OpenWithLinks, DefaultOpenWithLink, IconLink, ThumbnailLink,
  Title, MimeType, Description, IsStarred,
  IsHidden, IsTrashed, IsRestricted, IsViewed,
  CreatedDate, ModifiedDate, ModifiedByMeDate, LastViewedByMeDate,
  SharedWithMeDate, DownloadUrl, ExportLinks, IndexableText,
  UserPermissions, OriginalFileName, FileExtension, Md5Checksum,
  FileSize, QuataBytesUsed, OwnerNames, Owners,
  LastModifyingUserName, LastModifyingUser, IsEditable, IsCopyable,
  CanWritersShare, IsShared, IsExplicitlyTrashed, IsAppDataContents,
  HeadRevisionId, Properties, ImageMediaMetaData, IsFolder,
  IsFile, IsSpecialItem, IsFileInfoLoaded, IsFolderContentLoaded,
  MinField = Kind, MaxField = IsFolderContentLoaded
}
 
enum  ContentVisibility {
  ShowMyDrive = 1, ShowSharedWithMe = 2, ShowTrashed = 4, ShowStarred = 8,
  ShowAll = ShowMyDrive|ShowSharedWithMe|ShowTrashed|ShowStarred
}
 
enum  SpecialItem { MyDrive, SharedWithMe, Trash, Starred }
 

Public Member Functions

virtual void setContentVisibility (int flags)=0
 
virtual int contentVisibility () const =0
 
virtual void setColumns (const QList< Field > &fields)=0
 
virtual QList< Fieldcolumns () const =0
 
virtual GCF::Result refresh (const QModelIndex &index=QModelIndex())=0
 
virtual GCF::GDriveContent::Item item (const QModelIndex &index) const =0
 
virtual GCF::GDriveContent::Item item (const QString &id) const =0
 
virtual QModelIndex indexForId (const QString &id, int column=0) const =0
 
virtual QModelIndex specialItemIndex (SpecialItem item) const =0
 
virtual Q_SIGNAL void fileItemLoaded (const QModelIndex &index)=0
 
virtual Q_SIGNAL void folderItemLoaded (const QModelIndex &index)=0
 

Detailed Description

This class implements the QAbstractItemModel interface and offers access to MyDrive, Trash, SharedWithMe, Starred root folders and their folders and files. You can think of this class as a QFileSystemModel for Google Drive.

Against each node in the content-tree, this model maintains an internal data structure of all property=value pairs returned by Google Drive API. This can be accessed via the item() method.

In order to arrange files in the google drive file system style content model has 4 top level special items inside which all the contents of google drive is arranged.

  • My drive - This contains all the files created or uploaded by you.
  • Shared with me - This item contains all the files shared with you.
  • Starred - This item contains all the starred items by you.
  • Trashed - This item contains all the files that has been trashed by you.

Once the authentication is complete content model starts fetching contents from GDrive. Content model does not fetch all the drive contents at once. All the above top level items contents are fetched first. If there are folders inside any of the above items then the contents inside those folders are not fetched for the first time. The contents of folders are fetched only when the the items inside the folder needs to be shown.

Shown below is an example of how the content-model is visualized in a QTreeView for a Google Drive account.

content-model-treeview.png

Member Enumeration Documentation

The enumeration values of Field represents specific property of item i.e GCF::GDriveContent::Item. GCF::GDriveContent::Item represents a file or folder in google drive. Each of them posses the properties represented by the values of enumeration.

This enumeration values are also used to construct columns and order of it using GCF::IGDriveLiteContentModel::setColumns(const QList<int> &columns).

Enumerator
Kind 

kind string of item. For example "drive#file". [Role-name: "contentKind"]

Id 

id of item. Each item has unique id. [Role-name: "contentId"]

ETag 

etag of item. [Role-name: "contentETag"]

SelfLink 

selfLink of item. [Role-name: "contentSelfLink"]

WebContentLink 

web content link of item. [Role-name: "contentWebContentLink"]

WebViewLink 

web view link of item. [Role-name: "contentWebViewLink"]

AlternateLink 

alternative link of item. [Role-name: "contentAlternateLink"]

EmbedLink 

embed link of item. [Role-name: "contentEmbedLink"]

OpenWithLinks 

QVariantMap of open with links of item. [Role-name: "contentIsOpenWithLinks"]

DefaultOpenWithLink 

default open with link of item. [Role-name: "contentDefaultOpenWithLink"]

IconLink 

link to icon of item. [Role-name: "contentIconLink"]

ThumbnailLink 

link to thumbnail of the item. [Role-name: "contentThumbnailLink"]

Title 

title of item. [Role-name: "contentTitle"]

MimeType 

mime type of item. [Role-name: "contentMimeType"]

Description 

description of item. [Role-name: "contentDescription"]

IsStarred 

item is starred or not. [Role-name: "contentIsStarred"]

IsHidden 

item is hidden or not. [Role-name: "contentIsHidden"]

IsTrashed 

item is trashed. [Role-name: "contentIsTrashed"]

IsRestricted 

item is restricted or not. [Role-name: "contentIsRestricted"]

IsViewed 

item is viewed or not. [Role-name: "contentIsViewed"]

CreatedDate 

creation date of the item. [Role-name: "contentCreatedDate"]

ModifiedDate 

modified date of the item. [Role-name: "contentModifiedDate"]

ModifiedByMeDate 

last modified date by the current user. [Role-name: "contentModifiedByMeDate"]

LastViewedByMeDate 

item last viewed by me date time. [Role-name: "contentLastViewedByMeDate"]

SharedWithMeDate 

item shared date time. [Role-name: "contentSharedWithMeDate"]

DownloadUrl 

item downloaded url. [Role-name: "contentDownloadUrl"]

ExportLinks 

QVariantMap of item export links. [Role-name: "contentExportLinks"]

IndexableText 

indexable text of item. [Role-name: "contentIndexableText"]

UserPermissions 

QVariantMap of user permissions. [Role-name: "contentUserPermissions"]

OriginalFileName 

original file name of item. [Role-name: "contentOriginalFileName"]

FileExtension 

file extension of item. [Role-name: "contentFileExtension"]

Md5Checksum 

md5 checksum of item. [Role-name: "contentMd5Checksum"]

FileSize 

file size of item. [Role-name: "contentFileSize"]

QuataBytesUsed 

quata bytes used. [Role-name: "contentQuataBytesUsed"]

OwnerNames 

string list of names of owners of item. [Role-name: "contentOwnerNames"]

Owners 

QVariantMap of owners of item. [Role-name: "contentOwners.

LastModifyingUserName 

last modified user's name. [Role-name: "contentLastModifyingUserName"]

LastModifyingUser 

QVariantMap map of info about last modifying user. [Role-name: "contentLastModifyingUser"]

IsEditable 

item is editable by current user or not. [Role-name: "contentIsEditable"]

IsCopyable 

item is copyable by the current user or not. [Role-name: "contentIsCopyable"]

CanWritersShare 

can the user with write permission can share file or not. [Role-name: "contentCanWritersShare"]

IsShared 

is item shared or not. [Role-name: "contentIsShared"]

IsExplicitlyTrashed 

whether the item was explicitly trashed. [Role-name: "contentIsExplicitlyTrashed"]

IsAppDataContents 

item has appdata contents or not. [Role-name: "contentIsAppDataContents"]

HeadRevisionId 

latest revision of item. [Role-name: "contentHeadRevisionId"]

Properties 

list or QVariantMap of properties of item. [Role-name: "contentProperties"]

ImageMediaMetaData 

QVariantMap of image meta data. [Role-name: "contentImageMediaMetaData"]

IsFolder 

whether item is a folder or not. [Role-name: "contentIsFolder"]

IsFile 

whether item is a file or not. [Role-name: "contentIsFile"]

IsSpecialItem 

whether item is a special item or not. [Role-name: "contentIsSpecialItem"]

IsFileInfoLoaded 

whether the file information is loaded from drive or not. [Role-name: "contentIsFileInfoLoaded"]

IsFolderContentLoaded 

whether the contents (folders and files) inside the item is loaded or not. [Role-name: "contentIsFolderContentLoaded"]

MinField 

starting Enumeration value of Field.

MaxField 

ending Enumeration value of Field.

The enumeration values of ContentVisibility is used to customize the contents of the content model.

Enumerator
ShowMyDrive 

show contents of my drive.

ShowSharedWithMe 

show contents of shared with me.

ShowTrashed 

show contents of trashed.

ShowStarred 

show contents of starred.

ShowAll 

show all the contents. i.e My drive, Shared with me, Starred and Trashed.

The enumeration values of SpecialItem is used to fetch information about special items(root items on content model).

Enumerator
MyDrive 

represents MyDrive root item inside content model.

SharedWithMe 

represents SharedWithMe root item inside content model.

Trash 

represents Trash root item inside content model.

Starred 

represents Starred root item inside content model.

Member Function Documentation

GCF::IGDriveLiteContentModel::setContentVisibility ( int  flags)
pure virtual

Sets the visible contents of the content model to flags. Check GCF::IGDriveLite::ContentVisibility more details about specifying flags.

Parameters
flagscombination of GCF::IGDriveLite::ContentVisibility .
GCF::IGDriveLiteContentModel::contentVisibility ( ) const
pure virtual
Returns
the current content visibility flags set.
GCF::IGDriveLiteContentModel::setColumns ( const QList< Field > &  fields)
pure virtual

Sets the columns of this according to fields. QList<Field> &fields is a list of enumeration values of GCF::IGDriveLiteContentModel::Field. The columns are constructed based on the given enumeration values and in respective order.

Parameters
fieldslist of enumeration values of GCF::IGDriveLiteContentModel::Field based upon which model columns need to be constructed.
GCF::IGDriveLiteContentModel::columns ( ) const
pure virtual

Returns the columns of content model. QList<int> will contain the enumeration values of GCF::JobListModel::Field the order in which the columns are set in the model.

Returns
QList<Field> list of enumeration values of GCF::JobListModel::Field.
GCF::IGDriveLiteContentModel::refresh ( const QModelIndex &  index = QModelIndex())
pure virtual

Refreshes the item corresponding to QModelIndex. If item is a folder then it will also fetch first level of child items inside the that.

Parameters
indexindex of item to be refreshed.
GCF::IGDriveLiteContentModel::item ( const QModelIndex &  index) const
pure virtual

Returns item for that index.

Returns
GCF::GDriveContent::Item for index.
GCF::IGDriveLiteContentModel::item ( const QString &  id) const
pure virtual

Returns item for google drive id of the item.

Returns
GCF::GDriveContent::Item for id.
GCF::IGDriveLiteContentModel::indexForId ( const QString &  id,
int  column = 0 
) const
pure virtual

Returns index of item for google drive id .

Returns
QModelIndex for id.

Returns list of index of item for google drive id if file is present in multiple folders.

Returns
QModelIndexList for id.
GCF::IGDriveLiteContentModel::specialItemIndex ( SpecialItem  item) const
pure virtual

Returns item for the enumeration value. GCF::IGDriveLiteContentModel::SpecialIndexlist.

Returns
QModelIndex for enumeration value item.
GCF::IGDriveLiteContentModel::fileItemLoaded ( const QModelIndex &  index)
pure virtual

This signal is emitted when information about a particular item has been loaded.

Parameters
indexindex of item loaded.
GCF::IGDriveLiteContentModel::folderItemLoaded ( const QModelIndex &  index)
pure virtual

This signal is emitted when contents of a folder has been loaded.

Parameters
indexindex of item loaded.