mirror of
https://github.com/QuasarApp/qca.git
synced 2025-05-12 02:39:34 +00:00
support for a credit string
svn path=/trunk/kdesupport/qca/; revision=513334
This commit is contained in:
parent
b240cd4b3d
commit
a948a8f3ba
@ -624,6 +624,15 @@ namespace QCA
|
||||
*/
|
||||
virtual QStringList features() const = 0;
|
||||
|
||||
/**
|
||||
* Optional credit text for the provider.
|
||||
*
|
||||
* You might display this information in a credits or
|
||||
* "About" dialog. Returns an empty string if the
|
||||
* provider has no credit text.
|
||||
*/
|
||||
virtual QString credit() const;
|
||||
|
||||
/**
|
||||
* Routine to create a plugin context
|
||||
*
|
||||
|
@ -5019,6 +5019,13 @@ public:
|
||||
return "qca-openssl";
|
||||
}
|
||||
|
||||
QString credit() const
|
||||
{
|
||||
return QString(
|
||||
"This product includes cryptographic software "
|
||||
"written by Eric Young (eay@cryptsoft.com)");
|
||||
}
|
||||
|
||||
QStringList features() const
|
||||
{
|
||||
QStringList list;
|
||||
|
@ -479,6 +479,11 @@ void Provider::init()
|
||||
{
|
||||
}
|
||||
|
||||
QString Provider::credit() const
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
Provider::Context::Context(Provider *parent, const QString &type)
|
||||
{
|
||||
_provider = parent;
|
||||
|
@ -23,6 +23,44 @@
|
||||
//Q_IMPORT_PLUGIN(opensslPlugin);
|
||||
//Q_IMPORT_PLUGIN(gnupgPlugin);
|
||||
|
||||
static QStringList wrapstring(const QString &str, int width)
|
||||
{
|
||||
QStringList out;
|
||||
QString simp = str.simplified();
|
||||
QString rest = simp;
|
||||
while(1)
|
||||
{
|
||||
int lastSpace = -1;
|
||||
int n;
|
||||
for(n = 0; n < rest.length(); ++n)
|
||||
{
|
||||
if(rest[n].isSpace())
|
||||
lastSpace = n;
|
||||
if(n == width)
|
||||
break;
|
||||
}
|
||||
if(n == rest.length())
|
||||
{
|
||||
out += rest;
|
||||
break;
|
||||
}
|
||||
|
||||
QString line;
|
||||
if(lastSpace != -1)
|
||||
{
|
||||
line = rest.mid(0, lastSpace);
|
||||
rest = rest.mid(lastSpace + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
line = rest.mid(0, n);
|
||||
rest = rest.mid(n);
|
||||
}
|
||||
out += line;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
class AnimatedKeyGen : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -824,6 +862,13 @@ int main(int argc, char **argv)
|
||||
for(int n = 0; n < list.count(); ++n)
|
||||
{
|
||||
printf(" %s\n", qPrintable(list[n]->name()));
|
||||
QString credit = list[n]->credit();
|
||||
if(!credit.isEmpty())
|
||||
{
|
||||
QStringList lines = wrapstring(credit, 74);
|
||||
foreach(QString s, lines)
|
||||
printf(" %s\n", qPrintable(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user