-rw-r--r-- | core/pim/today/today.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index e6f8c93..76bd6de 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -43,97 +43,96 @@ struct TodayPlugin { | |||
43 | QLibrary *library; | 43 | QLibrary *library; |
44 | QInterfacePtr<TodayPluginInterface> iface; | 44 | QInterfacePtr<TodayPluginInterface> iface; |
45 | TodayPluginObject *guiPart; | 45 | TodayPluginObject *guiPart; |
46 | QWidget *guiBox; | 46 | QWidget *guiBox; |
47 | QString name; | 47 | QString name; |
48 | bool active; | 48 | bool active; |
49 | bool excludeRefresh; | 49 | bool excludeRefresh; |
50 | int pos; | 50 | int pos; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | static QValueList<TodayPlugin> pluginList; | 53 | static QValueList<TodayPlugin> pluginList; |
54 | 54 | ||
55 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 55 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
56 | : TodayBase( parent, name, fl ) { | 56 | : TodayBase( parent, name, fl ) { |
57 | 57 | ||
58 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 58 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
59 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 59 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
60 | 60 | ||
61 | #if defined(Q_WS_QWS) | 61 | #if defined(Q_WS_QWS) |
62 | #if !defined(QT_NO_COP) | 62 | #if !defined(QT_NO_COP) |
63 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 63 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
64 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | 64 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), |
65 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | 65 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); |
66 | #endif | 66 | #endif |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | setOwnerField(); | 69 | setOwnerField(); |
70 | m_refreshTimer = new QTimer( this ); | 70 | m_refreshTimer = new QTimer( this ); |
71 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 71 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
72 | m_refreshTimer->start( 15000 ); | 72 | m_refreshTimer->start( 15000 ); |
73 | refresh(); | 73 | refresh(); |
74 | showMaximized(); | 74 | showMaximized(); |
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Qcop receive method. | 78 | * Qcop receive method. |
79 | */ | 79 | */ |
80 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 80 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { |
81 | QDataStream stream( data, IO_ReadOnly ); | 81 | QDataStream stream( data, IO_ReadOnly ); |
82 | if ( msg == "message(QString)" ) { | 82 | if ( msg == "message(QString)" ) { |
83 | QString message; | 83 | QString message; |
84 | stream >> message; | 84 | stream >> message; |
85 | setOwnerField( message ); | 85 | setOwnerField( message ); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | void Today::setRefreshTimer( int interval ) { | 89 | void Today::setRefreshTimer( int interval ) { |
90 | 90 | ||
91 | |||
92 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 91 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
93 | 92 | ||
94 | // 0 is "never" case | 93 | // 0 is "never" case |
95 | if ( !interval == 0 ) { | 94 | if ( !interval == 0 ) { |
96 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 95 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
97 | m_refreshTimer->changeInterval( interval ); | 96 | m_refreshTimer->changeInterval( interval ); |
98 | } | 97 | } |
99 | } | 98 | } |
100 | 99 | ||
101 | 100 | ||
102 | /** | 101 | /** |
103 | * Initialises the owner field with the default value, the username | 102 | * Initialises the owner field with the default value, the username |
104 | */ | 103 | */ |
105 | void Today::setOwnerField() { | 104 | void Today::setOwnerField() { |
106 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); | 105 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); |
107 | if ( QFile::exists( file ) ) { | 106 | if ( QFile::exists( file ) ) { |
108 | Contact cont = Contact::readVCard( file )[0]; | 107 | Contact cont = Contact::readVCard( file )[0]; |
109 | QString returnString = cont.fullName(); | 108 | QString returnString = cont.fullName(); |
110 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); | 109 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); |
111 | } else { | 110 | } else { |
112 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); | 111 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); |
113 | } | 112 | } |
114 | } | 113 | } |
115 | 114 | ||
116 | /** | 115 | /** |
117 | * Set the owner field with a given QString, for example per qcop. | 116 | * Set the owner field with a given QString, for example per qcop. |
118 | */ | 117 | */ |
119 | void Today::setOwnerField( QString &message ) { | 118 | void Today::setOwnerField( QString &message ) { |
120 | if ( !message.isEmpty() ) { | 119 | if ( !message.isEmpty() ) { |
121 | OwnerField->setText( "<b>" + message + "</b>" ); | 120 | OwnerField->setText( "<b>" + message + "</b>" ); |
122 | } | 121 | } |
123 | } | 122 | } |
124 | 123 | ||
125 | 124 | ||
126 | /** | 125 | /** |
127 | * Init stuff needed for today. Reads the config file. | 126 | * Init stuff needed for today. Reads the config file. |
128 | */ | 127 | */ |
129 | void Today::init() { | 128 | void Today::init() { |
130 | // read config | 129 | // read config |
131 | Config cfg( "today" ); | 130 | Config cfg( "today" ); |
132 | 131 | ||
133 | cfg.setGroup( "Plugins" ); | 132 | cfg.setGroup( "Plugins" ); |
134 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 133 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
135 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); | 134 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); |
136 | 135 | ||
137 | cfg.setGroup( "General" ); | 136 | cfg.setGroup( "General" ); |
138 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 137 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
139 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); | 138 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); |