📄 q3filedialog.cpp
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the Qt3Support module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file. Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include "qplatformdefs.h"#include "q3filedialog.h"#ifndef QT_NO_FILEDIALOG#include "private/qapplication_p.h"#include "q3buttongroup.h"#include "q3header.h"#include "q3listview.h"#include "qapplication.h"#include "qbitmap.h"#include "qcheckbox.h"#include "q3cleanuphandler.h"#include "qcombobox.h"#include "q3combobox.h"#include "q3cstring.h"#include "qcursor.h"#include "qdesktopwidget.h"#include "q3dragobject.h"#include "qevent.h"#include "qfile.h"#include "qlabel.h"#include "qlayout.h"#include "qlibrary.h"#include "qlineedit.h"#include "q3listbox.h"#include "qmap.h"#include "qmessagebox.h"#include "qmime.h"#include "qpainter.h"#include "qpointer.h"#include "q3popupmenu.h"#include "q3progressbar.h"#include "q3ptrvector.h"#include "qpushbutton.h"#include "qregexp.h"#include "qsplitter.h"#include "q3strlist.h"#include "qstyle.h"#include "qtimer.h"#include "qtoolbutton.h"#include "qtooltip.h"#include "q3widgetstack.h"#include "q3urloperator.h"#include "q3vbox.h"#include "qurlinfo.h"#ifdef Q_WS_WIN#ifndef QT_NO_THREAD# include "qwindowsstyle.h"# include "private/qmutexpool_p.h"#endif#endif // Q_WS_WIN#ifndef Q_OS_TEMP#include <time.h>#else#include <shellapi.h>#endif // Q_OS_TEMP#include <stdlib.h>#include <limits.h>#include <ctype.h>#ifdef Q_WS_MAC#include "qmacstyle_mac.h"#include "private/qt_mac_p.h"#include "private/qunicodetables_p.h"#undef check#endif#if defined(Q_OS_OPENBSD)#include <sys/param.h>#endif/* XPM */static const char * const start_xpm[]={ "16 15 8 1", "a c #cec6bd", "# c #000000", "e c #ffff00", "b c #999999", "f c #cccccc", "d c #dcdcdc", "c c #ffffff", ". c None", ".....######aaaaa", "...bb#cccc##aaaa", "..bcc#cccc#d#aaa", ".bcef#cccc#dd#aa", ".bcfe#cccc#####a", ".bcef#ccccccccc#", "bbbbbbbbbbbbccc#", "bccccccccccbbcc#", "bcefefefefee#bc#", ".bcefefefefef#c#", ".bcfefefefefe#c#", "..bcfefefefeeb##", "..bbbbbbbbbbbbb#", "...#############", "................"};/* XPM */static const char * const end_xpm[]={ "16 15 9 1", "d c #a0a0a0", "c c #c3c3c3", "# c #cec6bd", ". c #000000", "f c #ffff00", "e c #999999", "g c #cccccc", "b c #ffffff", "a c None", "......####aaaaaa", ".bbbb..###aaaaaa", ".bbbb.c.##aaaaaa", ".bbbb....ddeeeea", ".bbbbbbb.bbbbbe.", ".bbbbbbb.bcfgfe.", "eeeeeeeeeeeeefe.", "ebbbbbbbbbbeege.", "ebfgfgfgfgff.ee.", "aebfgfgfgfgfg.e.", "aebgfgfgfgfgf.e.", "aaebgfgfgfgffe..", "aaeeeeeeeeeeeee.", "aaa.............", "aaaaaaaaaaaaaaaa"};/* XPM */static const char* const open_xpm[]={ "16 16 6 1", ". c None", "b c #ffff00", "d c #000000", "* c #999999", "c c #cccccc", "a c #ffffff", "................", "................", "...*****........", "..*aaaaa*.......", ".*abcbcba******.", ".*acbcbcaaaaaa*d", ".*abcbcbcbcbcb*d", "*************b*d", "*aaaaaaaaaa**c*d", "*abcbcbcbcbbd**d", ".*abcbcbcbcbcd*d", ".*acbcbcbcbcbd*d", "..*acbcbcbcbb*dd", "..*************d", "...ddddddddddddd", "................"};/* XPM */static const char * const link_dir_xpm[]={ "16 16 10 1", "h c #808080", "g c #a0a0a0", "d c #000000", "b c #ffff00", "f c #303030", "# c #999999", "a c #cccccc", "e c #585858", "c c #ffffff", ". c None", "................", "................", "..#####.........", ".#ababa#........", "#abababa######..", "#cccccccccccc#d.", "#cbababababab#d.", "#cabababababa#d.", "#cbababdddddddd.", "#cababadccccccd.", "#cbababdcececcd.", "#cababadcefdfcd.", "#cbababdccgdhcd.", "#######dccchccd.", ".dddddddddddddd.", "................"};/* XPM */static const char * const link_file_xpm[]={ "16 16 10 1", "h c #808080", "g c #a0a0a0", "d c #c3c3c3", ". c #7f7f7f", "c c #000000", "b c #bfbfbf", "f c #303030", "e c #585858", "a c #ffffff", "# c None", "################", "..........######", ".aaaaaaaab.#####", ".aaaaaaaaba.####", ".aaaaaaaacccc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaadc###", ".aaaaaaaaaadc###", ".aaaacccccccc###", ".aaaacaaaaaac###", ".aaaacaeaeaac###", ".aaaacaefcfac###", ".aaaacaagchac###", ".ddddcaaahaac###", "ccccccccccccc###"};/* XPM */static const char* const file_xpm[]={ "16 16 5 1", ". c #7f7f7f", "# c None", "c c #000000", "b c #bfbfbf", "a c #ffffff", "################", "..........######", ".aaaaaaaab.#####", ".aaaaaaaaba.####", ".aaaaaaaacccc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".aaaaaaaaaabc###", ".bbbbbbbbbbbc###", "ccccccccccccc###"};/* XPM */static const char * const closed_xpm[]={ "16 16 6 1", ". c None", "b c #ffff00", "d c #000000", "* c #999999", "a c #cccccc", "c c #ffffff", "................", "................", "..*****.........", ".*ababa*........", "*abababa******..", "*cccccccccccc*d.", "*cbababababab*d.", "*cabababababa*d.", "*cbababababab*d.", "*cabababababa*d.", "*cbababababab*d.", "*cabababababa*d.", "*cbababababab*d.", "**************d.", ".dddddddddddddd.", "................"};/* XPM */static const char* const cdtoparent_xpm[]={ "15 13 3 1", ". c None", "* c #000000", "a c #ffff99", "..*****........", ".*aaaaa*.......", "***************", "*aaaaaaaaaaaaa*", "*aaaa*aaaaaaaa*", "*aaa***aaaaaaa*", "*aa*****aaaaaa*", "*aaaa*aaaaaaaa*", "*aaaa*aaaaaaaa*", "*aaaa******aaa*", "*aaaaaaaaaaaaa*", "*aaaaaaaaaaaaa*", "***************"};/* XPM */static const char* const newfolder_xpm[] = { "15 14 4 1", " c None", ". c #000000", "+ c #FFFF00", "@ c #FFFFFF", " . ", " ", " . ", " . . ", " .... . . . ", " .+@+@. . . ", ".......... . .", ".@+@+@+@+@.. ", ".+@+@+@+@+. . ", ".@+@+@+@+@. . ", ".+@+@+@+@+. ", ".@+@+@+@+@. ", ".+@+@+@+@+. ", "........... "};/* XPM */static const char* const detailedview_xpm[]={ "14 11 3 1", ". c None", "* c #000000", "a c #000099", ".****.***.***.", "..............", "aaaaaaaaaaaaaa", "..............", ".****.***.***.", "..............", ".****.***.***.", "..............", ".****.***.***.", "..............", ".****.***.***."};/* XPM */static const char* const previewinfoview_xpm[]={ "13 13 4 1", ". c #00007f", "a c black", "# c #cec6bd", "b c #000000", "..#####aaaaaa", ".#.#bb#a#####", "...####a#bbb#", "#######a#####", "#######a#bb##", "..#####a#####", ".#.#bb#a#bbb#", "...####a#####", "#######a#bb##", "#######a#####", "..#####a#bbb#", ".#.#bb#a#####", "...####aaaaaa"};/* XPM */static const char* const previewcontentsview_xpm[]={ "14 13 5 1", ". c #00007f", "a c black", "c c #7f007f", "# c #cec6bd", "b c #000000", "..#####aaaaaaa", ".#.#bb#a#####a", "...####a#ccc#a", "#######a#ccc#a", "#######a#####a", "..#####a#bbb#a", ".#.#bb#a#####a", "...####a#bbb#a", "#######a#####a", "#######a#bbb#a", "..#####a#####a", ".#.#bb#a#####a", "...####aaaaaaa"};/* XPM */static const char* const mclistview_xpm[]={ "15 11 4 1", "* c None", "b c #000000", ". c #000099", "a c #ffffff", "...*****...****", ".a.*bbb*.a.*bbb", "...*****...****", "***************", "...*****...****", ".a.*bbb*.a.*bbb", "...*****...****", "***************", "...*****...****", ".a.*bbb*.a.*bbb", "...*****...****"};/* XPM */static const char * const back_xpm [] = { "13 11 3 1", "a c #00ffff", "# c #000000", ". c None", ".....#.......", "....##.......", "...#a#.......", "..#aa########", ".#aaaaaaaaaa#", "#aaaaaaaaaaa#", ".#aaaaaaaaaa#", "..#aa########", "...#a#.......", "....##.......", ".....#......."};static QPixmap * openFolderIcon = 0;static QPixmap * closedFolderIcon = 0;static QPixmap * detailViewIcon = 0;static QPixmap * multiColumnListViewIcon = 0;static QPixmap * cdToParentIcon = 0;static QPixmap * newFolderIcon = 0;static QPixmap * fifteenTransparentPixels = 0;static QPixmap * symLinkDirIcon = 0;static QPixmap * symLinkFileIcon = 0;static QPixmap * fileIcon = 0;static QPixmap * startCopyIcon = 0;static QPixmap * endCopyIcon = 0;static QPixmap * previewContentsViewIcon = 0;static QPixmap * previewInfoViewIcon = 0;static QPixmap *goBackIcon = 0;static Q3FileIconProvider * fileIconProvider = 0;static int lastWidth = 0;static int lastHeight = 0;static QString * workingDirectory = 0;static bool bShowHiddenFiles = false;static int sortFilesBy = (int)QDir::Name;static bool sortAscending = true;static bool detailViewMode = false;static Q3CleanupHandler<QPixmap> qfd_cleanup_pixmap;static Q3CleanupHandler<QString> qfd_cleanup_string;static QString toRootIfNotExists( const QString &path ){ if ( !path.isEmpty() ) return path;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -