Commit 2ca7adf3 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Improve combobox

parent 1e06fe5c
......@@ -39,6 +39,7 @@ public:
q->connect(consumer,SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)),q,SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)));
q->connect(consumer,SIGNAL(activityAdded(QString)),q,SLOT(slotActivityAdded(QString)));
q->connect(consumer,SIGNAL(activityRemoved(QString)),q,SLOT(slotActivityRemoved(QString)));
q->connect(consumer,SIGNAL(currentActivityChanged(QString)),q,SIGNAL(currentActivityChanged(QString)));
}
~ActivityManagerPrivate()
{
......
......@@ -44,6 +44,7 @@ Q_SIGNALS:
void serviceStatusChanged(KActivities::Consumer::ServiceStatus);
void activityAdded(const QString&);
void activityRemoved(const QString&);
void currentActivityChanged(const QString&);
private:
friend class ActivityManagerPrivate;
......
......@@ -17,13 +17,13 @@
#include "mainwindow.h"
#include <QTextEdit>
MainWindow::MainWindow()
: QMainWindow()
{
mEdit = new QTextEdit;
setCentralWidget(mEdit);
QWidget *w = new QWidget;
setCentralWidget(w);
}
#include "mainwindow.moc"
......@@ -20,15 +20,11 @@
#include <QMainWindow>
class QTextEdit;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
private:
QTextEdit *mEdit;
};
#endif // MAINWINDOW_H
......@@ -19,6 +19,7 @@
*/
#include "transportcomboboxactivity.h"
#include "activitymanager.h"
namespace PimActivity {
......@@ -30,6 +31,19 @@ public:
activityManager(manager)
{
}
void connectSignals()
{
if (activityManager) {
q->connect(activityManager, SIGNAL(currentActivityChanged(QString)), q, SLOT(slotCurrentActivityChanged(QString)));
}
}
void slotCurrentActivityChanged(const QString &id)
{
q->updateComboboxList();
}
TransportComboboxActivity *q;
ActivityManager *activityManager;
};
......@@ -42,6 +56,7 @@ TransportComboboxActivity::TransportComboboxActivity(QWidget *parent)
TransportComboboxActivity::TransportComboboxActivity(ActivityManager *manager, QWidget *parent)
: MailTransport::TransportComboBox(parent), d(new TransportComboboxActivityPrivate(manager, this))
{
d->connectSignals();
}
TransportComboboxActivity::~TransportComboboxActivity()
......@@ -52,6 +67,12 @@ TransportComboboxActivity::~TransportComboboxActivity()
void TransportComboboxActivity::setActivityManager(ActivityManager *manager)
{
d->activityManager = manager;
d->connectSignals();
}
void TransportComboboxActivity::updateComboboxList()
{
//TODO
}
}
......
......@@ -38,9 +38,13 @@ public:
void setActivityManager(ActivityManager *manager);
protected Q_SLOTS:
void updateComboboxList();
private:
friend class TransportComboboxActivityPrivate;
TransportComboboxActivityPrivate * const d;
Q_PRIVATE_SLOT( d, void slotCurrentActivityChanged(const QString&))
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment