src/qt3support/dialogs/q3filedialog.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     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 Qt3Support module of the Qt Toolkit.
     7 ** This file is part of the Qt3Support module of the Qt Toolkit.
     8 **
     8 **
   473 static bool bShowHiddenFiles = false;
   473 static bool bShowHiddenFiles = false;
   474 static int sortFilesBy = (int)QDir::Name;
   474 static int sortFilesBy = (int)QDir::Name;
   475 static bool sortAscending = true;
   475 static bool sortAscending = true;
   476 static bool detailViewMode = false;
   476 static bool detailViewMode = false;
   477 
   477 
   478 static Q3CleanupHandler<QPixmap> qfd_cleanup_pixmap;
       
   479 static Q3CleanupHandler<QString> qfd_cleanup_string;
   478 static Q3CleanupHandler<QString> qfd_cleanup_string;
       
   479 
       
   480 static void qt_cleanup_fd_pixmaps();
       
   481 typedef QList<QPixmap *> FDPixmaps;
       
   482 Q_GLOBAL_STATIC_WITH_INITIALIZER(FDPixmaps, qfd_pixmaps, qAddPostRoutine(qt_cleanup_fd_pixmaps))
       
   483 
       
   484 static void qt_cleanup_fd_pixmaps()
       
   485 {
       
   486     qDeleteAll(*qfd_pixmaps());
       
   487 }
   480 
   488 
   481 static QString toRootIfNotExists( const QString &path )
   489 static QString toRootIfNotExists( const QString &path )
   482 {
   490 {
   483     if ( !path.isEmpty() )
   491     if ( !path.isEmpty() )
   484         return path;
   492         return path;
   531     if (!openFolderIcon) {
   539     if (!openFolderIcon) {
   532         workingDirectory = new QString(toRootIfNotExists( QDir::currentDirPath() ));
   540         workingDirectory = new QString(toRootIfNotExists( QDir::currentDirPath() ));
   533         qfd_cleanup_string.add(&workingDirectory);
   541         qfd_cleanup_string.add(&workingDirectory);
   534 
   542 
   535         openFolderIcon = new QPixmap((const char **)open_xpm);
   543         openFolderIcon = new QPixmap((const char **)open_xpm);
   536         qfd_cleanup_pixmap.add(&openFolderIcon);
   544         qfd_pixmaps()->append(openFolderIcon);
   537         symLinkDirIcon = new QPixmap((const char **)link_dir_xpm);
   545         symLinkDirIcon = new QPixmap((const char **)link_dir_xpm);
   538         qfd_cleanup_pixmap.add(&symLinkDirIcon);
   546         qfd_pixmaps()->append(symLinkDirIcon);
   539         symLinkFileIcon = new QPixmap((const char **)link_file_xpm);
   547         symLinkFileIcon = new QPixmap((const char **)link_file_xpm);
   540         qfd_cleanup_pixmap.add(&symLinkFileIcon);
   548         qfd_pixmaps()->append(symLinkFileIcon);
   541         fileIcon = new QPixmap((const char **)file_xpm);
   549         fileIcon = new QPixmap((const char **)file_xpm);
   542         qfd_cleanup_pixmap.add(&fileIcon);
   550         qfd_pixmaps()->append(fileIcon);
   543         closedFolderIcon = new QPixmap((const char **)closed_xpm);
   551         closedFolderIcon = new QPixmap((const char **)closed_xpm);
   544         qfd_cleanup_pixmap.add(&closedFolderIcon);
   552         qfd_pixmaps()->append(closedFolderIcon);
   545         detailViewIcon = new QPixmap((const char **)detailedview_xpm);
   553         detailViewIcon = new QPixmap((const char **)detailedview_xpm);
   546         qfd_cleanup_pixmap.add(&detailViewIcon);
   554         qfd_pixmaps()->append(detailViewIcon);
   547         multiColumnListViewIcon = new QPixmap((const char **)mclistview_xpm);
   555         multiColumnListViewIcon = new QPixmap((const char **)mclistview_xpm);
   548         qfd_cleanup_pixmap.add(&multiColumnListViewIcon);
   556         qfd_pixmaps()->append(multiColumnListViewIcon);
   549         cdToParentIcon = new QPixmap((const char **)cdtoparent_xpm);
   557         cdToParentIcon = new QPixmap((const char **)cdtoparent_xpm);
   550         qfd_cleanup_pixmap.add(&cdToParentIcon);
   558         qfd_pixmaps()->append(cdToParentIcon);
   551         newFolderIcon = new QPixmap((const char **)newfolder_xpm);
   559         newFolderIcon = new QPixmap((const char **)newfolder_xpm);
   552         qfd_cleanup_pixmap.add(&newFolderIcon);
   560         qfd_pixmaps()->append(newFolderIcon);
   553         previewInfoViewIcon
   561         previewInfoViewIcon
   554             = new QPixmap((const char **)previewinfoview_xpm);
   562             = new QPixmap((const char **)previewinfoview_xpm);
   555         qfd_cleanup_pixmap.add(&previewInfoViewIcon);
   563         qfd_pixmaps()->append(previewInfoViewIcon);
   556         previewContentsViewIcon
   564         previewContentsViewIcon
   557             = new QPixmap((const char **)previewcontentsview_xpm);
   565             = new QPixmap((const char **)previewcontentsview_xpm);
   558         qfd_cleanup_pixmap.add(&previewContentsViewIcon);
   566         qfd_pixmaps()->append(previewContentsViewIcon);
   559         startCopyIcon = new QPixmap((const char **)start_xpm);
   567         startCopyIcon = new QPixmap((const char **)start_xpm);
   560         qfd_cleanup_pixmap.add(&startCopyIcon);
   568         qfd_pixmaps()->append(startCopyIcon);
   561         endCopyIcon = new QPixmap((const char **)end_xpm);
   569         endCopyIcon = new QPixmap((const char **)end_xpm);
   562         qfd_cleanup_pixmap.add(&endCopyIcon);
   570         qfd_pixmaps()->append(endCopyIcon);
   563         goBackIcon = new QPixmap((const char **)back_xpm);
   571         goBackIcon = new QPixmap((const char **)back_xpm);
   564         qfd_cleanup_pixmap.add(&goBackIcon);
   572         qfd_pixmaps()->append(goBackIcon);
   565         fifteenTransparentPixels = new QPixmap(closedFolderIcon->width(), 1);
   573         fifteenTransparentPixels = new QPixmap(closedFolderIcon->width(), 1);
   566         qfd_cleanup_pixmap.add(&fifteenTransparentPixels);
   574         qfd_pixmaps()->append(fifteenTransparentPixels);
   567         QBitmap m(fifteenTransparentPixels->width(), 1);
   575         QBitmap m(fifteenTransparentPixels->width(), 1);
   568         m.fill(Qt::color0);
   576         m.fill(Qt::color0);
   569         fifteenTransparentPixels->setMask(m);
   577         fifteenTransparentPixels->setMask(m);
   570         bShowHiddenFiles = false;
   578         bShowHiddenFiles = false;
   571         sortFilesBy = (int)QDir::Name;
   579         sortFilesBy = (int)QDir::Name;