00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "options.h"
00033
00034 #include <qtabwidget.h>
00035 #include <qlabel.h>
00036 #include <qlayout.h>
00037 #include <qhbox.h>
00038 #include <qtextview.h>
00039 #include <qpushbutton.h>
00040
00041 #include <kaboutapplication.h>
00042 #include <kglobal.h>
00043 #include <kinstance.h>
00044 #include <kiconloader.h>
00045 #include <kactivelabel.h>
00046
00047 #include "uiDialog.h"
00048
00049 QWidget *UIDialog::aboutPage(QWidget *parent, KAboutData *ad)
00050 {
00051 FUNCTIONSETUP;
00052
00053 QWidget *w = new QWidget(parent, "aboutpage");
00054
00055 QString s;
00056 QLabel *text;
00057 KIconLoader *l = KGlobal::iconLoader();
00058 const KAboutData *p = ad ? ad : KGlobal::instance()->aboutData();
00059
00060 QGridLayout *grid = new QGridLayout(w, 5, 4, SPACING);
00061
00062 grid->addColSpacing(0, SPACING);
00063 grid->addColSpacing(4, SPACING);
00064
00065
00066 #ifdef DEBUG
00067 DEBUGKPILOT << fname
00068 << ": Looking for icon for "
00069 << p->appName()
00070 << endl;
00071 #endif
00072
00073 QPixmap applicationIcon =
00074 l->loadIcon(QString::fromLatin1(p->appName()),
00075 KIcon::Desktop,
00076 64, KIcon::DefaultState, 0L,
00077 true);
00078
00079 if (applicationIcon.isNull())
00080 {
00081 #ifdef DEBUG
00082 DEBUGKPILOT << fname
00083 << ": Looking for icon for "
00084 << "kpilot"
00085 << endl;
00086 #endif
00087 applicationIcon = l->loadIcon(QString::fromLatin1("kpilot"),
00088 KIcon::Desktop);
00089 }
00090
00091 text = new QLabel(w);
00092
00093
00094
00095 text->setText(i18n("Send questions and comments to kdepim-users@kde.org"));
00096 text->adjustSize();
00097 #ifdef DEBUG
00098 DEBUGKPILOT << fname
00099 << ": Text size "
00100 << text->size().width()
00101 << ","
00102 << text->size().height()
00103 << endl;
00104 #endif
00105 int linewidth = text->size().width();
00106 int lineheight = text->size().height();
00107
00108
00109 text->setText(QString::null);
00110 text->setPixmap(applicationIcon);
00111 text->adjustSize();
00112 grid->addWidget(text, 0, 1);
00113
00114
00115 KActiveLabel *linktext = new KActiveLabel(w);
00116 grid->addRowSpacing(1,QMAX(100,6*lineheight));
00117 grid->addRowSpacing(2,QMAX(100,6*lineheight));
00118 grid->addColSpacing(2,SPACING+linewidth/2);
00119 grid->addColSpacing(3,SPACING+linewidth/2);
00120 grid->setRowStretch(1,50);
00121 grid->setRowStretch(2,50);
00122 grid->setColStretch(2,50);
00123 grid->setColStretch(3,50);
00124 linktext->setMinimumSize(linewidth,QMAX(260,60+12*lineheight));
00125 linktext->setFixedHeight(QMAX(260,60+12*lineheight));
00126 linktext->setVScrollBarMode(QScrollView::Auto);
00127 text = new QLabel(w);
00128 grid->addMultiCellWidget(text,0,0,2,3);
00129 grid->addMultiCellWidget(linktext,1,2,1,3);
00130
00131
00132 s = CSL1("<qt><h3>");
00133 s += p->programName();
00134 s += ' ';
00135 s += p->version();
00136 s += CSL1("</h3>");
00137 s += p->copyrightStatement() + CSL1("<br></qt>");
00138 text->setText(s);
00139
00140 linktext->append(p->shortDescription() + CSL1("<br>"));
00141
00142 if (!p->homepage().isEmpty())
00143 {
00144 s = QString::null;
00145 s += CSL1("<a href=\"%1\">").arg(p->homepage());
00146 s += p->homepage();
00147 s += CSL1("</a><br>");
00148 linktext->append(s);
00149 }
00150
00151 s = QString::null;
00152 s += i18n("Send questions and comments to <a href=\"mailto:%1\">%2</a>.")
00153 .arg( CSL1("kdepim-users@kde.org") )
00154 .arg( CSL1("kdepim-users@kde.org") );
00155 s += ' ';
00156 s += i18n("Send bug reports to <a href=\"mailto:%1\">%2</a>.")
00157 .arg(p->bugAddress())
00158 .arg(p->bugAddress());
00159 s += ' ';
00160 s += i18n("For trademark information, see the "
00161 "<a href=\"help:/kpilot/trademarks.html\">KPilot User's Guide</a>.");
00162 s += CSL1("<br>");
00163 linktext->append(s);
00164 linktext->append(QString::null);
00165
00166
00167
00168 QValueList<KAboutPerson> pl = p->authors();
00169 QValueList<KAboutPerson>::ConstIterator i;
00170
00171 s = i18n("<b>Authors:</b> ");
00172
00173 QString comma = CSL1(", ");
00174
00175 unsigned int count=1;
00176 for (i=pl.begin(); i!=pl.end(); ++i)
00177 {
00178 s.append(CSL1("%1 (<i>%2</i>)%3")
00179 .arg((*i).name())
00180 .arg((*i).task())
00181 .arg(count<pl.count() ? comma : QString::null)
00182 );
00183 count++;
00184 }
00185 linktext->append(s);
00186
00187 s = QString::null;
00188 pl = p->credits();
00189 if (pl.count()>0)
00190 {
00191 count=1;
00192 s.append(i18n("<b>Credits:</b> "));
00193 for (i=pl.begin(); i!=pl.end(); ++i)
00194 {
00195 s.append(CSL1("%1 (<i>%2</i>)%3")
00196 .arg((*i).name())
00197 .arg((*i).task())
00198 .arg(count<pl.count() ? comma : QString::null)
00199 );
00200 count++;
00201 }
00202 }
00203 linktext->append(s);
00204 linktext->ensureVisible(0,0);
00205
00206 #ifdef DEBUG
00207 DEBUGKPILOT << fname
00208 << ": Size "
00209 << w->size().width()
00210 << ","
00211 << w->size().height()
00212 << endl;
00213 #endif
00214
00215 w->adjustSize();
00216 #ifdef DEBUG
00217 DEBUGKPILOT << fname
00218 << ": Adjusted size "
00219 << w->size().width()
00220 << ","
00221 << w->size().height()
00222 << endl;
00223 #endif
00224
00225 return w;
00226 }
00227
00228 void UIDialog::addAboutPage(QTabWidget *tw,
00229 KAboutData *ad,
00230 bool )
00231 {
00232 FUNCTIONSETUP;
00233
00234 Q_ASSERT(tw);
00235
00236 QWidget *w = UIDialog::aboutPage(tw,ad);
00237 QSize sz = w->size();
00238
00239 if (sz.width() < tw->size().width())
00240 {
00241 sz.setWidth(tw->size().width());
00242 }
00243 if (sz.height() < tw->size().height())
00244 {
00245 sz.setHeight(tw->size().height());
00246 }
00247
00248 #ifdef DEBUG
00249 DEBUGKPILOT << fname
00250 << ": Final size "
00251 << sz.width()
00252 << ","
00253 << sz.height()
00254 << endl;
00255 #endif
00256
00257 tw->resize(sz);
00258 tw->addTab(w, i18n("About"));
00259 tw->adjustSize();
00260 }
00261