src/gui/dialogs/qfilesystemmodel_p.h
changeset 7 f7bc934e204c
parent 0 1918ee327afb
child 30 5dc02b23752f
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
   236     void addVisibleFiles(QFileSystemNode *parentNode, const QStringList &newFiles);
   236     void addVisibleFiles(QFileSystemNode *parentNode, const QStringList &newFiles);
   237     void removeVisibleFile(QFileSystemNode *parentNode, int visibleLocation);
   237     void removeVisibleFile(QFileSystemNode *parentNode, int visibleLocation);
   238     void sortChildren(int column, const QModelIndex &parent);
   238     void sortChildren(int column, const QModelIndex &parent);
   239 
   239 
   240     inline int translateVisibleLocation(QFileSystemNode *parent, int row) const {
   240     inline int translateVisibleLocation(QFileSystemNode *parent, int row) const {
   241         if (sortOrder == Qt::AscendingOrder)
   241         if (sortOrder != Qt::AscendingOrder) {
   242                 return row;
   242             if (parent->dirtyChildrenIndex == -1)
   243         if (parent->dirtyChildrenIndex == -1 || row < parent->dirtyChildrenIndex)
   243                 return parent->visibleChildren.count() - row - 1;
   244             if (parent->dirtyChildrenIndex != -1)
   244 
       
   245             if (row < parent->dirtyChildrenIndex)
   245                 return parent->dirtyChildrenIndex - row - 1;
   246                 return parent->dirtyChildrenIndex - row - 1;
   246             else
   247         }
   247                 return parent->visibleChildren.count() - row - 1;
   248 
   248         else
   249         return row;
   249             return row;
       
   250     }
   250     }
   251 
   251 
   252     inline static QString myComputer() {
   252     inline static QString myComputer() {
   253         // ### TODO We should query the system to find out what the string should be
   253         // ### TODO We should query the system to find out what the string should be
   254         // XP == "My Computer",
   254         // XP == "My Computer",