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 QPixmap applicationIcon =
00067 l->loadIcon(QString::fromLatin1(p->appName()),
00068 KIcon::Desktop,
00069 64, KIcon::DefaultState, 0L,
00070 true);
00071
00072 if (applicationIcon.isNull())
00073 {
00074 applicationIcon = l->loadIcon(QString::fromLatin1("kpilot"),
00075 KIcon::Desktop);
00076 }
00077
00078 text = new QLabel(w);
00079
00080
00081
00082 text->setText(i18n("Send questions and comments to kdepim-users@kde.org"));
00083 text->adjustSize();
00084
00085 int linewidth = text->size().width();
00086 int lineheight = text->size().height();
00087
00088
00089 text->setText(QString::null);
00090 text->setPixmap(applicationIcon);
00091 text->adjustSize();
00092 grid->addWidget(text, 0, 1);
00093
00094
00095 KActiveLabel *linktext = new KActiveLabel(w);
00096 grid->addRowSpacing(1,kMax(100,6*lineheight));
00097 grid->addRowSpacing(2,kMax(100,6*lineheight));
00098 grid->addColSpacing(2,SPACING+linewidth/2);
00099 grid->addColSpacing(3,SPACING+linewidth/2);
00100 grid->setRowStretch(1,50);
00101 grid->setRowStretch(2,50);
00102 grid->setColStretch(2,50);
00103 grid->setColStretch(3,50);
00104 linktext->setMinimumSize(linewidth,kMax(260,60+12*lineheight));
00105 linktext->setFixedHeight(kMax(260,60+12*lineheight));
00106 linktext->setVScrollBarMode(QScrollView::Auto);
00107 text = new QLabel(w);
00108 grid->addMultiCellWidget(text,0,0,2,3);
00109 grid->addMultiCellWidget(linktext,1,2,1,3);
00110
00111
00112 s = CSL1("<qt><h3>");
00113 s += p->programName();
00114 s += ' ';
00115 s += p->version();
00116 s += CSL1("</h3>");
00117 s += p->copyrightStatement() + CSL1("<br></qt>");
00118 text->setText(s);
00119
00120 linktext->append(p->shortDescription() + CSL1("<br>"));
00121
00122 if (!p->homepage().isEmpty())
00123 {
00124 s = QString::null;
00125 s += CSL1("<a href=\"%1\">").arg(p->homepage());
00126 s += p->homepage();
00127 s += CSL1("</a><br>");
00128 linktext->append(s);
00129 }
00130
00131 s = QString::null;
00132 s += i18n("Send questions and comments to <a href=\"mailto:%1\">%2</a>.")
00133 .arg( CSL1("kdepim-users@kde.org") )
00134 .arg( CSL1("kdepim-users@kde.org") );
00135 s += ' ';
00136 s += i18n("Send bug reports to <a href=\"mailto:%1\">%2</a>.")
00137 .arg(p->bugAddress())
00138 .arg(p->bugAddress());
00139 s += ' ';
00140 s += i18n("For trademark information, see the "
00141 "<a href=\"help:/kpilot/trademarks.html\">KPilot User's Guide</a>.");
00142 s += CSL1("<br>");
00143 linktext->append(s);
00144 linktext->append(QString::null);
00145
00146
00147
00148 QValueList<KAboutPerson> pl = p->authors();
00149 QValueList<KAboutPerson>::ConstIterator i;
00150
00151 s = i18n("<b>Authors:</b> ");
00152
00153 QString comma = CSL1(", ");
00154
00155 unsigned int count=1;
00156 for (i=pl.begin(); i!=pl.end(); ++i)
00157 {
00158 s.append(CSL1("%1 (<i>%2</i>)%3")
00159 .arg((*i).name())
00160 .arg((*i).task())
00161 .arg(count<pl.count() ? comma : QString::null)
00162 );
00163 count++;
00164 }
00165 linktext->append(s);
00166
00167 s = QString::null;
00168 pl = p->credits();
00169 if (pl.count()>0)
00170 {
00171 count=1;
00172 s.append(i18n("<b>Credits:</b> "));
00173 for (i=pl.begin(); i!=pl.end(); ++i)
00174 {
00175 s.append(CSL1("%1 (<i>%2</i>)%3")
00176 .arg((*i).name())
00177 .arg((*i).task())
00178 .arg(count<pl.count() ? comma : QString::null)
00179 );
00180 count++;
00181 }
00182 }
00183 linktext->append(s);
00184 linktext->ensureVisible(0,0);
00185
00186 w->adjustSize();
00187
00188 return w;
00189 }
00190
00191 void UIDialog::addAboutPage(QTabWidget *tw,
00192 KAboutData *ad,
00193 bool )
00194 {
00195 FUNCTIONSETUP;
00196
00197 Q_ASSERT(tw);
00198
00199 QWidget *w = UIDialog::aboutPage(tw,ad);
00200 QSize sz = w->size();
00201
00202 if (sz.width() < tw->size().width())
00203 {
00204 sz.setWidth(tw->size().width());
00205 }
00206 if (sz.height() < tw->size().height())
00207 {
00208 sz.setHeight(tw->size().height());
00209 }
00210
00211 tw->resize(sz);
00212 tw->addTab(w, i18n("About"));
00213 tw->adjustSize();
00214 }
00215