-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.cpp
68 lines (56 loc) · 1.16 KB
/
utils.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//////////////////////////////////////////////////////////////
// $Id: utils.cpp 20996 1999-05-07 14:13:11Z toivo $
//
// Author: Toivo Pedaste
//
#include "config.h"
#include "utils.h"
#include <kmsgbox.h>
#include <kpackage.h>
void KpMsgE( const char *format, const char *str, bool stop)
{
KpMsg( "Error", format, str, stop);
}
void KpMsg(const char *lab, const char *format, const char *str, bool stop)
{
QString qtmp;
int flag ;
char buf[201];
if (stop)
flag = KMsgBox::STOP;
else
flag = KMsgBox::EXCLAMATION;
if (format) {
strncpy(buf,str,200);
buf[200] = 0;
qtmp.sprintf(format,buf);
KMsgBox::message(kpkg, lab, qtmp.data(), flag);
} else {
KMsgBox::message(kpkg, lab, str, flag);
}
}
char *getGroup(char **gs)
{
char *gsc = strdup(*gs);
char *p=gsc;
while(*p && *p != '/')
{
p++;
(*gs)++;
}
*p='\0';
if(**gs)
(*gs)++;
return gsc;
}
QListViewItem *findGroup(char *name, QListViewItem *search)
{
if(!search)
return NULL;
do {
if(strcmp(name, search->text(0)) == 0) {
return search;
}
} while( (search=search->nextSibling()) != NULL);
return NULL;
}