4dbb07f614
On small screen devices such as iPhone targets, the save file dialog is using a non-native dialog, and it doesn't fit the screen real estate to the extent that the [Ok] button is clipped away. In addition, the open file dialog and the save file dialog doesn't cooperate very well on platforms such as iOS without more plumbing. Since using the file dialog is out of the scope for this example we remove all usages of it. Pick-to: 6.5 Change-Id: Ie165355ed0b671d93e44d2d55791156367b0ea5c Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
50 lines
1.0 KiB
C++
50 lines
1.0 KiB
C++
// Copyright (C) 2016 The Qt Company Ltd.
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
|
|
|
#ifndef ADDRESSWIDGET_H
|
|
#define ADDRESSWIDGET_H
|
|
|
|
#include "newaddresstab.h"
|
|
#include "tablemodel.h"
|
|
|
|
#include <QItemSelection>
|
|
#include <QTabWidget>
|
|
#include <QStandardPaths>
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QSortFilterProxyModel;
|
|
class QItemSelectionModel;
|
|
QT_END_NAMESPACE
|
|
|
|
//! [0]
|
|
class AddressWidget : public QTabWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
AddressWidget(QWidget *parent = nullptr);
|
|
void readFromFile();
|
|
void writeToFile();
|
|
|
|
public slots:
|
|
void showAddEntryDialog();
|
|
void addEntry(const QString &name, const QString &address);
|
|
void editEntry();
|
|
void removeEntry();
|
|
|
|
signals:
|
|
void selectionChanged (const QItemSelection &selected);
|
|
|
|
private:
|
|
void setupTabs();
|
|
|
|
inline static QString fileName =
|
|
QStandardPaths::standardLocations(QStandardPaths::TempLocation).value(0)
|
|
+ QStringLiteral("/addressbook.dat");
|
|
TableModel *table;
|
|
NewAddressTab *newAddressTab;
|
|
};
|
|
//! [0]
|
|
|
|
#endif // ADDRESSWIDGET_H
|