summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-im/psi/files/psi-fix_popup_richtext.patch')
-rw-r--r--net-im/psi/files/psi-fix_popup_richtext.patch142
1 files changed, 0 insertions, 142 deletions
diff --git a/net-im/psi/files/psi-fix_popup_richtext.patch b/net-im/psi/files/psi-fix_popup_richtext.patch
deleted file mode 100644
index d25b02b32956..000000000000
--- a/net-im/psi/files/psi-fix_popup_richtext.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-Created by Przemysław 'Trol' Maciąg <pmaciag (at) gmail (dot) com>
-
-Just truncating a popup message text can cause situations like this:
-* text will be trancated 'inside' icon tag
-* text will be trancated 'inside' a tag
-both situations will give a bad string to show. Patch add a simple
-function to correct this situations (and similar ones).
-
-diff --exclude='*orig' -Naur psi-0.10-test3-orig/src/common.cpp psi-0.10-test3/src/common.cpp
---- psi-0.10-test3-orig/src/common.cpp 2005-11-01 18:10:29.000000000 +0100
-+++ psi-0.10-test3/src/common.cpp 2005-12-23 12:11:08.000000000 +0100
-@@ -314,6 +314,83 @@
- return out;
- }
-
-+QString truncateRichText (const QString & intext, int textlen)
-+{
-+ QString outtext;
-+
-+ int i, j, k;
-+ int tag;
-+ int opentags;
-+ char c;
-+ bool atag;
-+
-+ k = intext.length ();
-+ // do we have to truncate it at all?
-+ if (k <= textlen)
-+ return intext;
-+
-+ tag = -1;
-+ atag = false;
-+ j = 0;
-+ opentags = 0;
-+
-+ for (i = 0; i < k; i++)
-+ {
-+ c = intext.at(i);
-+ // opening tag
-+ if (c == QChar ('<'))
-+ {
-+ if (opentags == 0)
-+ {
-+ tag = i;
-+ if (atag)
-+ atag = false;
-+ }
-+ opentags++;
-+ }
-+ // closing tag
-+ else if (c == QChar ('>'))
-+ {
-+ if (opentags == 1)
-+ {
-+ if (atag)
-+ // don't count a tag - only letters 'inside'
-+ j--;
-+ else
-+ j++;
-+ tag = -1;
-+ }
-+ opentags--;
-+ }
-+ // normal character?
-+ else if (opentags == 0)
-+ {
-+ j++;
-+ }
-+ // a tag?
-+ else if (i == (tag + 1) && c == QChar ( 'a' ) && k > (i + 1))
-+ {
-+ c = intext.at((i + 1));
-+ // next character has to be a whitespace
-+ if (c == QChar ( (char)32 ) || c == QChar ( '\t' ))
-+ {
-+ atag = true;
-+ // we don't need to check this character ones more
-+ i++;
-+ }
-+ }
-+
-+ if (opentags == 0 && j >= textlen)
-+ break;
-+ }
-+
-+ outtext = intext.left (i);
-+ // unclosed 'a' tag?
-+ if (atag)
-+ outtext += "</a>";
-+
-+ return outtext;
-+}
-
- // clips plain text
- QString clipStatus(const QString &str, int width, int height)
-diff --exclude='*orig' -Naur psi-0.10-test3-orig/src/common.h psi-0.10-test3/src/common.h
---- psi-0.10-test3-orig/src/common.h 2005-10-06 15:50:35.000000000 +0200
-+++ psi-0.10-test3/src/common.h 2005-12-23 12:11:08.000000000 +0100
-@@ -238,6 +238,7 @@
- QString qstrquote(const QString &, int width=60, bool quoteEmpty=FALSE);
- QString plain2rich(const QString &);
- QString rich2plain(const QString &);
-+QString truncateRichText (const QString & intext, int textlen);
- QString clipStatus(const QString &str, int width, int height);
- QString expandEntities(const QString &in);
- QString resolveEntities(const QString &);
-diff --exclude='*orig' -Naur psi-0.10-test3-orig/src/psipopup.cpp psi-0.10-test3/src/psipopup.cpp
---- psi-0.10-test3-orig/src/psipopup.cpp 2005-10-14 02:36:14.000000000 +0200
-+++ psi-0.10-test3/src/psipopup.cpp 2005-12-23 12:17:56.000000000 +0100
-@@ -207,17 +207,9 @@
- {
- if ( option.ppTextClip > 0 ) {
- // richtext will give us trouble here
-- if ( ((int)text.length()) > option.ppTextClip ) {
-- text = text.left( option.ppTextClip );
--
-- // delete last unclosed tag
-- /*if ( text.find("</") > text.find(">") ) {
--
-- text = text.left( text.find("</") );
-- }*/
--
-- text += "...";
-- }
-+ QString popuptext = truncateRichText (text, option.ppTextClip);
-+ if (text.length () != popuptext.length ())
-+ text = popuptext + "...";
- }
-
- return text;
-diff --exclude='*orig' -Naur psi-0.10-test3-orig/src/psi_profiles.cpp psi-0.10-test3/src/psi_profiles.cpp
---- psi-0.10-test3-orig/src/psi_profiles.cpp 2005-11-01 17:50:16.000000000 +0100
-+++ psi-0.10-test3/src/psi_profiles.cpp 2005-12-23 12:11:08.000000000 +0100
-@@ -548,7 +548,7 @@
- prefs.ppFile = true;
- prefs.ppJidClip = 25;
- prefs.ppStatusClip = -1;
-- prefs.ppTextClip = 300;
-+ prefs.ppTextClip = 200;
- prefs.ppHideTime = 10000; // 10 sec
- prefs.ppBorderColor = QColor (0x52, 0x97, 0xF9);
-