コード例 #1
0
void HomeImpl::createHomeEntry(KIO::UDSEntry &entry,
                               const KUser &user)
{
	kdDebug() << "HomeImpl::createHomeEntry" << endl;
	
	entry.clear();
	
	QString full_name = user.loginName();
	
	if (!user.fullName().isEmpty())
	{
		full_name = user.fullName()+" ("+user.loginName()+")";
	}
	
	full_name = KIO::encodeFileName( full_name );
	
	addAtom(entry, KIO::UDS_NAME, 0, full_name);
	addAtom(entry, KIO::UDS_URL, 0, "home:/"+user.loginName());
	
	addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);
	addAtom(entry, KIO::UDS_MIME_TYPE, 0, "inode/directory");

	QString icon_name = "folder_home2";

	if (user.uid()==m_effectiveUid)
	{
		icon_name = "folder_home";
	}
	
	addAtom(entry, KIO::UDS_ICON_NAME, 0, icon_name);

	KURL url;
	url.setPath(user.homeDir());
	entry += extractUrlInfos(url);
}
コード例 #2
0
ファイル: kinetd.cpp プロジェクト: serghei/kde3-kdenetwork
QStringList PortListener::processServiceTemplate(const QString &a) {
	QStringList l;
	QValueVector<KInetInterface> v = KInetInterface::getAllInterfaces(false);
	QValueVector<KInetInterface>::Iterator it = v.begin();
	while (it != v.end()) {
		KInetSocketAddress *address = (*(it++)).address();
		if (!address)
			continue;
		QString hostName = address->nodeName();
		KUser u;
		QString x = a; // replace does not work in const QString. Why??
		l.append(x.replace(QRegExp("%h"), KServiceRegistry::encodeAttributeValue(hostName))
			 .replace(QRegExp("%p"), QString::number(m_port))
			 .replace(QRegExp("%u"), KServiceRegistry::encodeAttributeValue(u.loginName()))
			 .replace(QRegExp("%i"), KServiceRegistry::encodeAttributeValue(m_uuid))
			 .replace(QRegExp("%f"), KServiceRegistry::encodeAttributeValue(u.fullName())));
	}
	return l;
}
コード例 #3
0
UploadDialog::UploadDialog(Engine *engine, QWidget *parent)
    : KDialogBase(Plain, i18n("Share Hot New Stuff"), Ok | Cancel, Cancel, parent, 0, false, true), mEngine(engine)
{
    mEntryList.setAutoDelete(true);

    QFrame *topPage = plainPage();

    QGridLayout *topLayout = new QGridLayout(topPage);
    topLayout->setSpacing(spacingHint());

    QLabel *nameLabel = new QLabel(i18n("Name:"), topPage);
    topLayout->addWidget(nameLabel, 0, 0);
    mNameEdit = new QLineEdit(topPage);
    topLayout->addWidget(mNameEdit, 0, 1);

    QLabel *authorLabel = new QLabel(i18n("Author:"), topPage);
    topLayout->addWidget(authorLabel, 1, 0);
    mAuthorEdit = new QLineEdit(topPage);
    topLayout->addWidget(mAuthorEdit, 1, 1);

    QLabel *emailLabel = new QLabel(i18n("Email:"), topPage);
    topLayout->addWidget(emailLabel, 2, 0);
    mEmailEdit = new QLineEdit(topPage);
    topLayout->addWidget(mEmailEdit, 2, 1);

    QLabel *versionLabel = new QLabel(i18n("Version:"), topPage);
    topLayout->addWidget(versionLabel, 3, 0);
    mVersionEdit = new QLineEdit(topPage);
    topLayout->addWidget(mVersionEdit, 3, 1);

    QLabel *releaseLabel = new QLabel(i18n("Release:"), topPage);
    topLayout->addWidget(releaseLabel, 4, 0);
    mReleaseSpin = new QSpinBox(topPage);
    mReleaseSpin->setMinValue(1);
    topLayout->addWidget(mReleaseSpin, 4, 1);

    QLabel *licenceLabel = new QLabel(i18n("License:"), topPage);
    topLayout->addWidget(licenceLabel, 5, 0);
    mLicenceCombo = new QComboBox(topPage);
    mLicenceCombo->setEditable(true);
    mLicenceCombo->insertItem(i18n("GPL"));
    mLicenceCombo->insertItem(i18n("LGPL"));
    mLicenceCombo->insertItem(i18n("BSD"));
    topLayout->addWidget(mLicenceCombo, 5, 1);

    QLabel *languageLabel = new QLabel(i18n("Language:"), topPage);
    topLayout->addWidget(languageLabel, 6, 0);
    mLanguageCombo = new QComboBox(topPage);
    topLayout->addWidget(mLanguageCombo, 6, 1);
    mLanguageCombo->insertStringList(KGlobal::locale()->languageList());

    QLabel *previewLabel = new QLabel(i18n("Preview URL:"), topPage);
    topLayout->addWidget(previewLabel, 7, 0);
    mPreviewUrl = new KURLRequester(topPage);
    topLayout->addWidget(mPreviewUrl, 7, 1);

    QLabel *summaryLabel = new QLabel(i18n("Summary:"), topPage);
    topLayout->addMultiCellWidget(summaryLabel, 8, 8, 0, 1);
    mSummaryEdit = new KTextEdit(topPage);
    topLayout->addMultiCellWidget(mSummaryEdit, 9, 9, 0, 1);

    KUser user;
    mAuthorEdit->setText(user.fullName());
}