MailTransport

transportconfigwidget.h
1 /*
2  SPDX-FileCopyrightText: 2009 Constantin Berzan <[email protected]>
3 
4  Based on MailTransport code by:
5  SPDX-FileCopyrightText: 2006-2007 Volker Krause <[email protected]>
6 
7  Based on KMail code by:
8  SPDX-FileCopyrightText: 2001-2002 Michael Haeckel <[email protected]>
9 
10  SPDX-License-Identifier: LGPL-2.0-or-later
11 */
12 
13 #pragma once
14 
15 #include "mailtransport_export.h"
16 #include <QWidget>
17 
18 #include <memory>
19 
21 
22 namespace MailTransport
23 {
24 class Transport;
25 class TransportConfigWidgetPrivate;
26 
27 /**
28  @internal
29 
30  Abstract configuration widget for a mail transport. It makes sure that
31  the configured transport has a unique name, and takes care of writing its
32  settings to the config file. If it is a new transport, the caller must
33  still call TransportManager::addTransport() to register the transport.
34 
35  Concrete configuration is done in subclasses SMTPConfigWidget.
36 
37  To configure a transport from applications, use
38  TransportManager::configureTransport(). You still need to call
39  TransportManager::addTransport() if this is a new transport, not registered
40  with TransportManager.
41 
42  @author Constantin Berzan <[email protected]>
43  @since 4.4
44 */
45 class MAILTRANSPORT_EXPORT TransportConfigWidget : public QWidget
46 {
47  Q_OBJECT
48 
49 public:
50  /**
51  Creates a new mail transport configuration widget for the given
52  Transport object.
53  @param transport The Transport object to configure.
54  @param parent The parent widget.
55  */
56  explicit TransportConfigWidget(Transport *transport, QWidget *parent = nullptr);
57 
58  /**
59  Destroys the widget.
60  */
61  ~TransportConfigWidget() override;
62 
63  /**
64  @internal
65  Get the KConfigDialogManager for this widget.
66  */
67  KConfigDialogManager *configManager() const;
68 
69 public Q_SLOTS:
70  /**
71  Saves the transport's settings.
72 
73  The base implementation writes the settings to the config file and makes
74  sure the transport has a unique name. Reimplement in derived classes to
75  save your custom settings, and call the base implementation.
76  */
77  // TODO: do we also want to check for invalid settings?
78  virtual void apply();
79 
80 protected:
81  std::unique_ptr<TransportConfigWidgetPrivate> const d_ptr;
82  TransportConfigWidget(TransportConfigWidgetPrivate &dd, Transport *transport, QWidget *parent);
83 
84 private:
85  Q_DECLARE_PRIVATE(TransportConfigWidget)
86 
87  void init(Transport *transport);
88 };
89 } // namespace MailTransport
QCA_EXPORT void init()
Represents the settings of a specific mail transport.
Definition: transport.h:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 03:58:25 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.