Qt 4.8
Classes | Functions | Variables
qfiledialog_mac.mm File Reference
#include "qfiledialog.h"
#include <qapplication.h>
#include <private/qapplication_p.h>
#include <private/qfiledialog_p.h>
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
#include <qregexp.h>
#include <qbuffer.h>
#include <qdebug.h>
#include <qstringlist.h>
#include <qaction.h>
#include <qtextcodec.h>
#include <qvarlengtharray.h>
#include <qdesktopwidget.h>
#include <stdlib.h>
#include <qabstracteventdispatcher.h>
#import <AppKit/NSSavePanel.h>
#include "ui_qfiledialog.h"

Go to the source code of this file.

Classes

class  QNSOpenSavePanelDelegate
 

Functions

QStringList qt_clean_filter_list (const QString &filter)
 
static QFileDialogPrivate::QtMacFilterName qt_mac_extract_filter (const QString &rawFilter, bool showDetails)
 
bool qt_mac_is_macsheet (const QWidget *w)
 
static QList< QFileDialogPrivate::QtMacFilterNameqt_mac_make_filters_list (const QString &filter, bool showDetails)
 
QStringList qt_make_filter_list (const QString &filter)
 

Variables

const char * qt_file_dialog_filter_reg_exp
 

Function Documentation

◆ qt_clean_filter_list()

QStringList qt_clean_filter_list ( const QString filter)

Definition at line 3189 of file qfiledialog.cpp.

Referenced by QFileDialogPrivate::_q_useNameFilter(), and QNSOpenSavePanelDelegate::findStrippedFilterWithVisualFilterName:.

3190 {
3192  QString f = filter;
3193  int i = regexp.indexIn(f);
3194  if (i >= 0)
3195  f = regexp.cap(2);
3196  return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
3197 }
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
The QString class provides a Unicode character string.
Definition: qstring.h:83
const char * qt_file_dialog_filter_reg_exp
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
QFuture< void > filter(Sequence &sequence, FilterFunction filterFunction)
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
Definition: qstring.cpp:6526
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ qt_mac_extract_filter()

static QFileDialogPrivate::QtMacFilterName qt_mac_extract_filter ( const QString rawFilter,
bool  showDetails 
)
static

Definition at line 952 of file qfiledialog_mac.mm.

Referenced by qt_mac_make_filters_list().

953 {
955  ret.filter = rawFilter;
956  QString result = rawFilter;
958  int index = r.indexIn(result);
959  if (index >= 0)
960  result = r.cap(2);
961 
962  if (showDetails) {
963  ret.description = rawFilter;
964  } else {
965  if (index >= 0)
966  ret.description = r.cap(1).trimmed();
967  if (ret.description.isEmpty())
968  ret.description = result;
969  }
970  ret.regexp = result.replace(QLatin1Char(' '), QLatin1Char(';'));
971  return ret;
972 }
const char * qt_file_dialog_filter_reg_exp
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
QString & replace(int i, int len, QChar after)
Definition: qstring.cpp:2005
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
Definition: qstring.cpp:4506
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
quint16 index
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ qt_mac_is_macsheet()

bool qt_mac_is_macsheet ( const QWidget w)

Definition at line 295 of file qwidget_mac.mm.

Referenced by QFileDialogPrivate::createNavServicesDialog(), and QFileDialogPrivate::hideCarbonNavServicesDialog().

296 {
297  if (!w)
298  return false;
299 
300  Qt::WindowModality modality = w->windowModality();
301  if (modality == Qt::ApplicationModal)
302  return false;
303  return w->parentWidget() && (modality == Qt::WindowModal || w->windowType() == Qt::Sheet);
304 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
Qt::WindowModality windowModality
which windows are blocked by the modal widget
Definition: qwidget.h:156
Qt::WindowType windowType() const
Returns the window type of this widget.
Definition: qwidget.h:937
WindowModality
Definition: qnamespace.h:1683

◆ qt_mac_make_filters_list()

static QList<QFileDialogPrivate::QtMacFilterName> qt_mac_make_filters_list ( const QString filter,
bool  showDetails 
)
static

Definition at line 974 of file qfiledialog_mac.mm.

Referenced by QFileDialogPrivate::createNavServicesDialog().

975 {
976 #ifdef DEBUG_FILEDIALOG_FILTERS
977  qDebug("QFileDialog:%d - Got filter (%s)", __LINE__, filter.latin1());
978 #endif
979 
981  QString f(filter);
982  if (f.isEmpty())
983  f = QFileDialog::tr("All Files (*)");
984  if (f.isEmpty())
985  return ret;
986  QStringList filts = qt_make_filter_list(f);
987  for (QStringList::const_iterator it = filts.constBegin(); it != filts.constEnd(); ++it) {
989 #ifdef DEBUG_FILEDIALOG_FILTERS
990  qDebug("QFileDialog:%d Split out filter (%d) '%s' '%s' [%s]", __LINE__, ret.count(),
991  filter->regxp.latin1(), filter->description.latin1(), (*it).latin1());
992 #endif
993  ret.append(filter);
994  }
995  return ret;
996 }
static QFileDialogPrivate::QtMacFilterName qt_mac_extract_filter(const QString &rawFilter, bool showDetails)
QStringList qt_make_filter_list(const QString &filter)
#define it(className, varName)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Definition: qlist.h:269
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
The QString class provides a Unicode character string.
Definition: qstring.h:83
Q_CORE_EXPORT void qDebug(const char *,...)
friend class const_iterator
Definition: qlist.h:264
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272

◆ qt_make_filter_list()

QStringList qt_make_filter_list ( const QString filter)

Definition at line 1075 of file qfiledialog.cpp.

Referenced by qt_mac_make_filters_list().

1076 {
1077  QString f(filter);
1078 
1079  if (f.isEmpty())
1080  return QStringList();
1081 
1082  QString sep(QLatin1String(";;"));
1083  int i = f.indexOf(sep, 0);
1084  if (i == -1) {
1085  if (f.indexOf(QLatin1Char('\n'), 0) != -1) {
1086  sep = QLatin1Char('\n');
1087  i = f.indexOf(sep, 0);
1088  }
1089  }
1090 
1091  return f.split(sep);
1092 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

Variable Documentation

◆ qt_file_dialog_filter_reg_exp

const char* qt_file_dialog_filter_reg_exp